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


C# Resources.ResourceSet类代码示例

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


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

示例1: InternalGetResourceSet

        protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
        {
            ResourceSet resourceSet = (ResourceSet)ResourceSets[culture];
            if (resourceSet == null)
            {
                // Lazy-load default language (without caring about duplicate assignment in race conditions, no harm done);
                if (neutralResourcesCulture == null)
                {
                    neutralResourcesCulture = GetNeutralResourcesLanguage(MainAssembly);
                }

                // If we're asking for the default language, then ask for the invariant (non-specific) resources.
                if (neutralResourcesCulture.Equals(culture))
                {
                    culture = CultureInfo.InvariantCulture;
                }

                string resourceFileName = GetResourceFileName(culture);
                Stream store = MainAssembly.GetManifestResourceStream(contextTypeInfo, resourceFileName);

                // If we found the appropriate resources in the local assembly...
                if (store != null)
                {
                    resourceSet = new ResourceSet(store);
                    // Save for later.
                    AddResourceSet(ResourceSets, culture, ref resourceSet);
                }
                else
                {
                    resourceSet = base.InternalGetResourceSet(culture, createIfNotExists, tryParents);
                }
            }
            return resourceSet;
        }
开发者ID:YuriyGuts,项目名称:unicode-virtual-keyboard,代码行数:34,代码来源:SingleAssemblyComponentResourceManager.cs

示例2: Init

        public void Init()
        {
            // Determine if the Preset settings files exist for the routine //
            // This has been changed so that the XML files are now embedded resources //

            var presetResourceSet =
                new ResourceSet(
                    Assembly.GetExecutingAssembly().GetManifestResourceStream("Paws.Properties.Resources.resources"));

            // Determine if the Preset settings files exist for the current character //
            var characterSettingsDirectory = Path.Combine(CharacterSettingsDirectory, "Paws");
            if (!Directory.Exists(characterSettingsDirectory))
            {
                Directory.CreateDirectory(characterSettingsDirectory);
                Log.Diagnostics("Character Settings Directory Established... generating default presets.");


                var resourceCount = 0;
                foreach (DictionaryEntry entry in presetResourceSet)
                {
                    using (
                        var streamWriter =
                            new StreamWriter(
                                Path.Combine(characterSettingsDirectory, entry.Key.ToString().Replace("_", " ") + ".xml"),
                                false))
                    {
                        streamWriter.Write(entry.Value);
                        resourceCount++;
                    }
                }

                Log.Diagnostics(string.Format("...Finished generating {0} preset files", resourceCount));
            }
        }
开发者ID:Lbniese,项目名称:PawsPremium,代码行数:34,代码来源:GlobalSettingsManager.cs

示例3: InternalGetResourceSet

        protected override ResourceSet InternalGetResourceSet(CultureInfo culture, bool createIfNotExists, bool tryParents)
        {
            ResourceSet rs = (ResourceSet)this.ResourceSets[culture];
            if (rs == null)
            {
                Stream store = null;
                string resourceFileName = null;

                //lazy-load default language;
                if (this._neutralResourcesCulture == null)
                {
                    this._neutralResourcesCulture = GetNeutralResourcesLanguage(this.MainAssembly);
                }

                //if we're asking for the default language, then ask for the invaliant (non-specific) resources.
                if (_neutralResourcesCulture.Equals(culture))
                    culture = CultureInfo.InvariantCulture;
                resourceFileName = GetResourceFileName(culture);

                store = this.MainAssembly.GetManifestResourceStream(this._contextTypeInfo, resourceFileName);

                //If we found the appropriate resources in the local assembly
                if (store != null)
                {
                    rs = new ResourceSet(store);
                    //save for later.
                    AddResourceSet(this.ResourceSets, culture, ref rs);
                }
                else
                {
                    rs = base.InternalGetResourceSet(culture, createIfNotExists, tryParents);
                }
            }
            return rs;
        }
开发者ID:TaoK,项目名称:UsbKeyBackup,代码行数:35,代码来源:SingleAssemblyComponentResourceManager.cs

