• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ResourceManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: GameServer

        public GameServer()
        {
            /* Load Resources */
            Console.WriteLine("Loading Resources...");
            Resources = new ResourceManager();
            Resources.Load();

            /* Setting Up Server */
            Console.WriteLine("Starting Up Server...");
            //Package.RecompilePackages();
            //CodeManager StartUp = Package.GetPackage(Game.ServerInfo.StartupPackage).CodeManager;
            //StartUp.RunMain();
            //Game.World.Chunks.ClearWorldGen();
            //Game.World.Chunks.AddWorldGens(StartUp.GetWorldGens());
            Game.World.ClearWorldGen();
            List<WorldGenerator> temp = new List<WorldGenerator>();
            temp.Add(new WorldGenerator());
            Game.World.AddWorldGen(temp);

            /* Listen for Clients */
            NetPeerConfiguration Configuration = new NetPeerConfiguration("FantasyScape");
            Configuration.Port = 54987;
            Configuration.MaximumConnections = 20;
            Server = new NetServer(Configuration);
            Server.Start();
            Message.RegisterServer(Server);

            UpdateTimer = new Stopwatch();
            UpdateTimer.Start();

            Console.WriteLine("Ready!");
        }
开发者ID:CloneDeath,项目名称:FantasyScape,代码行数:32,代码来源:GameServer.cs


示例17: eAnim

    public eAnim(string path, ResourceManager.LoadingType type)
    {
        frames = new List<eFrame> ();

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

        string[] splitted = path.Split ('.');
        if (splitted [splitted.Length - 1] == "eaa") {
            string eaaText = "";

            switch (ResourceManager.Instance.getLoadingType ()) {
            case ResourceManager.LoadingType.SYSTEM_IO:
                eaaText = System.IO.File.ReadAllText (path);
                break;
            case ResourceManager.LoadingType.RESOURCES_LOAD:
                TextAsset ta = Resources.Load (path) as TextAsset;
                if(ta!=null)
                    eaaText = ta.text;
                break;
            }
            parseEea (eaaText);
        } else
            createOldMethod ();
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:25,代码来源:eAnim.cs


示例18: Start

 // Use this for initialization
 void Start()
 {
     sm = StateMachine<States>.Initialize(this);
     sm.ChangeState(States.Lobby);
     resourceManager = this.GetComponent<ResourceManager>();
     currentPlayer = playerManager.currentPlayer;
 }
开发者ID:RGamberini,项目名称:Hex-Based-Unity-Game,代码行数:8,代码来源:Game.cs


示例19: WorldContext

 /// <summary>
 /// Initializes a new instance of the WorldContext class.
 /// </summary>
 /// <param name="entityManager">The entity manager.</param>
 /// <param name="physics">The physics world.</param>
 /// <param name="resources">The game resources.</param>
 /// <param name="currentTime">The current game time.</param>
 public WorldContext(EntityManager entityManager, World physics, ResourceManager resources, TimeSpan currentTime)
 {
     this.EntityManager = entityManager;
     this.Physics = physics;
     this.Resources = resources;
     this.CurrentTime = currentTime;
 }
开发者ID:andynygard,项目名称:game-dwarves,代码行数:14,代码来源:WorldContext.cs


示例20: getInstance

 public static ResourceManager getInstance()
 {
     if (_instance == null) {
         _instance = new ResourceManager();
     }
     return _instance;
 }
开发者ID:LostTemple1990,项目名称:TouHouExploding,代码行数:7,代码来源:ResourceManager.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ResourcePath类代码示例发布时间:2022-05-24
下一篇:
C# ResourceLocation类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap