public void UninstallModel(string modelName, string modelPublisher) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration(); config.AOSConfiguration = AOSName; AxUtil util = new AxUtil(); config.ModelArgument = new ModelArgument(modelName, modelPublisher); if (ModelExists(modelName, modelPublisher)) { util.Delete(utilContext, config); } if (utilContext.ExecutionStatus == ExecutionStatus.Error) { foreach (string error in utilContext.Errors) { Console.WriteLine(error); } throw new Exception("Model uninstall failed."); } }
public void SetNoInstallMode() { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration(); config.AOSConfiguration = AOSName; AxUtil util = new AxUtil(); util.Config = config; util.Context = utilContext; util.ApplyInstallModeState(InstallModeState.NoInstallMode); }
private void GenerateLicense() { LicenseInfo licenseInfo = new LicenseInfo { FilePath = PathTB.Text, LicenseCode = LicenseCodeTB.Text, Customer = CustomerTB.Text, SerialNumber = SerialNumberTB.Text, Timestamp = DateTime.Now }; if (ExpirationDatePicker.Value != ExpirationDatePicker.MinDate) { licenseInfo.ExpirationDate = ExpirationDatePicker.Value; } if (UserCount.Value > 0) { licenseInfo.UserCount = (int)UserCount.Value; } if (!this.ValidateFields()) { MessageBox.Show("Please fill all mandatory fields."); throw new System.MissingFieldException("Please fill all mandatory fields."); } AxUtilContext context = new AxUtilContext(); config.LicenseInfo = licenseInfo; AxUtil util = new AxUtil(context, config); X509Store store = new X509Store("My", StoreLocation.CurrentUser); store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); X509Certificate2Collection collection = (X509Certificate2Collection)store.Certificates; X509Certificate2Collection fcollection = (X509Certificate2Collection)collection.Find(X509FindType.FindByTimeValid, DateTime.Now, false); X509Certificate2Collection scollection = X509Certificate2UI.SelectFromCollection(fcollection, "Certificate Select", "Select a certificate from the following list to sign the license", X509SelectionFlag.SingleSelection); Boolean result = util.GenerateLicense(scollection); if (result == true) { MessageBox.Show(String.Format("License generated successfully. Saved at {0}", PathTB.Text)); OutputTB.Text = String.Format("License generated successfully. Saved at {0}", PathTB.Text); } }
public void UninstallAllLayerModels(string layer) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration() { Server = dbServer, Database = dbName, Layer = layer }; AxUtil util = new AxUtil(); util.Delete(utilContext, config); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { throw new Exception(string.Format("Uninstall all models in layer failed: {0}", GetUtilContextErrorStr(utilContext))); } }
public void UninstallModel(string modelName, string modelPublisher) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration() { Server = dbServer, Database = dbName, ModelArgument = new ModelArgument(modelName, modelPublisher) }; AxUtil util = new AxUtil(); util.Delete(utilContext, config); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { throw new Exception(string.Format("Model uninstall failed: {0}", GetUtilContextErrorStr(utilContext))); } }
public void SetNoInstallMode() { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration() { Server = dbServer, Database = dbName }; AxUtil util = new AxUtil(utilContext, config); util.ApplyInstallModeState(InstallModeState.NoInstallMode); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { throw new Exception(string.Format("Setting no install mode failed: {0}", GetUtilContextErrorStr(utilContext))); } }
public List <string> GetModelElements(string modelName, string modelPublisher) { List <string> modelElements = new List <string>(); AxUtilContext utilContext = new AxUtilContext(); var modelArgument = new ModelArgument(modelName, modelPublisher); AxUtil util = new AxUtil(); util.Context = new AxUtilContext(); util.Config = new AxUtilConfiguration(); var contents = util.View(modelArgument, true); foreach (var c in contents.Elements) { modelElements.Add(c.Path); } return(modelElements); }
protected void CreateModelFromManifest(ModelManifest manifest) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration() { Server = dbServer, Database = dbName, ModelArgument = new ModelArgument(manifest), Layer = manifest.Layer.ToString() }; AxUtil util = new AxUtil(); bool created = util.Create(utilContext, config, manifest); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { throw new Exception(string.Format("Model creation failed: {0}", GetUtilContextErrorStr(utilContext))); } if (!created) { throw new Exception("Model creation failed."); } }
public void CreateModel(string manifestFile, string version = "", string description = "") { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration(); config.AOSConfiguration = AOSName; AxUtil util = new AxUtil(); ModelManifest manifest = ModelManifest.Read(manifestFile); if (!String.IsNullOrEmpty(version)) { manifest.Version = GetModelVersion(version, manifest.Version); } if (!String.IsNullOrEmpty(description)) { manifest.Description = description; } config.ModelArgument = new ModelArgument(manifest.Name, manifest.Publisher); config.Layer = manifest.Layer.ToString(); bool created = util.Create(utilContext, config, manifest); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { foreach (string error in utilContext.Errors) { Console.WriteLine(error); } throw new Exception("Model creation failed."); } if (!created) { throw new Exception("Model creation failed."); } }
public bool ModelExist(string modelName, string modelPublisher, string layer = "") { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration() { Server = dbServer, Database = dbName, ModelArgument = new ModelArgument(modelName, modelPublisher) }; bool modelFound = false; AxUtil util = new AxUtil(); IList <ModelManifest> list = util.List(utilContext, config); foreach (ModelManifest manifest in list) { if (manifest.Name == modelName && manifest.Publisher == modelPublisher && (string.IsNullOrEmpty(layer) || layer.ToLower() == manifest.Layer.ToString().ToLower())) { modelFound = true; } } return(modelFound); }
public void DeleteLayer(string layer) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration(); config.AOSConfiguration = AOSName; AxUtil util = new AxUtil(); config.Layer = layer; util.Delete(utilContext, config); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { foreach (string error in utilContext.Errors) { Console.WriteLine(error); } throw new Exception("Layer deletion failed."); } }
public bool ModelExists(string modelName, string modelPublisher) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration(); config.AOSConfiguration = AOSName; bool modelFound = false; AxUtil util = new AxUtil(); config.ModelArgument = new ModelArgument(modelName, modelPublisher); IList <ModelManifest> list = util.List(utilContext, config); foreach (ModelManifest manifest in list) { if (manifest.Name == modelName && manifest.Publisher == modelPublisher) { modelFound = true; } } return(modelFound); }
public void CreateModel(string modelName, string modelPublisher, string layer, string displayName, string description, string version) { AxUtilContext utilContext = new AxUtilContext(); AxUtilConfiguration config = new AxUtilConfiguration(); config.AOSConfiguration = AOSName; AxUtil util = new AxUtil(); //config.ExportFile = modelFile; config.ModelArgument = new ModelArgument(modelName, modelPublisher); config.Layer = layer; ModelManifest manifest = new ModelManifest(); manifest.Name = modelName; manifest.Publisher = modelPublisher; manifest.Version = version; manifest.DisplayName = displayName; manifest.Description = description; bool created = util.Create(utilContext, config, manifest); if (utilContext.ExecutionStatus == ExecutionStatus.Error) { foreach (string error in utilContext.Errors) { Console.WriteLine(error); } throw new Exception("Model creation failed."); } if (!created) { throw new Exception("Model creation failed."); } }