當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。