BugzillaInterface.SplatterCore.LoadState C# (CSharp) Метод

LoadState() публичный статический Метод

public static LoadState ( ) : void
Результат void
        public static void LoadState()
        {
            string configFolder = Path.Combine (System.Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "splatter");
            string filePath = Path.Combine (configFolder, dataFileName);
            string allowedCertificatesPath = Path.Combine (configFolder, allowFileName);

            Console.WriteLine ("Loading configuration from " + filePath);
            Console.WriteLine ("Loading list of allowed untrusted connections from " + filePath);
            SecurityCertificateHandler.Initialize ();

            try {
                if(File.Exists(filePath)) {

                    XmlSerializer ser = new XmlSerializer(typeof(SplatterCore));
                    TextReader reader = new StreamReader(filePath);

                    SplatterCore newCore = (SplatterCore)ser.Deserialize(reader);

                    // TODO: is it safe to do this?

                    SplatterCore.Instance = newCore;
                    reader.Close();

                }

                if(File.Exists(allowedCertificatesPath)) {

                    XmlSerializer thumbPrintsSerializer = new XmlSerializer (typeof (System.Collections.Generic.List <string>));
                    TextReader reader = new StreamReader(allowedCertificatesPath);
                    SecurityCertificateHandler.Instance.AllowedThumbPrints = (List <string>) thumbPrintsSerializer.Deserialize (reader);

                    reader.Close();

                }

            } catch (XmlException exception) {
                /* Don't let bad xml do wreak havoc */
            }
        }