public override string ToString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < ApiAccess.Count; i++) { sb.AppendLine(ApiAccess.ToString()); } for (int i = 0; i < PrinterMappings.Count; i++) { sb.AppendLine(PrinterMappings.ToString()); } for (int i = 0; i < TitleReplacement.Count; i++) { sb.AppendLine(TitleReplacement.ToString()); } sb.AppendLine("AskSwitchDefaultPrinter=" + AskSwitchDefaultPrinter.ToString()); sb.AppendLine("Language=" + Language.ToString()); sb.AppendLine("LastUsedProfileGuid=" + LastUsedProfileGuid.ToString()); sb.AppendLine("LoggingLevel=" + LoggingLevel.ToString()); sb.AppendLine("PrimaryPrinter=" + PrimaryPrinter.ToString()); sb.AppendLine("UpdateInterval=" + UpdateInterval.ToString()); return(sb.ToString()); }
public void StoreValues(Data data, string path) { for (int i = 0; i < ApiAccess.Count; i++) { ApiAccess tmp = ApiAccess[i]; tmp.StoreValues(data, @"" + path + @"ApiAccess\" + i + @"\"); } data.SetValue(@"" + path + @"ApiAccess\numClasses", ApiAccess.Count.ToString()); 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 + @"LastUsedProfileGuid", Data.EscapeString(LastUsedProfileGuid)); data.SetValue(@"" + path + @"LoggingLevel", LoggingLevel.ToString()); data.SetValue(@"" + path + @"PrimaryPrinter", Data.EscapeString(PrimaryPrinter)); data.SetValue(@"" + path + @"UpdateInterval", UpdateInterval.ToString()); }
public TitleReplacement Copy() { TitleReplacement copy = new TitleReplacement(); copy.Replace = Replace; copy.ReplacementType = ReplacementType; copy.Search = Search; return(copy); }
public void ReadValues(Data data, string path) { try { int numClasses = int.Parse(data.GetValue(@"" + path + @"ApiAccess\numClasses")); for (int i = 0; i < numClasses; i++) { ApiAccess tmp = new ApiAccess(); tmp.ReadValues(data, @"" + path + @"ApiAccess\" + i + @"\"); ApiAccess.Add(tmp); } } catch {} 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 { 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 override bool Equals(object o) { if (!(o is TitleReplacement)) { return(false); } TitleReplacement v = o as TitleReplacement; if (!Replace.Equals(v.Replace)) { return(false); } if (!ReplacementType.Equals(v.ReplacementType)) { return(false); } if (!Search.Equals(v.Search)) { return(false); } return(true); }