protected ResourceManager()
        {
            this.Init();
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            this.resourceGroveler = new ManifestBasedResourceGroveler(mediator);
        }
        private void CommonSatelliteAssemblyInit()
        {
            this.UseManifest   = true;
            this._resourceSets = new Dictionary <string, ResourceSet>();
            this._fallbackLoc  = UltimateResourceFallbackLocation.MainAssembly;
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            this.resourceGroveler         = new ManifestBasedResourceGroveler(mediator);
            this._neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(this.MainAssembly, ref this._fallbackLoc);
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled())
            {
                CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                string      resourceFileName = this.GetResourceFileName(invariantCulture);
                if (this.resourceGroveler.HasNeutralResources(invariantCulture, resourceFileName))
                {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(this.BaseNameField, this.MainAssembly, resourceFileName);
                }
                else
                {
                    string resName = resourceFileName;
                    if ((this._locationInfo != null) && (this._locationInfo.Namespace != null))
                    {
                        resName = this._locationInfo.Namespace + Type.Delimiter + resourceFileName;
                    }
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(this.BaseNameField, this.MainAssembly, resName);
                }
            }
            this.ResourceSets = new Hashtable();
        }
        private ResourceManager(string baseName, string resourceDir, Type usingResourceSet)
        {
            if (baseName == null)
            {
                throw new ArgumentNullException("baseName");
            }
            if (resourceDir == null)
            {
                throw new ArgumentNullException("resourceDir");
            }
            this.BaseNameField    = baseName;
            this.moduleDir        = resourceDir;
            this._userResourceSet = usingResourceSet;
            this.ResourceSets     = new Hashtable();
            this._resourceSets    = new Dictionary <string, ResourceSet>();
            this.UseManifest      = false;
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            this.resourceGroveler = new FileBasedResourceGroveler(mediator);
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled())
            {
                CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                string      resourceFileName = this.GetResourceFileName(invariantCulture);
                if (this.resourceGroveler.HasNeutralResources(invariantCulture, resourceFileName))
                {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(this.BaseNameField, this.MainAssembly, resourceFileName);
                }
                else
                {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(this.BaseNameField, this.MainAssembly, resourceFileName);
                }
            }
        }
Example #4
0
        // Constructs a Resource Manager for files beginning with
        // baseName in the directory specified by resourceDir
        // or in the current directory.  This Assembly-ignorant constructor is
        // mostly useful for testing your own ResourceSet implementation.
        //
        // A good example of a baseName might be "Strings".  BaseName
        // should not end in ".resources".
        //
        // Note: System.Windows.Forms uses this method at design time.
        //
        private ResourceManager(string baseName, string resourceDir, Type usingResourceSet)
        {
            if (null == baseName)
            {
                throw new ArgumentNullException(nameof(baseName));
            }
            if (null == resourceDir)
            {
                throw new ArgumentNullException(nameof(resourceDir));
            }

            BaseNameField = baseName;

            moduleDir        = resourceDir;
            _userResourceSet = usingResourceSet;
#pragma warning disable 618
            ResourceSets = new Hashtable(); // for backward compatibility
#pragma warning restore 618
            _resourceSets          = new Dictionary <string, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();
            UseManifest            = false;

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            resourceGroveler = new FileBasedResourceGroveler(mediator);
        }
Example #5
0
        protected ResourceManager()
        {
            _lastUsedResourceCache = new CultureNameResourceSetPair();
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            _resourceGroveler = new ManifestBasedResourceGroveler(mediator);
        }
Example #6
0
        private void CommonAssemblyInit()
        {
            // Now we can use the managed resources even when using PRI's to support the APIs GetObject, GetStream...etc.
            _useManifest = true;

            _resourceSets          = new Dictionary <string, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            _resourceGroveler = new ManifestBasedResourceGroveler(mediator);

            Debug.Assert(MainAssembly != null);
            _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, out _fallbackLoc);
        }
Example #7
0
        // Trying to unify code as much as possible, even though having to do a
        // security check in each constructor prevents it.
        private void CommonAssemblyInit()
        {
#if FEATURE_APPX || ENABLE_WINRT
            SetUapConfiguration();
#endif

            // Now we can use the managed resources even when using PRI's to support the APIs GetObject, GetStream...etc.
            _useManifest = true;

            _resourceSets          = new Dictionary <string, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            _resourceGroveler = new ManifestBasedResourceGroveler(mediator);

            _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, out _fallbackLoc);
        }
