Esempio n. 1
0
        public static void LoadAll()
        {
            var currentAssembly = Assembly.GetExecutingAssembly();

            foreach (string resource in currentAssembly.GetManifestResourceNames())
            {
                if (resource.StartsWith("Resources.Languages."))
                {
                    string fileName = resource.Substring("Resources.Languages.".Length);
                    if (fileName.EndsWith(".lang"))
                    {
                        var kvp = new KeyValuePairs();
                        kvp.Load(currentAssembly.GetManifestResourceStream(resource));

                        string code = fileName.Substring(0, fileName.Length - 5);
                        s_languages.Add(code, new Language(code, kvp));
                    }
                }
            }
        }
 public static bool GetEmbeddedGameInfo( out string o_gameTitle, out string o_gameVersion, out string o_gameURL, out string o_username, out string o_password )
 {
     try
     {
         var assembly = Assembly.GetExecutingAssembly();
         var stream = assembly.GetManifestResourceStream( "EmbeddedGame." + Program.Platform + ".txt" );
         if( stream == null )
         {
             stream = assembly.GetManifestResourceStream( "EmbeddedGame.txt" );
         }
         if( stream != null )
         {
             var kvp = new KeyValuePairs();
             kvp.Load( stream );
             if( kvp.ContainsKey( "game" ) )
             {
                 o_gameTitle = kvp.GetString( "game" );
                 o_gameVersion = kvp.GetString( "version" );
                 o_gameURL = kvp.GetString( "url" );
                 o_username = kvp.GetString( "username" );
                 o_password = kvp.GetString( "password" );
                 return true;
             }
         }
         o_gameTitle = default( string );
         o_gameVersion = default( string );
         o_gameURL = default( string );
         o_username = default( string );
         o_password = default( string );
         return false;
     }
     catch( Exception )
     {
         o_gameTitle = default( string );
         o_gameVersion = default( string );
         o_gameURL = default( string );
         o_username = default( string );
         o_password = default( string );
         return false;
     }
 }
Esempio n. 3
0
 private Language(string code, KeyValuePairs translations)
 {
     m_code         = code;
     m_translations = translations;
 }
 private Language( string code, KeyValuePairs translations )
 {
     m_code = code;
     m_translations = translations;
 }
        public static void LoadAll()
        {
            var currentAssembly = Assembly.GetExecutingAssembly();
            foreach( string resource in currentAssembly.GetManifestResourceNames() )
            {
                if( resource.StartsWith( "Resources.Languages." ) )
                {
                    string fileName = resource.Substring( "Resources.Languages.".Length );
                    if( fileName.EndsWith( ".lang" ) )
                    {
                        var kvp = new KeyValuePairs();
                        kvp.Load( currentAssembly.GetManifestResourceStream( resource ) );

                        string code = fileName.Substring( 0, fileName.Length - 5 );
                        s_languages.Add( code, new Language( code, kvp ) );
                    }
                }
            }
        }