/// <summary> /// Save to a given file path /// </summary> /// <param name="path"></param> public void SaveToFile(string path) { //Check last modification if (LastModification != DateTime.MinValue && File.Exists(path)) { DateTime lastDateTime = File.GetLastWriteTime(path); if (LastModification != lastDateTime) { throw new Exception("Unable to save the Server Configuration file. The file has been modified by another user."); } } var xmlOverrides = new XmlAttributeOverrides(); XmlAttributes attrs = new XmlAttributes(); attrs.XmlIgnore = true; xmlOverrides.Add(typeof(RootComponent), "Name", attrs); xmlOverrides.Add(typeof(RootComponent), "GUID", attrs); //Pdf & Excel if (PdfConverterEdited) { PdfConfigurations = PdfConverter.GetConfigurations(); } if (DashboardPdfConverterEdited) { DashboardPdfConfigurations = DashboardPdfConverter.GetConfigurations(); } if (ExcelConverterEdited) { ExcelConfigurations = ExcelConverter.GetConfigurations(); } if (DashboardExcelConverterEdited) { DashboardExcelConfigurations = DashboardExcelConverter.GetConfigurations(); } #if !DEBUG && !NETCOREAPP //Set installation path, used by, to define schedules if (Path.GetFileName(Application.ExecutablePath).ToLower() == Repository.SealServerManager.ToLower() || Path.GetFileName(Application.ExecutablePath).ToLower() == Repository.SealReportDesigner.ToLower()) { _installationDirectory = Path.GetDirectoryName(Application.ExecutablePath); } #endif XmlSerializer serializer = new XmlSerializer(typeof(SealServerConfiguration), xmlOverrides); XmlWriterSettings ws = new XmlWriterSettings(); ws.NewLineHandling = NewLineHandling.Entitize; using (XmlWriter xw = XmlWriter.Create(path, ws)) { serializer.Serialize(xw, this); } FilePath = path; LastModification = File.GetLastWriteTime(path); }
protected override void UpdateEditorAttributes() { if (_dctd != null) { //Disable all properties foreach (var property in Properties) { property.SetIsBrowsable(false); } //Then enable GetProperty("UseSealScheduler").SetIsBrowsable(!ForPublication); GetProperty("TaskFolderName").SetIsBrowsable(!ForPublication); GetProperty("TaskFolderName").SetIsReadOnly(UseSealScheduler); GetProperty("DefaultCulture").SetIsBrowsable(!ForPublication); GetProperty("LogoName").SetIsBrowsable(!ForPublication); GetProperty("WebProductName").SetIsBrowsable(!ForPublication); GetProperty("WebCultures").SetIsBrowsable(!ForPublication); GetProperty("LogDays").SetIsBrowsable(!ForPublication); GetProperty("CsvSeparator").SetIsBrowsable(!ForPublication); GetProperty("NumericFormat").SetIsBrowsable(!ForPublication); GetProperty("DateTimeFormat").SetIsBrowsable(!ForPublication); GetProperty("AuditEnabled").SetIsBrowsable(!ForPublication); GetProperty("AuditScript").SetIsBrowsable(!ForPublication); GetProperty("AuditScript").SetIsReadOnly(!AuditEnabled); GetProperty("InitScript").SetIsBrowsable(!ForPublication); GetProperty("CommonScripts").SetIsBrowsable(!ForPublication); //GetProperty("CommonScripts").SetDisplayName("Common Scripts: " + (_commonScripts.Count == 0 ? "None" : _commonScripts.Count.ToString() + " Items(s)")); GetProperty("ReportCreationScript").SetIsBrowsable(!ForPublication); GetProperty("IsLocal").SetIsBrowsable(!ForPublication); GetProperty("FileReplacePatterns").SetIsBrowsable(!ForPublication); GetProperty("CssFiles").SetIsBrowsable(!ForPublication); GetProperty("ScriptFiles").SetIsBrowsable(!ForPublication); GetProperty("PdfServer").SetIsBrowsable(!ForPublication); GetProperty("PdfServerPort").SetIsBrowsable(!ForPublication); GetProperty("PdfUseClient").SetIsBrowsable(!ForPublication); GetProperty("PdfServicePassword").SetIsBrowsable(!ForPublication); GetProperty("PdfWebServiceURL").SetIsBrowsable(!ForPublication); GetProperty("PdfUseWebService").SetIsBrowsable(!ForPublication); GetProperty("ExcelConverter").SetIsBrowsable(!ForPublication); GetProperty("PdfConverter").SetIsBrowsable(!ForPublication); GetProperty("HelperResetPDFConfigurations").SetIsBrowsable(!ForPublication); GetProperty("HelperResetExcelConfigurations").SetIsBrowsable(!ForPublication); GetProperty("DashboardExcelConverter").SetIsBrowsable(!ForPublication); GetProperty("DashboardPdfConverter").SetIsBrowsable(!ForPublication); GetProperty("HelperResetDashboardPDFConfigurations").SetIsBrowsable(!ForPublication); GetProperty("HelperResetDashboardExcelConfigurations").SetIsBrowsable(!ForPublication); if (!ForPublication) { ExcelConverter.InitEditor(); DashboardExcelConverter.InitEditor(); PdfConverter.InitEditor(); DashboardPdfConverter.InitEditor(); } GetProperty("WebNETCore").SetIsBrowsable(ForPublication); GetProperty("WebApplicationPoolName").SetIsBrowsable(ForPublication); GetProperty("WebApplicationName").SetIsBrowsable(ForPublication); GetProperty("WebPublicationDirectory").SetIsBrowsable(ForPublication); TypeDescriptor.Refresh(this); } }