Example #8
0
        // Constructs a Resource Manager for files beginning with
        // baseName in the directory specified by resourceDir
        // or in the current directory.  This Assembly-ignorant constructor is
        // mostly useful for testing your own ResourceSet implementation.
        //
        // A good example of a baseName might be "Strings".  BaseName
        // should not end in ".resources".
        //
        // Note: System.Windows.Forms uses this method at design time.
        //
        private ResourceManager(string baseName, string resourceDir,
                                [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
                                Type?userResourceSet)
        {
            ArgumentNullException.ThrowIfNull(baseName);
            ArgumentNullException.ThrowIfNull(resourceDir);

            BaseNameField = baseName;

            _moduleDir             = resourceDir;
            _userResourceSet       = userResourceSet;
            _resourceSets          = new Dictionary <string, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            _resourceGroveler = new FileBasedResourceGroveler(mediator);
        }
        private void OnDeserialized(StreamingContext ctx)
        {
            this._resourceSets = new Dictionary <string, ResourceSet>();
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            if (this.UseManifest)
            {
                this.resourceGroveler = new ManifestBasedResourceGroveler(mediator);
            }
            else
            {
                this.resourceGroveler = new FileBasedResourceGroveler(mediator);
            }
            if (this.m_callingAssembly == null)
            {
                this.m_callingAssembly = (RuntimeAssembly)this._callingAssembly;
            }
            if (this.UseManifest && (this._neutralResourcesCulture == null))
            {
                this._neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(this.MainAssembly, ref this._fallbackLoc);
            }
        }
Example #10
0
        // Constructs a Resource Manager for files beginning with
        // baseName in the directory specified by resourceDir
        // or in the current directory.  This Assembly-ignorant constructor is
        // mostly useful for testing your own ResourceSet implementation.
        //
        // A good example of a baseName might be "Strings".  BaseName
        // should not end in ".resources".
        //
        // Note: System.Windows.Forms uses this method at design time.
        //
        private ResourceManager(string baseName, string resourceDir, Type?userResourceSet)
        {
            if (null == baseName)
            {
                throw new ArgumentNullException(nameof(baseName));
            }
            if (null == resourceDir)
            {
                throw new ArgumentNullException(nameof(resourceDir));
            }

            BaseNameField = baseName;

            _moduleDir             = resourceDir;
            _userResourceSet       = userResourceSet;
            _resourceSets          = new Dictionary <string, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);

            _resourceGroveler = new FileBasedResourceGroveler(mediator);
        }
 private void CommonSatelliteAssemblyInit()
 {
     this.UseManifest = true;
     this._resourceSets = new Dictionary<string, ResourceSet>();
     this._fallbackLoc = UltimateResourceFallbackLocation.MainAssembly;
     ResourceManagerMediator mediator = new ResourceManagerMediator(this);
     this.resourceGroveler = new ManifestBasedResourceGroveler(mediator);
     this._neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(this.MainAssembly, ref this._fallbackLoc);
     if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled())
     {
         CultureInfo invariantCulture = CultureInfo.InvariantCulture;
         string resourceFileName = this.GetResourceFileName(invariantCulture);
         if (this.resourceGroveler.HasNeutralResources(invariantCulture, resourceFileName))
         {
             FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(this.BaseNameField, this.MainAssembly, resourceFileName);
         }
         else
         {
             string resName = resourceFileName;
             if ((this._locationInfo != null) && (this._locationInfo.Namespace != null))
             {
                 resName = this._locationInfo.Namespace + Type.Delimiter + resourceFileName;
             }
             FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(this.BaseNameField, this.MainAssembly, resName);
         }
     }
     this.ResourceSets = new Hashtable();
 }
Example #12
0
        // Trying to unify code as much as possible, even though having to do a
        // security check in each constructor prevents it.
        private void CommonAssemblyInit()
        {
            if (_bUsingModernResourceManagement == false)
            {
                UseManifest = true;
        
                _resourceSets = new Dictionary<String,ResourceSet>();
                _lastUsedResourceCache = new CultureNameResourceSetPair();

                _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly;

                ResourceManagerMediator mediator = new ResourceManagerMediator(this);
                resourceGroveler = new ManifestBasedResourceGroveler(mediator);
            }

            _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);
        }
Example #13
0
        private ResourceManager(String baseName, String resourceDir, Type usingResourceSet) { 

            if (null==baseName)
                throw new ArgumentNullException("baseName");
            if (null==resourceDir) 
                throw new ArgumentNullException("resourceDir");
            Contract.EndContractBlock(); 
 
            BaseNameField = baseName;
 
            moduleDir = resourceDir;
            _userResourceSet = usingResourceSet;
#pragma warning disable 618
            ResourceSets = new Hashtable(); // for backward compatibility 
#pragma warning restore 618
            _resourceSets = new Dictionary<String, ResourceSet>(); 
            UseManifest = false; 

            ResourceManagerMediator mediator = new ResourceManagerMediator(this); 
            resourceGroveler = new FileBasedResourceGroveler(mediator);

#if !FEATURE_CORECLR   // PAL doesn't support eventing, and we don't compile event providers for coreclr
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) { 
                CultureInfo culture = CultureInfo.InvariantCulture;
                String defaultResName = GetResourceFileName(culture); 
 
                if (resourceGroveler.HasNeutralResources(culture, defaultResName)) {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName); 
                }
                else {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, defaultResName);
                } 
            }
#endif 
        } 
Example #14
0
        protected ResourceManager() 
        {
            Init(); 
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            resourceGroveler = new ManifestBasedResourceGroveler(mediator);

        } 
Example #15
0
        // Constructs a Resource Manager for files beginning with 
        // baseName in the directory specified by resourceDir
        // or in the current directory.  This Assembly-ignorant constructor is 
        // mostly useful for testing your own ResourceSet implementation.
        //
        // A good example of a baseName might be "Strings".  BaseName 
        // should not end in ".resources".
        //
        // Note: System.Windows.Forms uses this method at design time.
        // 
        private ResourceManager(String baseName, String resourceDir, Type usingResourceSet) {
            if (null==baseName)
                throw new ArgumentNullException(nameof(baseName));
            if (null==resourceDir)
                throw new ArgumentNullException(nameof(resourceDir));
            Contract.EndContractBlock();

            BaseNameField = baseName;

            moduleDir = resourceDir;
            _userResourceSet = usingResourceSet;
#pragma warning disable 618
            ResourceSets = new Hashtable(); // for backward compatibility
#pragma warning restore 618
            _resourceSets = new Dictionary<String, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();
            UseManifest = false;

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            resourceGroveler = new FileBasedResourceGroveler(mediator);
        }
Example #16
0
        private void OnDeserialized(StreamingContext ctx)
        {
            _resourceSets = new Dictionary<String, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();
            // set up resource groveler, depending on whether this ResourceManager
            // is looking for files or assemblies
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            if (UseManifest)
            {
                resourceGroveler = new ManifestBasedResourceGroveler(mediator);
            }
            else
            {
                resourceGroveler = new FileBasedResourceGroveler(mediator);
            }

            // correct callingAssembly for v2
            if (this.m_callingAssembly == null)
            {
                this.m_callingAssembly = (RuntimeAssembly)_callingAssembly;
            }

            // v2 does this lazily
            if (UseManifest && this._neutralResourcesCulture == null)
            {
                _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);
            }
        }
Example #17
0
        protected ResourceManager() 
        {
#if !FEATURE_CORECLR
            // This constructor is not designed to be used under AppX and is not in the Win8 profile.
            // However designers may use them even if they are running under AppX since they are
            // not subject to the restrictions of the Win8 profile.
            Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode());
#endif

            Init();

            _lastUsedResourceCache = new CultureNameResourceSetPair();
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            resourceGroveler = new ManifestBasedResourceGroveler(mediator);
        }
 private ResourceManager(string baseName, string resourceDir, Type usingResourceSet)
 {
     if (baseName == null)
     {
         throw new ArgumentNullException("baseName");
     }
     if (resourceDir == null)
     {
         throw new ArgumentNullException("resourceDir");
     }
     this.BaseNameField = baseName;
     this.moduleDir = resourceDir;
     this._userResourceSet = usingResourceSet;
     this.ResourceSets = new Hashtable();
     this._resourceSets = new Dictionary<string, ResourceSet>();
     this.UseManifest = false;
     ResourceManagerMediator mediator = new ResourceManagerMediator(this);
     this.resourceGroveler = new FileBasedResourceGroveler(mediator);
     if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled())
     {
         CultureInfo invariantCulture = CultureInfo.InvariantCulture;
         string resourceFileName = this.GetResourceFileName(invariantCulture);
         if (this.resourceGroveler.HasNeutralResources(invariantCulture, resourceFileName))
         {
             FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(this.BaseNameField, this.MainAssembly, resourceFileName);
         }
         else
         {
             FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(this.BaseNameField, this.MainAssembly, resourceFileName);
         }
     }
 }
