StringResource.cs
上传用户:szltgg
上传日期:2019-05-16
资源大小:604k
文件大小:1k
- /* ---------------------------------------------------------------------------
- *
- * Copyright (c) Granados Networks, Inc. All Rights Reserved..
- *
- * This file is a part of the Granados SSH Client Library that is subject to
- * the license included in the distributed package.
- * You may not use this file except in compliance with the license.
- *
- * $Id: StringResource.cs,v 1.2 2005/04/20 09:00:56 okajima Exp $
- */
- using System;
- using System.Globalization;
- using System.Resources;
- using System.Diagnostics;
- using System.Reflection;
- namespace Granados.SSHC {
- /// <summary>
- /// StringResource 偺奣梫偺愢柧偱偡丅
- /// </summary>
- internal class StringResources {
- private string _resourceName;
- private ResourceManager _resMan;
- public StringResources(string name, Assembly asm) {
- _resourceName = name;
- LoadResourceManager(name, asm);
- }
- public string GetString(string id) {
- return _resMan.GetString(id); //傕偟偙傟偑抶偄傛偆側傜偙偺僋儔僗偱僉儍僢僔儏偱傕偮偔傟偽偄偄偩傠偆
- }
- private void LoadResourceManager(string name, Assembly asm) {
- //摉柺偼塸岅丒擔杮岅偟偐偟側偄
- CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentUICulture;
- if(ci.Name.StartsWith("ja"))
- _resMan = new ResourceManager(name+"_ja", asm);
- else
- _resMan = new ResourceManager(name, asm);
- }
- }
- }