Пример #1
0
        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());
        }
Пример #2
0
        public PrinterMapping Copy()
        {
            PrinterMapping copy = new PrinterMapping();

            copy.PrinterName = PrinterName;
            copy.ProfileGuid = ProfileGuid;

            return(copy);
        }
Пример #3
0
        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; }
        }
Пример #4
0
        public override bool Equals(object o)
        {
            if (!(o is PrinterMapping))
            {
                return(false);
            }
            PrinterMapping v = o as PrinterMapping;

            if (!PrinterName.Equals(v.PrinterName))
            {
                return(false);
            }
            if (!ProfileGuid.Equals(v.ProfileGuid))
            {
                return(false);
            }

            return(true);
        }