示例#1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            var key = InitialKey.FromHexString(textBoxKey.Text);
            if (key.BinaryValue == null)
            {
                MessageBox.Show("Неверный формат ключа!");
                return;
            }
            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
				var licenseInfo = new ResursLicenseInfo { DevicesCount = (int)numericUpDownDevicesCount.Value };

				if (LicenseManager.TrySave(saveFileDialog.FileName, licenseInfo, key))
                    MessageBox.Show("Лицензия успешно сохранена!");
                else
                    MessageBox.Show("Лицензия не сохранена!", "Ошибка сохранения", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            if (args.Length >= 3)
            {
                var key = InitialKey.FromHexString(args[1]);
                if (key.BinaryValue == null)
                    return;

				int devicesCount;
				if (!int.TryParse(args[2], out devicesCount))
                    return;

			    var licenseInfo = new ResursLicenseInfo { DevicesCount = devicesCount };
				LicenseManager.TrySave(args[0], licenseInfo, key);
                return;
            }

            if (args.Length == 1 && args[0].ToLower().Replace("/", "-").Replace(" ", "") == "-gui")
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MainForm());
            }
        }
示例#3
0
		public static bool TrySave(string path, ResursLicenseInfo licenseInfo, InitialKey key)
		{
			return _manager.TrySave(path, licenseInfo, key);
		}