Example #19
0
        // Constructs a Resource Manager for files beginning with 
        // baseName in the directory specified by resourceDir
        // or in the current directory.  This Assembly-ignorant constructor is 
        // mostly useful for testing your own ResourceSet implementation.
        //
        // A good example of a baseName might be "Strings".  BaseName 
        // should not end in ".resources".
        //
        // Note: System.Windows.Forms uses this method at design time.
        // 
        private ResourceManager(String baseName, String resourceDir, Type usingResourceSet) {
            if (null==baseName)
                throw new ArgumentNullException("baseName");
            if (null==resourceDir)
                throw new ArgumentNullException("resourceDir");
            Contract.EndContractBlock();

#if !FEATURE_CORECLR
            // This constructor is not designed to be used under AppX and is not in the Win8 profile.
            // However designers may use them even if they are running under AppX since they are
            // not subject to the restrictions of the Win8 profile.
            Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode());
#endif

            BaseNameField = baseName;

            moduleDir = resourceDir;
            _userResourceSet = usingResourceSet;
#pragma warning disable 618
            ResourceSets = new Hashtable(); // for backward compatibility
#pragma warning restore 618
            _resourceSets = new Dictionary<String, ResourceSet>();
            _lastUsedResourceCache = new CultureNameResourceSetPair();
            UseManifest = false;

            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            resourceGroveler = new FileBasedResourceGroveler(mediator);

#if !FEATURE_CORECLR   // PAL doesn't support eventing, and we don't compile event providers for coreclr
            if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) {
                CultureInfo culture = CultureInfo.InvariantCulture;
                String defaultResName = GetResourceFileName(culture);

                if (resourceGroveler.HasNeutralResources(culture, defaultResName)) {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName);
                }
                else {
                    FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, defaultResName);
                }
            }           
#endif
        }
 private void OnDeserialized(StreamingContext ctx)
 {
     this._resourceSets = new Dictionary<string, ResourceSet>();
     ResourceManagerMediator mediator = new ResourceManagerMediator(this);
     if (this.UseManifest)
     {
         this.resourceGroveler = new ManifestBasedResourceGroveler(mediator);
     }
     else
     {
         this.resourceGroveler = new FileBasedResourceGroveler(mediator);
     }
     if (this.m_callingAssembly == null)
     {
         this.m_callingAssembly = (RuntimeAssembly) this._callingAssembly;
     }
     if (this.UseManifest && (this._neutralResourcesCulture == null))
     {
         this._neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(this.MainAssembly, ref this._fallbackLoc);
     }
 }
Example #21
0
        private void CommonAssemblyInit()
        {
            if (_bUsingModernResourceManagement == false)
            {
                UseManifest = true;
        
                _resourceSets = new Dictionary<String,ResourceSet>();
                _lastUsedResourceCache = new CultureNameResourceSetPair();

                _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly;

                ResourceManagerMediator mediator = new ResourceManagerMediator(this);
                resourceGroveler = new ManifestBasedResourceGroveler(mediator);
            }

            _neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);

#if !FEATURE_CORECLR   // PAL doesn't support eventing, and we don't compile event providers for coreclr
            if (_bUsingModernResourceManagement == false)
            {
                if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) {
                    CultureInfo culture = CultureInfo.InvariantCulture;
                    String defaultResName = GetResourceFileName(culture);

                    if (resourceGroveler.HasNeutralResources(culture, defaultResName)) {
                        FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName);
                    }
                    else {
                        String outputResName = defaultResName;
                        if (_locationInfo != null && _locationInfo.Namespace != null)
                            outputResName = _locationInfo.Namespace + Type.Delimiter + defaultResName;
                        FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, outputResName);
                    }
                }

#pragma warning disable 618
                ResourceSets = new Hashtable(); // for backward compatibility
#pragma warning restore 618
            }
#endif
        }
Example #22
0
        protected ResourceManager() 
        {
            Init();

            _lastUsedResourceCache = new CultureNameResourceSetPair();
            ResourceManagerMediator mediator = new ResourceManagerMediator(this);
            resourceGroveler = new ManifestBasedResourceGroveler(mediator);
        }