Exemple #1
0
        public static void WritePreferences()
        {
            // Don't change anything if there's a command line override
            if (GetCommandLineRemoteAddressOverride() != null)
            {
                return;
            }

            CacheServerMode oldMode       = (CacheServerMode)EditorPrefs.GetInt(kModeKey);
            var             oldPath       = EditorPrefs.GetString(LocalCacheServer.PathKey);
            var             oldCustomPath = EditorPrefs.GetBool(LocalCacheServer.CustomPathKey);
            bool            changedDir    = false;

            if (oldMode != s_CacheServerMode && oldMode == CacheServerMode.Local)
            {
                changedDir = true;
            }
            if (s_EnableCustomPath && oldPath != s_CachePath)
            {
                changedDir = true;
            }
            if (s_EnableCustomPath != oldCustomPath && s_CachePath != LocalCacheServer.GetCacheLocation() && s_CachePath != "")
            {
                changedDir = true;
            }
            if (changedDir)
            {
                s_LocalCacheServerUsedSize = -1;
                var message = s_CacheServerMode == CacheServerMode.Local ?
                              "You have changed the location of the local cache storage." :
                              "You have disabled the local cache.";
                message += " Do you want to delete the old locally cached data at " + LocalCacheServer.GetCacheLocation() + "?";
                if (EditorUtility.DisplayDialog("Delete old Cache", message, "Delete", "Don't Delete"))
                {
                    LocalCacheServer.Clear();
                    s_LocalCacheServerUsedSize = -1;
                }
            }

            EditorPrefs.SetInt(kAssetPipelineVersionForNewProjects, (int)s_AssetPipelineVersionForNewProjects);
            EditorPrefs.SetString(kIPAddress2Key, s_CacheServer2IPAddress);
            EditorPrefs.SetInt(kMode2Key, (int)s_CacheServer2Mode);
            EditorPrefs.SetString(kIPAddressKey, s_CacheServerIPAddress);
            EditorPrefs.SetInt(kModeKey, (int)s_CacheServerMode);
            EditorPrefs.SetInt(LocalCacheServer.SizeKey, s_LocalCacheServerSize);
            EditorPrefs.SetString(LocalCacheServer.PathKey, s_CachePath);
            EditorPrefs.SetBool(LocalCacheServer.CustomPathKey, s_EnableCustomPath);
            LocalCacheServer.Setup();

            if (AssetDatabase.IsV2Enabled())
            {
                AssetDatabaseExperimental.RefreshConnectionToCacheServer();
            }

            if (changedDir)
            {
                //Call ExitGUI after bringing up a dialog to avoid an exception
                EditorGUIUtility.ExitGUI();
            }
        }
 public static void WritePreferences()
 {
     if (CacheServerPreferences.GetCommandLineRemoteAddressOverride() == null)
     {
         CacheServerPreferences.CacheServerMode @int = (CacheServerPreferences.CacheServerMode)EditorPrefs.GetInt("CacheServerMode");
         string @string = EditorPrefs.GetString("LocalCacheServerPath");
         bool   @bool   = EditorPrefs.GetBool("LocalCacheServerCustomPath");
         bool   flag    = false;
         if (@int != CacheServerPreferences.s_CacheServerMode && @int == CacheServerPreferences.CacheServerMode.Local)
         {
             flag = true;
         }
         if (CacheServerPreferences.s_EnableCustomPath && @string != CacheServerPreferences.s_CachePath)
         {
             flag = true;
         }
         if (CacheServerPreferences.s_EnableCustomPath != @bool && CacheServerPreferences.s_CachePath != LocalCacheServer.GetCacheLocation() && CacheServerPreferences.s_CachePath != "")
         {
             flag = true;
         }
         if (flag)
         {
             CacheServerPreferences.s_LocalCacheServerUsedSize = -1L;
             string text = (CacheServerPreferences.s_CacheServerMode != CacheServerPreferences.CacheServerMode.Local) ? "You have disabled the local cache." : "You have changed the location of the local cache storage.";
             text = text + " Do you want to delete the old locally cached data at " + LocalCacheServer.GetCacheLocation() + "?";
             if (EditorUtility.DisplayDialog("Delete old Cache", text, "Delete", "Don't Delete"))
             {
                 LocalCacheServer.Clear();
                 CacheServerPreferences.s_LocalCacheServerUsedSize = -1L;
             }
         }
         EditorPrefs.SetString("CacheServerIPAddress", CacheServerPreferences.s_CacheServerIPAddress);
         EditorPrefs.SetInt("CacheServerMode", (int)CacheServerPreferences.s_CacheServerMode);
         EditorPrefs.SetInt("LocalCacheServerSize", CacheServerPreferences.s_LocalCacheServerSize);
         EditorPrefs.SetString("LocalCacheServerPath", CacheServerPreferences.s_CachePath);
         EditorPrefs.SetBool("LocalCacheServerCustomPath", CacheServerPreferences.s_EnableCustomPath);
         LocalCacheServer.Setup();
         if (flag)
         {
             GUIUtility.ExitGUI();
         }
     }
 }
        public static void WritePreferences()
        {
            CacheServerMode @int  = (CacheServerMode)EditorPrefs.GetInt("CacheServerMode");
            string          str   = EditorPrefs.GetString("LocalCacheServerPath");
            bool            @bool = EditorPrefs.GetBool("LocalCacheServerCustomPath");
            bool            flag2 = false;

            if ((@int != s_CacheServerMode) && (@int == CacheServerMode.Local))
            {
                flag2 = true;
            }
            if (s_EnableCustomPath && (str != s_CachePath))
            {
                flag2 = true;
            }
            if (((s_EnableCustomPath != @bool) && (s_CachePath != LocalCacheServer.GetCacheLocation())) && (s_CachePath != ""))
            {
                flag2 = true;
            }
            if (flag2)
            {
                s_LocalCacheServerUsedSize = -1L;
                string message = (s_CacheServerMode != CacheServerMode.Local) ? "You have disabled the local cache." : "You have changed the location of the local cache storage.";
                message = message + " Do you want to delete the old locally cached data at " + LocalCacheServer.GetCacheLocation() + "?";
                if (EditorUtility.DisplayDialog("Delete old Cache", message, "Delete", "Don't Delete"))
                {
                    LocalCacheServer.Clear();
                    s_LocalCacheServerUsedSize = -1L;
                }
            }
            EditorPrefs.SetString("CacheServerIPAddress", s_CacheServerIPAddress);
            EditorPrefs.SetInt("CacheServerMode", (int)s_CacheServerMode);
            EditorPrefs.SetInt("LocalCacheServerSize", s_LocalCacheServerSize);
            EditorPrefs.SetString("LocalCacheServerPath", s_CachePath);
            EditorPrefs.SetBool("LocalCacheServerCustomPath", s_EnableCustomPath);
            if (IsCollabCacheEnabled())
            {
                EditorPrefs.SetString("CollabCacheIPAddress", s_CollabCacheIPAddress);
                EditorPrefs.SetBool("CollabCacheEnabled", s_CollabCacheEnabled);
            }
            LocalCacheServer.Setup();
        }