当前位置: 首页>>代码示例>>C#>>正文


C# ResourceManager类代码示例

本文整理汇总了C#中ResourceManager的典型用法代码示例。如果您正苦于以下问题:C# ResourceManager类的具体用法?C# ResourceManager怎么用?C# ResourceManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResourceManager类属于命名空间,在下文中一共展示了ResourceManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LocalizeControl

        public static void LocalizeControl(Control control, ResourceManager resourceManager)
        {
            if ((resourceManager == null) || (control == null))
                return;

            string text = null;
            //Text of Control proper
            try
            {
                text = resourceManager.GetString(control.GetType().Namespace.Replace(".", "_") + "_" + control.GetType().Name + "_Text");
                if (!string.IsNullOrEmpty(text))
                    control.Text = text;
            }
            catch (System.Resources.MissingManifestResourceException)
            {
                //just ignore
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error when localizing: " + control.Name + ":\r\n" + ex.ToString());
            }

            //the Controls owned by this control
            FieldInfo[] fis = control.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
            foreach (FieldInfo fi in fis)
            {
                LocalizeField(control, resourceManager, fi, "Text");
                LocalizeField(control, resourceManager, fi, "Caption");
            }
        }
开发者ID:deb761,项目名称:BikeMap,代码行数:30,代码来源:Localizer.cs

