internal static ProtoGeometryConfiguration Deserialize(string filePath)
        {
            ProtoGeometryConfiguration configuration = null;

            if (!string.IsNullOrEmpty(filePath) && (File.Exists(filePath) != false))
            {
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(ProtoGeometryConfiguration));
                    FileStream    fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                    configuration = serializer.Deserialize(fileStream) as ProtoGeometryConfiguration;
                    fileStream.Close();
                }
                catch (Exception)
                {
                }
            }

            if (null == configuration) // Default settings.
            {
                configuration = new ProtoGeometryConfiguration();
            }

            return(configuration);
        }
        static ProtoGeometryConfigurationManager()
        {
            string fullPath = ConfigFileFullPath;

            Settings = ProtoGeometryConfiguration.Deserialize(fullPath);

            if (!File.Exists(fullPath))
            {
                ProtoGeometryConfiguration.Serialize(fullPath, Settings);
            }
        }
        internal static bool Serialize(string filePath, ProtoGeometryConfiguration configuration)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(ProtoGeometryConfiguration));
                FileStream    fileStream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write);
                serializer.Serialize(fileStream, configuration);
                fileStream.Flush();
                fileStream.Close();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
        internal static bool Serialize(string filePath, ProtoGeometryConfiguration configuration)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(ProtoGeometryConfiguration));
                FileStream fileStream = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write);
                serializer.Serialize(fileStream, configuration);
                fileStream.Flush();
                fileStream.Close();
            }
            catch (Exception)
            {
                return false;
            }

            return true;
        }
        internal static ProtoGeometryConfiguration Deserialize(string filePath)
        {
            ProtoGeometryConfiguration configuration = null;
            if (!string.IsNullOrEmpty(filePath) && (File.Exists(filePath) != false))
            {
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(ProtoGeometryConfiguration));
                    FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
                    configuration = serializer.Deserialize(fileStream) as ProtoGeometryConfiguration;
                    fileStream.Close();
                }
                catch (Exception)
                {
                }
            }

            if (null == configuration) // Default settings.
                configuration = new ProtoGeometryConfiguration();

            return configuration;
        }
 public static void Save()
 {
     ProtoGeometryConfiguration.Serialize(ConfigFileFullPath, Settings);
 }