示例4: CreateIconSetBitmaps

   public static Dictionary<String, Bitmap> CreateIconSetBitmaps(ResourceSet resSet, Boolean invert)
   {
      Dictionary<String, Bitmap> icons = new Dictionary<String, Bitmap>();

      if (resSet != null)
      {
         foreach (System.Collections.DictionaryEntry e in resSet)
         {
            if (e.Key is String && e.Value is Bitmap)
            {
               Bitmap b = (Bitmap)e.Value;
               if (invert)
               {
                  BitmapProcessing.Desaturate(b);
                  BitmapProcessing.Invert(b);
                  BitmapProcessing.AdjustBrightness(b, 101);
               }

               Bitmap b_hidden = new Bitmap(b);
               BitmapProcessing.AdjustOpacity(b_hidden, 100);

               Bitmap b_filtered = new Bitmap(b);
               BitmapProcessing.AdjustOpacity(b_filtered, Outliner.Controls.Tree.TreeNode.FilteredNodeOpacity);

               icons.Add((String)e.Key, b);
               icons.Add((String)e.Key + "_hidden", b_hidden);
               icons.Add((String)e.Key + "_filtered", b_filtered);
            }
         }
      }

      return icons;
   }
开发者ID:Sugz,项目名称:Outliner-3.0,代码行数:33,代码来源:IconSet.cs

