Example #1
0
        public void ReadValues(Data data, string path)
        {
            try
            {
                var numClasses = int.Parse(data.GetValue(@"" + path + @"ApiAccess\numClasses"));
                for (var i = 0; i < numClasses; i++)
                {
                    var tmp = new ApiAccess();
                    tmp.ReadValues(data, @"" + path + @"ApiAccess\" + i + @"\");
                    ApiAccess.Add(tmp);
                }
            }
            catch
            {
            }

            try
            {
                var numClasses = int.Parse(data.GetValue(@"" + path + @"PrinterMappings\numClasses"));
                for (var i = 0; i < numClasses; i++)
                {
                    var tmp = new PrinterMapping();
                    tmp.ReadValues(data, @"" + path + @"PrinterMappings\" + i + @"\");
                    PrinterMappings.Add(tmp);
                }
            }
            catch
            {
            }

            try
            {
                var numClasses = int.Parse(data.GetValue(@"" + path + @"TitleReplacement\numClasses"));
                for (var i = 0; i < numClasses; i++)
                {
                    var 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 = "clawPDF";
            }

            try
            {
                UpdateInterval = (UpdateInterval)Enum.Parse(typeof(UpdateInterval),
                                                            data.GetValue(@"" + path + @"UpdateInterval"));
            }
            catch
            {
                UpdateInterval = UpdateInterval.Weekly;
            }
        }