using System;
using ab = AndreyBushman.AutoCAD;
namespace ConsoleAcadInfoTesting {
class Program {
static void Main(string[] args) {
Console.Title = "AcadInfo using";
// Get installed AutoCAD applications for local machine
ab.AcadInfo[] localAcads = ab.AcadInfo.GetInstalledAutoCADs();
// For receiving this information from network computer, you must have necessary
// permissions:
//String networkComputerName = "Bushman";
//ab.AcadInfo[] remoteAcads = ab.AcadInfo.GetInstalledAutoCADs(networkComputerName);
// The localAcads will be null, if AutoCAD applications not found.
if (null != localAcads) {
foreach (ab.AcadInfo acad in localAcads) {
// Display a some info:
Console.WriteLine("Application: {0}", acad.ProductName);
Console.WriteLine("Location: {0}", acad.Location);
// Relative path, since can be used as in HKLM, as in HKCU.
Console.WriteLine("Acad Registry: {0}", acad.AcadRegistry);
Console.WriteLine("Patch title: {0}", acad.PatchTitle);
// Full path, since always located in HKLM
Console.WriteLine("SP Registry: {0}", acad.ServicePackRegistry);
Console.WriteLine("Release: {0}", acad.Release);
Console.WriteLine("Language: {0}", acad.Language);
Console.WriteLine();
Console.WriteLine(@"Count plugins, registered in HKLM\...\Applications: {0}",
acad.HKLMApplications.Count);
// If AutoCAD was installed, but was not run in a current windows profile,
// then a necessary registry key in HKCU will be absent
Int32 count = acad.HKCUApplications == null ? 0 : acad.HKCUApplications.Count;
Console.WriteLine(@"Count plugins, registered in HKCU\...\Applications: {0}", count);
// If AutoCAD was installed, but was not run in a current windows profile,
// then a necessary registry key in HKCU will be absent
count = acad.Startup == null ? 0 : acad.Startup.Length;
Console.WriteLine(@"Count existence AutoCAD profiles in HKCU\...\Profiless: {0}", count);
Console.WriteLine();
Console.WriteLine(new String('*', 10));
Console.WriteLine();
}
}
else {
Console.WriteLine("AutoCAD applications not found.");
}
// Display a count of bundle plugins
Console.WriteLine(@"Count of BUNDLE plugins in %ProgramFiles%\...\: {0}",
ab.AcadInfo.ProgramFileBundles.Count);
Console.WriteLine(@"Count of BUNDLE plugins in %AppData%\...\: {0}",
ab.AcadInfo.AppDataBundles.Count);
Console.WriteLine();
Console.WriteLine("Press any key for exit...");
Console.ReadKey();
}
}
}