示例5: AddResources

 private static void AddResources(Dictionary<String, String> resources,
     ResourceManager resourceManager, ResourceSet neutralSet) {
     foreach (DictionaryEntry res in neutralSet) {
         string key = (string)res.Key;
         string value = resourceManager.GetObject(key) as string;
         if (value != null) {
             resources[key] = value;
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:ScriptResourceAttribute.cs

示例6: ConvertResourceSetToDictionaryEntries

        private static IEnumerable<DictionaryEntry> ConvertResourceSetToDictionaryEntries( ResourceSet resourceSet )
        {
            var dictionaryEntries = new List<DictionaryEntry>();

            foreach ( DictionaryEntry entry in resourceSet )
            {
                dictionaryEntries.Add( entry );
            }

            return dictionaryEntries;
        }
开发者ID:XElementSoftware,项目名称:CloudSyncHelper,代码行数:11,代码来源:testLocalization.cs

示例7: BeforeLocalizeType

 protected override void BeforeLocalizeType(Type controlType)
 {
     if (this.FIniSource != null)
     {
         this.ResourceSet = new IniResourceSet(this.FIniSource, controlType);
     }
     else if (this.FIniPath != null)
     {
         this.ResourceSet = new IniResourceSet(this.FIniPath, controlType);
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:11,代码来源:IniFormStringLocalizer.cs

示例8: IconPackImageProvider

 public IconPackImageProvider(string iconPackPath)
 {
     this.IconPack = new ResourceSet(iconPackPath);
     foreach (DefaultIcon icon in Enum.GetValues(typeof(DefaultIcon)))
     {
         this.DefaultIconMap.Add(icon, string.Intern("DefaultIcon." + icon.ToString()));
     }
     foreach (VolumeType type in Enum.GetValues(typeof(VolumeType)))
     {
         this.VolumeTypeMap.Add(type, string.Intern("VolumeType." + type.ToString()));
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:12,代码来源:IconPackImageProvider.cs

示例9: GetTextResourceContent

        private ICollection<KeyValuePair<string, object>> GetTextResourceContent(ResourceSet set, string lang)
        {
            var resourceDictionary = set.Cast<DictionaryEntry>()
                                        .ToDictionary(r => r.Key.ToString(),
                                                      r => r.Value.ToString());
            var content = (ICollection<KeyValuePair<string, object>>)new ExpandoObject();

            foreach (var item in resourceDictionary)
            {
                content.Add(new KeyValuePair<string, object>(item.Key, item.Value));
            }

            return content;
        }
开发者ID:robkobobko,项目名称:TicketDesk,代码行数:14,代码来源:TextController.cs

示例10: Form1_Load

        private void Form1_Load(object sender, EventArgs e)
        {
            strs = new ArrayList();

            rs = Properties.Resources.ResourceManager.GetResourceSet(CultureInfo.CurrentUICulture, true, true);
            foreach (DictionaryEntry entry in rs)
            {
                if (entry.Key.ToString().Contains("_"))
                    continue;
                strs.Add(entry.Key);
            }
            strs.Sort();
            foreach(string s in strs)
                comboBox1.Items.Add(s);
        }
开发者ID:oxhagolli,项目名称:Langmatch,代码行数:15,代码来源:Form1.cs

示例11: InternalGetResourceSet

        /// <summary>
        /// This method will return a resource set based on a Culture set by application.
        /// </summary>
        /// <param name="culture"></param>
        /// <param name="createIfNotExists"></param>
        /// <param name="tryParents"></param>
        /// <returns>ResourceSet</returns>
        protected override ResourceSet InternalGetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents)
        {
            ResourceSet rs = null;

            lock (this.cultureResourceSetDictionary)
            {
                if (false == this.cultureResourceSetDictionary.TryGetValue(culture.Name, out rs))
                {
                    rs = new ResourceSet(new DBResourceReader(culture, this.dataProvider));
                    this.cultureResourceSetDictionary[culture.Name] = rs;
                }
            }

            return rs;
        }
开发者ID:krishnarajv,项目名称:Code,代码行数:22,代码来源:DBResourceProvider.cs

示例12: LoadLanguage

        static ResourceManager LoadLanguage(CultureInfo culture, ref ResourceSet rs)
        {
            Current = culture;
            if (rs != null) { rs.Dispose(); rs = null; }

            try
            {
                ResourceManager rManager = new ResourceManager("XPloit.Res.Res", typeof(Lang).Assembly) { IgnoreCase = true };
                rs = rManager.GetResourceSet(culture, true, true);
                return rManager;
            }
            catch { }

            return null;
        }
开发者ID:0x0mar,项目名称:Xploit,代码行数:15,代码来源:Lang.cs

示例13: AddLocalizedResource

        private static void AddLocalizedResource(ResourceManager resourceMgr, string cultureName)
        {
            using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("ExBuddy.Localization.Localization." + cultureName + ".resources"))
            {
                if (s == null)
                {
                    Logging.WriteDiagnostic("Couldn't find {0}", "ExBuddy.Localization.Localization." + cultureName + ".resources");
                    return;
                }

                FieldInfo resourceSetsField = typeof(ResourceManager).GetField("_resourceSets", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField);
                Dictionary<string, ResourceSet> resourceSets = (Dictionary<string, ResourceSet>)resourceSetsField.GetValue(resourceMgr);

                ResourceSet resources = new ResourceSet(s);
                resourceSets.Add(cultureName, resources);
            }
        }
开发者ID:MGramolini,项目名称:ExBuddy,代码行数:17,代码来源:LocalizationInitializer.cs

示例14: InternalGetResourceSet

        protected override ResourceSet InternalGetResourceSet(CultureInfo culture,
            bool createIfNotExists, bool tryParents)
        {
            ResourceSet rs = (ResourceSet)ResourceSets[culture];
            if (rs == null)
            {
                string resourceFileName = null;

                //lazy-load default language (without caring about duplicate assignment in race conditions, no harm done);
                if (_neutralResourcesCulture == null)
                {
                    _neutralResourcesCulture =
                        GetNeutralResourcesLanguage(MainAssembly);
                }

                // if we're asking for the default language, then ask for the
                // invariant (non-specific) resources.
                if (_neutralResourcesCulture.Equals(culture))
                    culture = CultureInfo.InvariantCulture;
                
                resourceFileName = GetResourceFileName(culture);

                // Only bother to try the lookup based on the resource property if we haven't tried this language before
                if (!_prevCultures.Contains(culture.ToString()) && culture != CultureInfo.InvariantCulture)
                {
                    _prevCultures.Add(culture.ToString());
                    // The T4 template resource generator will link the culture specific resources in to the invariant culture resource
                    // We'll try and load the culture specific resource here

                    var content = GetString("Resources." + culture);
                    if (content != null)
                    {
                        using (var stream = new MemoryStream(Encoding.ASCII.GetBytes(content)))
                        using (var reader = new ResXResourceReader(stream))
                        {
                            rs = new ResourceSet(reader);
                        }
                    }
                }

                if (rs == null)
                    rs = base.InternalGetResourceSet(culture, createIfNotExists, tryParents);
                 
            }
            return rs;
        }
开发者ID:offbyoneBB,项目名称:mp-onlinevideos2,代码行数:46,代码来源:SingleAssemblyComponentResourceManager.cs

示例15: GetResourceManager

        private static ResourceManager GetResourceManager(ref ResourceManager field, ResourceSet name)
        {
            if (null == field)
            {
                lock (sync)
                {
                    if (null == field)
                    {
                        var t = typeof(ActionText);
                        var qualifiedName = t.Namespace + "." + Enum.GetName(typeof(ResourceSet), name);

                        field = new ResourceManager(qualifiedName, t.Assembly);
                    }
                }
            }

            return field;
        }
开发者ID:heaths,项目名称:psmsi,代码行数:18,代码来源:ActionText.cs


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