Пример #1
0
 static void initWithDefaults( )
 {
     _instance=new Constants(  );
 }
Пример #2
0
        public static void TryToLoadOtherwiseSetDefaults( string filename )
        {
            string path = @"{0}\{1}".FormatWith(Application.StartupPath, filename) ;

            if( !File.Exists( path ) )
            {
                initWithDefaults(  );
                return ;
            }

            using( FileStream stream = File.Open( path, FileMode.Open ) )
            {
                var serializer = new XmlSerializer( typeof( Constants ) ) ;

                _instance = (Constants) serializer.Deserialize( stream ) ;

                stream.Close( ) ;
            }
        }