public override bool Equals(object o) { if (!(o is DefaultViewer)) { return(false); } DefaultViewer v = o as DefaultViewer; if (!IsActive.Equals(v.IsActive)) { return(false); } if (!OutputFormat.Equals(v.OutputFormat)) { return(false); } if (!Parameters.Equals(v.Parameters)) { return(false); } if (!Path.Equals(v.Path)) { return(false); } return(true); }
public DefaultViewer GetDefaultViewerByOutputFormat(OutputFormat format) { //Same default viewer for all pdf types if (format == OutputFormat.PdfA1B || format == OutputFormat.PdfA2B || format == OutputFormat.PdfX) { format = OutputFormat.Pdf; } foreach (var defaultViewer in DefaultViewers) { if (defaultViewer.OutputFormat == format) { return(defaultViewer); } } var defaultViewerByOutputFormat = new DefaultViewer(); defaultViewerByOutputFormat.IsActive = false; defaultViewerByOutputFormat.OutputFormat = format; defaultViewerByOutputFormat.Path = ""; defaultViewerByOutputFormat.Parameters = ""; DefaultViewers.Add(defaultViewerByOutputFormat); return(defaultViewerByOutputFormat); }
public void ReadValues(Data data, string path = "") { ApplicationSettings.ReadValues(data, path + @"ApplicationSettings\"); try { int numClasses = int.Parse(data.GetValue(@"" + path + @"ConversionProfiles\numClasses")); for (int i = 0; i < numClasses; i++) { ConversionProfile tmp = new ConversionProfile(); tmp.ReadValues(data, @"" + path + @"ConversionProfiles\" + i + @"\"); ConversionProfiles.Add(tmp); } } catch {} CreatorAppSettings.ReadValues(data, path + @"CreatorAppSettings\"); try { int numClasses = int.Parse(data.GetValue(@"" + path + @"DefaultViewers\numClasses")); for (int i = 0; i < numClasses; i++) { DefaultViewer tmp = new DefaultViewer(); tmp.ReadValues(data, @"" + path + @"DefaultViewers\" + i + @"\"); DefaultViewers.Add(tmp); } } catch {} }
public DefaultViewer Copy() { DefaultViewer copy = new DefaultViewer(); copy.IsActive = IsActive; copy.OutputFormat = OutputFormat; copy.Parameters = Parameters; copy.Path = Path; return(copy); }
public void ReadValues(Data data, string path) { Accounts.ReadValues(data, path + @"Accounts\"); try { int numClasses = int.Parse(data.GetValue(@"" + path + @"DefaultViewers\numClasses")); for (int i = 0; i < numClasses; i++) { DefaultViewer tmp = new DefaultViewer(); tmp.ReadValues(data, @"" + path + @"DefaultViewers\" + i + @"\"); DefaultViewers.Add(tmp); } } catch {} JobHistory.ReadValues(data, path + @"JobHistory\"); try { int numClasses = int.Parse(data.GetValue(@"" + path + @"PrinterMappings\numClasses")); for (int i = 0; i < numClasses; i++) { PrinterMapping tmp = new PrinterMapping(); tmp.ReadValues(data, @"" + path + @"PrinterMappings\" + i + @"\"); PrinterMappings.Add(tmp); } } catch {} try { int numClasses = int.Parse(data.GetValue(@"" + path + @"TitleReplacement\numClasses")); for (int i = 0; i < numClasses; i++) { TitleReplacement tmp = new TitleReplacement(); tmp.ReadValues(data, @"" + path + @"TitleReplacement\" + i + @"\"); TitleReplacement.Add(tmp); } } catch {} try { AskSwitchDefaultPrinter = bool.Parse(data.GetValue(@"" + path + @"AskSwitchDefaultPrinter")); } catch { AskSwitchDefaultPrinter = true; } try { Language = Data.UnescapeString(data.GetValue(@"" + path + @"Language")); } catch { Language = ""; } try { LastLoginVersion = Data.UnescapeString(data.GetValue(@"" + path + @"LastLoginVersion")); } catch { LastLoginVersion = ""; } try { LastSaveDirectory = Data.UnescapeString(data.GetValue(@"" + path + @"LastSaveDirectory")); } catch { LastSaveDirectory = ""; } try { LastUsedProfileGuid = Data.UnescapeString(data.GetValue(@"" + path + @"LastUsedProfileGuid")); } catch { LastUsedProfileGuid = "DefaultGuid"; } try { LoggingLevel = (LoggingLevel)Enum.Parse(typeof(LoggingLevel), data.GetValue(@"" + path + @"LoggingLevel")); } catch { LoggingLevel = LoggingLevel.Error; } try { PrimaryPrinter = Data.UnescapeString(data.GetValue(@"" + path + @"PrimaryPrinter")); } catch { PrimaryPrinter = "PDFCreator"; } try { UpdateInterval = (UpdateInterval)Enum.Parse(typeof(UpdateInterval), data.GetValue(@"" + path + @"UpdateInterval")); } catch { UpdateInterval = UpdateInterval.Weekly; } }
public void StoreValues(Data data, string path) { ApplicationSettings.StoreValues(data, path + @"ApplicationSettings\"); for (int i = 0; i < ConversionProfiles.Count; i++) { ConversionProfile tmp = ConversionProfiles[i]; tmp.StoreValues(data, @"" + path + @"ConversionProfiles\" + i + @"\"); } data.SetValue(@"" + path + @"ConversionProfiles\numClasses", ConversionProfiles.Count.ToString()); CreatorAppSettings.StoreValues(data, path + @"CreatorAppSettings\"); for (int i = 0; i < DefaultViewers.Count; i++) { DefaultViewer tmp = DefaultViewers[i]; tmp.StoreValues(data, @"" + path + @"DefaultViewers\" + i + @"\"); } data.SetValue(@"" + path + @"DefaultViewers\numClasses", DefaultViewers.Count.ToString()); }
public void ReplaceWith(DefaultViewer source) { if (IsActive != source.IsActive) { IsActive = source.IsActive; } if (OutputFormat != source.OutputFormat) { OutputFormat = source.OutputFormat; } if (Parameters != source.Parameters) { Parameters = source.Parameters; } if (Path != source.Path) { Path = source.Path; } }
public void StoreValues(Data data, string path) { Accounts.StoreValues(data, path + @"Accounts\"); for (int i = 0; i < DefaultViewers.Count; i++) { DefaultViewer tmp = DefaultViewers[i]; tmp.StoreValues(data, @"" + path + @"DefaultViewers\" + i + @"\"); } data.SetValue(@"" + path + @"DefaultViewers\numClasses", DefaultViewers.Count.ToString()); JobHistory.StoreValues(data, path + @"JobHistory\"); for (int i = 0; i < PrinterMappings.Count; i++) { PrinterMapping tmp = PrinterMappings[i]; tmp.StoreValues(data, @"" + path + @"PrinterMappings\" + i + @"\"); } data.SetValue(@"" + path + @"PrinterMappings\numClasses", PrinterMappings.Count.ToString()); for (int i = 0; i < TitleReplacement.Count; i++) { TitleReplacement tmp = TitleReplacement[i]; tmp.StoreValues(data, @"" + path + @"TitleReplacement\" + i + @"\"); } data.SetValue(@"" + path + @"TitleReplacement\numClasses", TitleReplacement.Count.ToString()); data.SetValue(@"" + path + @"AskSwitchDefaultPrinter", AskSwitchDefaultPrinter.ToString()); data.SetValue(@"" + path + @"Language", Data.EscapeString(Language)); data.SetValue(@"" + path + @"LastLoginVersion", Data.EscapeString(LastLoginVersion)); data.SetValue(@"" + path + @"LastSaveDirectory", Data.EscapeString(LastSaveDirectory)); data.SetValue(@"" + path + @"LastUsedProfileGuid", Data.EscapeString(LastUsedProfileGuid)); data.SetValue(@"" + path + @"LoggingLevel", LoggingLevel.ToString()); data.SetValue(@"" + path + @"PrimaryPrinter", Data.EscapeString(PrimaryPrinter)); data.SetValue(@"" + path + @"UpdateInterval", UpdateInterval.ToString()); }