private void CreateAppDomain()
 {
     if (this._domain == null)
     {
         this._domain = AppDomain.CreateDomain("ResourceIndirectDomain");
         this._resourceRetriever = (ResourceRetriever) this._domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "System.Management.Automation.ResourceRetriever");
     }
 }
 private void CreateAppDomain()
 {
     if (this._domain == null)
     {
         this._domain            = AppDomain.CreateDomain("ResourceIndirectDomain");
         this._resourceRetriever = (ResourceRetriever)this._domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "System.Management.Automation.ResourceRetriever");
     }
 }
 public void Dispose()
 {
     if (!this._disposed && (this._domain != null))
     {
         AppDomain.Unload(this._domain);
         this._domain            = null;
         this._resourceRetriever = null;
     }
     this._disposed = true;
 }
 public void Dispose()
 {
     if (!this._disposed && (this._domain != null))
     {
         AppDomain.Unload(this._domain);
         this._domain = null;
         this._resourceRetriever = null;
     }
     this._disposed = true;
 }
Ejemplo n.º 5
0
 private void CreateAppDomain()
 {
     using (RegistryStringResourceIndirect.tracer.TraceMethod())
     {
         if (this._domain != null)
         {
             return;
         }
         this._domain            = AppDomain.CreateDomain("ResourceIndirectDomain");
         this._resourceRetriever = (ResourceRetriever)this._domain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, "System.Management.Automation.ResourceRetriever");
     }
 }
Ejemplo n.º 6
0
 public void Dispose()
 {
     using (RegistryStringResourceIndirect.tracer.TraceDispose((object)this))
     {
         if (!this._disposed && this._domain != null)
         {
             AppDomain.Unload(this._domain);
             this._domain            = (AppDomain)null;
             this._resourceRetriever = (ResourceRetriever)null;
         }
         this._disposed = true;
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates the app-domain and the instance of the ResourceRetriever and
        /// sets the private fields with the references.
        /// </summary>
        ///
        private void CreateAppDomain()
        {
            if (_domain == null)
            {
                // Create an app-domain to load the resource assemblies in so that they can be
                // unloaded.

                _domain            = AppDomain.CreateDomain("ResourceIndirectDomain");
                _resourceRetriever =
                    (ResourceRetriever)_domain.CreateInstanceAndUnwrap(
                        Assembly.GetExecutingAssembly().FullName,
                        "System.Management.Automation.ResourceRetriever");
            }
        }
Ejemplo n.º 8
0
        private static Assembly LoadAssembly(string assemblyName, string modulePath)
        {
            AssemblyName assemblyName1 = new AssemblyName(assemblyName);
            string       directoryName = Path.GetDirectoryName(modulePath);
            string       fileName      = Path.GetFileName(modulePath);
            CultureInfo  culture       = CultureInfo.CurrentUICulture;
            Assembly     assembly;

            while (true)
            {
                assembly = ResourceRetriever.LoadAssemblyForCulture(culture, assemblyName1, directoryName, fileName);
                if (assembly == null && !string.IsNullOrEmpty(culture.Name))
                {
                    culture = culture.Parent;
                }
                else
                {
                    break;
                }
            }
            return(assembly);
        }
Ejemplo n.º 9
0
        internal string GetStringResource(
            string assemblyName,
            string modulePath,
            string baseName,
            string resourceID)
        {
            string   str1     = (string)null;
            Assembly assembly = ResourceRetriever.LoadAssembly(assemblyName, modulePath);

            if (assembly != null)
            {
                CultureInfo cultureInfo = CultureInfo.CurrentUICulture;
                Stream      manifestResourceStream;
                while (true)
                {
                    string str2 = baseName;
                    if (!string.IsNullOrEmpty(cultureInfo.Name))
                    {
                        str2 = str2 + "." + cultureInfo.Name;
                    }
                    string name = str2 + ".resources";
                    manifestResourceStream = assembly.GetManifestResourceStream(name);
                    if (manifestResourceStream == null && !string.IsNullOrEmpty(cultureInfo.Name))
                    {
                        cultureInfo = cultureInfo.Parent;
                    }
                    else
                    {
                        break;
                    }
                }
                if (manifestResourceStream != null)
                {
                    str1 = ResourceRetriever.GetString(manifestResourceStream, resourceID);
                }
            }
            return(str1);
        }
        /// <summary>
        /// Creates the app-domain and the instance of the ResourceRetriever and
        /// sets the private fields with the references.
        /// </summary>
        /// 
        private void CreateAppDomain()
        {
            if (_domain == null)
            {
                // Create an app-domain to load the resource assemblies in so that they can be
                // unloaded.

                _domain = AppDomain.CreateDomain("ResourceIndirectDomain");
                _resourceRetriever =
                    (ResourceRetriever)_domain.CreateInstanceAndUnwrap(
                        Assembly.GetExecutingAssembly().FullName,
                        "System.Management.Automation.ResourceRetriever");
            }
        }