示例2: Texture2DHolder

    public Texture2DHolder(string path, ResourceManager.LoadingType type)
    {
        loaded = true;
        this.type = type;
        switch (type) {
        case ResourceManager.LoadingType.RESOURCES_LOAD:
            this.path = path;
            tex = LoadTexture ();
            break;
        case ResourceManager.LoadingType.SYSTEM_IO:
            this.path = path;
            this.fileData = LoadBytes (this.path);

            if (this.fileData == null) {
                Regex pattern = new Regex ("[óñ]");
                this.path = pattern.Replace (this.path, "+¦");

                this.fileData = LoadBytes (this.path);

                if (this.fileData == null) {
                    loaded = false;
                    Debug.Log ("No se pudo cargar: " + this.path);
                }
            }
            break;
        }
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:27,代码来源:Texture2DHolder.cs

示例3: GetString_FromResourceType

 public static void GetString_FromResourceType(string key, string expectedValue)
 {
     Type resourceType = typeof(Resources.TestResx);
     ResourceManager resourceManager = new ResourceManager(resourceType);
     string actual = resourceManager.GetString(key);
     Assert.Equal(expectedValue, actual);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:ResourceManagerTests.cs

示例4: load_images

        public void load_images()
        {
            List<string> resource_paths = new List<string>();
            var assembly = Assembly.GetExecutingAssembly();
            var buffer = new ResourceManager(assembly.GetName().Name + ".g", assembly);
            try
            {
                var list = buffer.GetResourceSet(CultureInfo.CurrentCulture, true, true);
                foreach (DictionaryEntry item in list)
                {
                    resource_paths.Add((string)item.Key);
                }
            }
            finally
            {
                buffer.ReleaseAllResources();
            }

            all_images = new List<photo>();
            foreach (string current_path in resource_paths)
            {
                if (current_path.Contains(".jpg"))
                {
                    BitmapImage another_image = new BitmapImage(new Uri(@"/" + current_path, UriKind.Relative));
                    all_images.Add(new photo(another_image));
                }
            }

            faces_combo_box.ItemsSource = all_images;
            faces_combo_box.SelectedItem = faces_combo_box.Items[0];
        }
开发者ID:Saroko-dnd,项目名称:My_DZ,代码行数:31,代码来源:change_image_window.xaml.cs

示例5: Start

 // Use this for initialization
 void Start()
 {
     resourceManager = GameObject.FindGameObjectWithTag("Player").GetComponent<ResourceManager>();
     choiceManager = GameObject.Find("Choices").GetComponent<ChoicesManager>();
     conManager = defaultConversation.GetComponent<ConversationManager>();
     eventHandler = GameObject.FindGameObjectWithTag("EventController").GetComponent<EventManagement>();
 }
开发者ID:DeeCeptor,项目名称:Odyssey,代码行数:8,代码来源:IcarusIslandFunctions.cs

示例6: Main

	static void Main ()
	{
		AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler (CurrentDomain_AssemblyResolve);

		try {
			Assembly a = Assembly.GetExecutingAssembly ();
			a.GetSatelliteAssembly (new CultureInfo ("ja-JP"), new Version ("3.0"));
			Assert.Fail ("#A1");
		} catch (FileNotFoundException) {
			Assert.AreEqual (1, _AssemblyResolves.Count, "#A2");
			Assert.AreEqual ("test.resources, Version=3.0, Culture=ja-JP, PublicKeyToken=null", _AssemblyResolves [0], "#A3");
		}

		_AssemblyResolves.Clear ();

		try {
			ResourceManager rm = new ResourceManager ("foo", Assembly.GetExecutingAssembly ());
			rm.GetObject ("bar", new CultureInfo ("fr-FR"));
			Assert.Fail ("#B1");
		} catch (MissingManifestResourceException) {
			Assert.AreEqual (2, _AssemblyResolves.Count, "#B2");
			Assert.AreEqual ("test.resources, Version=0.0.0.0, Culture=fr-FR, PublicKeyToken=null", _AssemblyResolves [0], "#B3");
			Assert.AreEqual ("test.resources, Version=0.0.0.0, Culture=fr, PublicKeyToken=null", _AssemblyResolves [1], "#B4");
		}
	}
开发者ID:mono,项目名称:gert,代码行数:25,代码来源:test.cs

示例7: eval_b

 internal static ResourceManager eval_b()
 {
     int num = 0;
     while (true)
     {
         switch (num)
         {
         case 1:
         {
             ResourceManager resourceManager = new ResourceManager("eval_bt", typeof(eval_bt).Assembly);
             eval_bt.eval_a = resourceManager;
             num = 2;
             continue;
         }
         case 2:
             goto IL_63;
         }
         if (true)
         {
         }
         if (!object.ReferenceEquals(eval_bt.eval_a, null))
         {
             break;
         }
         num = 1;
     }
     IL_63:
     return eval_bt.eval_a;
 }
开发者ID:JABirchall,项目名称:FullAutoHoldem,代码行数:29,代码来源:eval_bt.cs

示例8: GetResourceSet_Strings

 public static void GetResourceSet_Strings(string key, string expectedValue)
 {
     var manager = new ResourceManager("System.Resources.Tests.Resources.TestResx", typeof(ResourceManagerTests).GetTypeInfo().Assembly);
     var culture = new CultureInfo("en-US");
     ResourceSet set = manager.GetResourceSet(culture, true, true);
     Assert.Equal(expectedValue, set.GetString(key));
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:ResourceManagerTests.netstandard17.cs

示例9: TerrainCollection

		public TerrainCollection( ResourceManager rm, IEngine engine, IScene scene ) {
			_engine = engine;
			_scene = scene;
			_resource_manager = rm;

			// now create chunks at the empty points
			int i, j, k, cs;
			for ( k=0; k<zoomorder; k++ ) {
				cs = (int)(ts*Math.Pow(hpc,k+1));
				CX[k] = 0;
				CZ[k] = 0;
				for ( i=0; i<xorder; i++ ) {
					for ( j=0; j<zorder; j++ ) {
						TC[i,j,k] = _engine.CreateTerrainChunk(i*cs, j*cs, cs/hpc, hpc);

						ITexture texture = engine.CreateTexture( "land", Constants.terrainPieceTextureWidth*hpc, Constants.terrainPieceTextureWidth*hpc );
						TC[i,j,k].SetTexture( texture );

						// TODO: how to know which detail texture to use?
						//TC[i,j,k].SetDetailTexture( _resource_manager.GetTexture( 9 ) );

						// TODO: fix this don't hardcode it... and don't set it per terrain chunk
						//if ( k == zoomorder-1 ){
							// TODO:
						//	TC[i,j,k].SetClouds(_resource_manager.GetTexture(8));
						//}
					}
				}
			}
		}
开发者ID:timothypratley,项目名称:Strive.NET,代码行数:30,代码来源:TerrainCollection.cs

示例10: ServerConnection

 public ServerConnection(string url)
 {
     using(Log.Scope("ServerConnection constructor"))
     {
         Log.Debug("connecting to {0}", url);
         try
         {
             if(_instance != null)
             {
                 _instance.Dispose();
                 _instance = null;
             }
         }
         catch { }
         if(url == null)
             throw new ArgumentNullException("url");
         _url = url;
         this.Server = new LPSClientShared.LPSServer.Server(url);
         this.Server.CookieContainer = CookieContainer;
         this.cached_datasets = new Dictionary<string, DataSet>();
         _instance = this;
         resource_manager = new ResourceManager(this);
         configuration_store = new ConfigurationStore();
     }
 }
开发者ID:langpavel,项目名称:LPS-old,代码行数:25,代码来源:ServerConnection.cs

示例11: Renderer

        /// <summary>
        /// Construct the renderer.
        /// </summary>
        /// <param name="texmode">
        /// A <see cref="TextureMode"/>. Choose "TextureMode.NORMAL_MODE" if your graphics card supports non-power of 2 texture sizes, TextureMode.TEXTURE_RECTANGLE_EXT otherwise.
        /// </param>
        public Renderer(TextureMode texmode, Display display, ResourceManager resourceManager)
        {
            this.resourceManager = resourceManager;
            textureMode = texmode;

            try
            {
                CheckRendererStatus();
            }
            catch (Exception e)
            {
                Log.Write("Could not initialize renderer: " + e.Message);
                throw e;
            }

            //Set some OpenGL attributes
            Gl.glDisable(Gl.GL_DEPTH_TEST);
            Gl.glEnable(GlTextureMode);
            Gl.glShadeModel(Gl.GL_SMOOTH);
            Gl.glHint(Gl.GL_PERSPECTIVE_CORRECTION_HINT, Gl.GL_NICEST);

            //Enable alpha blending
            Gl.glBlendFunc(Gl.GL_SRC_ALPHA, Gl.GL_ONE_MINUS_SRC_ALPHA);
            Gl.glEnable(Gl.GL_BLEND);

            Ready = true;

            Gl.glColor4d(1, 1, 1, 1);
            /*Gl.glDrawBuffer(Gl.GL_BACK);
            Gl.glClearAccum(0.0f, 0.0f, 0.0f, 0.0f);
            Gl.glClear(Gl.GL_ACCUM_BUFFER_BIT);*/
        }
开发者ID:hallgeirl,项目名称:Hiage,代码行数:38,代码来源:Renderer.cs

示例12: LocalizeField

 private static void LocalizeField(Control control, ResourceManager resourceManager, FieldInfo fi, string propertyName)
 {
     MemberInfo[] mia = fi.FieldType.GetMember(propertyName);
     if (mia.GetLength(0) > 0)
     {
         try
         {
             string resourceName = control.GetType().Namespace.Replace(".", "_") + "_" + control.GetType().Name + "_" + fi.Name + "_" + propertyName;
             string localizedText = resourceManager.GetString(resourceName);
             if (localizedText == null)
             {
             }
             else if (!string.IsNullOrEmpty(localizedText))
             {
                 Object o = fi.GetValue(control);
                 if (o != null)
                 {
                     PropertyInfo pi = o.GetType().GetProperty(propertyName);
                     if (pi != null)
                     {
                         pi.SetValue(o, localizedText, null);
                     }
                 }
             }
         }
         catch (System.Resources.MissingManifestResourceException)
         {
             //just ignore
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine("Error when localizing: " + fi.Name + ":\r\n" + ex.ToString());
         }
     }
 }
开发者ID:deb761,项目名称:BikeMap,代码行数:35,代码来源:Localizer.cs

示例13: Reindex

        private void Reindex()
        {
            Write("Initializing resource manager...");
            ResourceManager resourceManager = new ResourceManager(Server, Cache);

            SearchEngine.PopulateDatabase(resourceManager, Write);

            Write("&nbsp;");
            Write("Summary:");
            using (var connection = DBUtil.MakeConnection())
            {
                foreach (string table in new string[] { "sectors", "subsectors", "worlds" })
                {
                    string sql = String.Format("SELECT COUNT(*) FROM {0}", table);
                    using (var command = new SqlCommand(sql, connection))
                    {
                        using (var reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                Write(String.Format("{0}: {1}", table, reader.GetInt32(0)));
                            }
                        }
                    }
                }
            }

            Write("<b>&Omega;</b>");
        }
开发者ID:robertsconley,项目名称:travellermap,代码行数:29,代码来源:Admin.aspx.cs

示例14: GetString

            /// <summary>
            /// reads a string from the resource associated with this assembly and then returns it
            /// </summary>
            /// <param name="ResourceStringName">the name of the string to read</param>
            /// <returns>returns the string</returns>
            public static string GetString(string ResourceStringName)
            {
                ResourceManager ResourceMngr = new ResourceManager(BaseResourceName, Assembly.GetExecutingAssembly());

                // get the string from the resource and return it
                return ResourceMngr.GetString(ResourceStringName);
            }
开发者ID:namatitiben,项目名称:nknight,代码行数:12,代码来源:SecurityLayer.cs

示例15: GetSpawnManager

    static void GetSpawnManager()
    {
        spawnManager=(SpawnManager)FindObjectOfType(typeof(SpawnManager));

        if(spawnManager!=null){
            if(spawnManager.spawnMode==_SpawnMode.Continuous) spawnType=0;
            else if(spawnManager.spawnMode==_SpawnMode.WaveCleared) spawnType=1;
            else if(spawnManager.spawnMode==_SpawnMode.RoundBased) spawnType=2;
            else if(spawnManager.spawnMode==_SpawnMode.SkippableContinuous) spawnType=3;
            else if(spawnManager.spawnMode==_SpawnMode.SkippableWaveCleared) spawnType=4;

            waveLength=spawnManager.waves.Length;
            //UpdateWaveLength();

            waveFoldList=new bool[waveLength];
            for(int i=0; i<waveFoldList.Length; i++){
                waveFoldList[i]=true;
            }

            subWaveLength=new int[waveLength];
            for(int i=0; i<waveLength; i++){
                Wave wave=spawnManager.waves[i];
                //Debug.Log(wave.subWaves);
                subWaveLength[i]=wave.subWaves.Length;
            }
        }

        rscManager=(ResourceManager)FindObjectOfType(typeof(ResourceManager));
    }
开发者ID:GameDevUnity,项目名称:tdtk,代码行数:29,代码来源:SpawnEditor.cs


注:本文中的ResourceManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。