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 #2
0
        protected static CultureInfo GetNeutralResourcesLanguage(Assembly a)
        {
            // This method should be obsolete - replace it with the one below.
            // Unfortunately, we made it protected.
            UltimateResourceFallbackLocation ignoringUsefulData = UltimateResourceFallbackLocation.MainAssembly;
            CultureInfo culture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(a, ref ignoringUsefulData);

            return(culture);
        }
Example #3
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 #4
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);
        }
        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 #6
0
 protected static CultureInfo GetNeutralResourcesLanguage(Assembly a)
 {
     // This method should be obsolete - replace it with the one below.
     // Unfortunately, we made it protected.
     return(ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(a, out _));
 }
        protected static CultureInfo GetNeutralResourcesLanguage(Assembly a)
        {
            UltimateResourceFallbackLocation mainAssembly = UltimateResourceFallbackLocation.MainAssembly;

            return(ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(a, ref mainAssembly));
        }