Beispiel #1
0
        public void InstallLicenseCommand()
        {
            Editor editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                CommandLineQuerries.SpecifyFileNameForRead(ref LicenseManager.string_0, "license");
                if (!File.Exists(LicenseManager.string_0))
                {
                    editor.WriteMessage("\n" + LicenseManager.string_0 + " does not exist.");
                }
                else
                {
                    Reg.SetComputationalCADRegistryValue("LICENSEFILE", LicenseManager.string_0);
                    LicenseManager.Initialize();
                }
            }
            catch (System.Exception ex)
            {
                editor.WriteMessage(Environment.NewLine + ex.Message + Environment.NewLine);
            }
        }
Beispiel #2
0
 public static void CheckValid(string license)
 {
     if (!LicenseManager.IsInitialized)
     {
         LicenseManager.Initialize();
         //LicenseManager.CheckValid(license);
         return;
     }
     if (LicenseManager.IsLicensed)
     {
         return;
     }
     MessageBox.Show(string.Concat(new string[]
     {
         "Your current license does not allow to execute this command.",
         Environment.NewLine,
         "Your current license status is: ",
         LicenseManager.Description,
         Environment.NewLine,
         "Visit www.computational-cad.com for support or to purchase a license."
     }), "ComputationalCAD license manager");
     throw new System.Exception("Your license options do not allow to execute this command.");
 }
Beispiel #3
0
        public AboutObject()
        {
            //System.ComponentModel.LicenseManager.Validate(typeof(AboutObject));
            this.string_0  = " - service not available - ";
            this.string_1  = " - service not available - ";
            this.string_2  = " - service not available - ";
            this.string_3  = " - service not available - ";
            this.string_4  = " - service not available - ";
            this.string_5  = " - service not available - ";
            this.string_6  = " - service not available - ";
            this.string_7  = " - service not available - ";
            this.string_8  = " - service not available - ";
            this.string_9  = " - service not available - ";
            this.string_10 = " - service not available - ";
            this.string_11 = " - service not available - ";
            this.string_12 = " - service not available - ";
            this.string_13 = " - service not available - ";
            this.string_14 = " - service not available - ";
            this.string_15 = " - service not available - ";
            this.string_16 = "";
            this.string_17 = "";
            //base..ctor();
            this.string_0  = Assembly.GetExecutingAssembly().GetName().Name.ToString().Trim();
            this.string_1  = ((AssemblyCopyrightAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright.Trim();
            this.string_2  = Assembly.GetExecutingAssembly().GetName().Version.ToString().Trim();
            this.string_14 = "www.computational-cad.com";
            this.string_15 = "*****@*****.**";
            this.string_3  = Environment.Version.ToString().Trim();
            this.string_4  = Environment.OSVersion.ToString().Trim();
            this.string_5  = Assembly.GetCallingAssembly().GetName().Name.ToString().Trim() + " V" + Assembly.GetCallingAssembly().GetName().Version.ToString().Trim();
            this.string_6  = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("ACADVER").ToString().Trim();
            try
            {
                ManagementObjectSearcher managementObjectSearcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_Processor");
                using (ManagementObjectCollection.ManagementObjectEnumerator enumerator = managementObjectSearcher.Get().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ManagementObject managementObject = (ManagementObject)enumerator.Current;
                        this.string_7  = managementObject["Name"].ToString().Trim();
                        this.string_8  = managementObject["Description"].ToString().Trim();
                        this.string_9  = managementObject["Manufacturer"].ToString().Trim();
                        this.string_10 = managementObject["NumberOfCores"].ToString().Trim();
                        this.string_11 = managementObject["NumberOfLogicalProcessors"].ToString().Trim();
                        if (managementObject["Architecture"].ToString().Trim() == "0")
                        {
                            this.string_12 = "x86";
                        }
                        if (managementObject["Architecture"].ToString().Trim() == "1")
                        {
                            this.string_12 = "MIPS";
                        }
                        if (managementObject["Architecture"].ToString().Trim() == "2")
                        {
                            this.string_12 = "Alpha";
                        }
                        if (managementObject["Architecture"].ToString().Trim() == "3")
                        {
                            this.string_12 = "PowerPC";
                        }
                        if (managementObject["Architecture"].ToString().Trim() == "6")
                        {
                            this.string_12 = "Intel Itanium Processor Family (IPF)";
                        }
                        if (managementObject["Architecture"].ToString().Trim() == "9")
                        {
                            this.string_12 = "x64";
                        }
                    }
                }
            }
            catch
            {
            }
            string str = "\nMemory data\n";

            str += "-----------\n";
            try
            {
                ManagementObjectSearcher managementObjectSearcher2 = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_ComputerSystem");
                using (ManagementObjectCollection.ManagementObjectEnumerator enumerator2 = managementObjectSearcher2.Get().GetEnumerator())
                {
                    while (enumerator2.MoveNext())
                    {
                        ManagementObject managementObject2 = (ManagementObject)enumerator2.Current;
                        this.string_13 = (Convert.ToDouble(managementObject2["TotalPhysicalMemory"].ToString()) / 1024.0 / 1024.0).ToString("0.00") + "MB";
                    }
                }
            }
            catch
            {
            }
            if (!LicenseManager.IsInitialized)
            {
                LicenseManager.Initialize();
            }
            this.string_16 = LicenseManager.Description;
            this.string_17 = LicenseManager.HardwareID;
        }