Beispiel #1
0
        private static void Setup(string friendlyName,
                                  string[] propertyNames,
                                  string[] propertyValues)
        {
            AppDomain ad = CurrentDomain;

            if (propertyNames != null && propertyValues != null)
            {
                for (int i = 0; i < propertyNames.Length; i++)
                {
                    // We want to set native dll probing directories before any P/Invokes have a
                    // chance to fire. The Path class, for one, has P/Invokes.
                    if (propertyNames[i] == "NATIVE_DLL_SEARCH_DIRECTORIES")
                    {
                        if (propertyValues[i] == null)
                        {
                            throw new ArgumentNullException("NATIVE_DLL_SEARCH_DIRECTORIES");
                        }

                        string paths = propertyValues[i];
                        if (paths.Length == 0)
                        {
                            break;
                        }

                        nSetNativeDllSearchDirectories(paths);
                    }
                }

                for (int i = 0; i < propertyNames.Length; i++)
                {
                    if (propertyNames[i] != null)
                    {
                        AppContext.SetData(propertyNames[i], propertyValues[i]);
                    }
                }
            }

            // set up the friendly name
            ad.nSetupFriendlyName(friendlyName);

            ad.CreateAppDomainManager(); // could modify FusionStore's object
        }
Beispiel #2
0
 public void SetData(string name, object?data) => AppContext.SetData(name, data);