public static List<string> GetAvailableFilesWithExtensionOnTheHDD(PresetFileLocation fileLocation, string fileExtensionWithoutDot)
 {
   List<string> exentionFromFolders = PresetLibraryLocations.GetFilesWithExentionFromFolders(PresetLibraryLocations.GetDirectoryPaths(fileLocation), fileExtensionWithoutDot);
   for (int index = 0; index < exentionFromFolders.Count; ++index)
     exentionFromFolders[index] = PresetLibraryLocations.ConvertToUnitySeperators(exentionFromFolders[index]);
   return exentionFromFolders;
 }
 public static List<string> GetAvailableFilesWithExtensionOnTheHDD(PresetFileLocation fileLocation, string fileExtensionWithoutDot)
 {
     List<string> filesWithExentionFromFolders = GetFilesWithExentionFromFolders(GetDirectoryPaths(fileLocation), fileExtensionWithoutDot);
     for (int i = 0; i < filesWithExentionFromFolders.Count; i++)
     {
         filesWithExentionFromFolders[i] = ConvertToUnitySeperators(filesWithExentionFromFolders[i]);
     }
     return filesWithExentionFromFolders;
 }
        void CreateLibraryAndCloseWindow(EditorWindow editorWindow)
        {
            PresetFileLocation fileLocation = s_Texts.fileLocationOrder[m_SelectedIndexInPopup];

            m_ErrorString = m_CreateLibraryCallback(m_NewLibraryName, fileLocation);
            if (string.IsNullOrEmpty(m_ErrorString))
            {
                editorWindow.Close();
            }
        }
Esempio n. 4
0
        private string CreateNewLibraryCallback(string libraryName, PresetFileLocation fileLocation)
        {
            string presetLibraryPathWithoutExtension = Path.Combine(PresetLibraryLocations.GetDefaultFilePathForFileLocation(fileLocation), libraryName);

            if (this.CreateNewLibrary(presetLibraryPathWithoutExtension) != null)
            {
                this.currentLibraryWithoutExtension = presetLibraryPathWithoutExtension;
            }
            return(ScriptableSingleton <PresetLibraryManager> .instance.GetLastError());
        }
        public static List <string> GetAvailableFilesWithExtensionOnTheHDD(PresetFileLocation fileLocation, string fileExtensionWithoutDot)
        {
            List <string> exentionFromFolders = PresetLibraryLocations.GetFilesWithExentionFromFolders(PresetLibraryLocations.GetDirectoryPaths(fileLocation), fileExtensionWithoutDot);

            for (int index = 0; index < exentionFromFolders.Count; ++index)
            {
                exentionFromFolders[index] = PresetLibraryLocations.ConvertToUnitySeperators(exentionFromFolders[index]);
            }
            return(exentionFromFolders);
        }
Esempio n. 6
0
        public static List <string> GetAvailableFilesWithExtensionOnTheHDD(PresetFileLocation fileLocation, string fileExtensionWithoutDot)
        {
            List <string> filesWithExentionFromFolders = GetFilesWithExentionFromFolders(GetDirectoryPaths(fileLocation), fileExtensionWithoutDot);

            for (int i = 0; i < filesWithExentionFromFolders.Count; i++)
            {
                filesWithExentionFromFolders[i] = ConvertToUnitySeperators(filesWithExentionFromFolders[i]);
            }
            return(filesWithExentionFromFolders);
        }
        private void CreateLibraryAndCloseWindow(EditorWindow editorWindow)
        {
            PresetFileLocation arg = PopupWindowContentForNewLibrary.s_Texts.fileLocationOrder[this.m_SelectedIndexInPopup];

            this.m_ErrorString = this.m_CreateLibraryCallback(this.m_NewLibraryName, arg);
            if (string.IsNullOrEmpty(this.m_ErrorString))
            {
                editorWindow.Close();
            }
        }
Esempio n. 8
0
        // Returns an error string. If no errors occured then null is returned
        string CreateNewLibraryCallback(string libraryName, PresetFileLocation fileLocation)
        {
            string defaultPath          = PresetLibraryLocations.GetDefaultFilePathForFileLocation(fileLocation);
            string pathWithoutExtension = Path.Combine(defaultPath, libraryName);

            if (CreateNewLibrary(pathWithoutExtension) != null)
            {
                currentLibraryWithoutExtension = pathWithoutExtension;
            }
            return(PresetLibraryManager.instance.GetLastError());
        }
Esempio n. 9
0
 public PresetLibraryEditor(ScriptableObjectSaveLoadHelper <T> helper, PresetLibraryEditorState state, System.Action <int, object> itemClickedCallback)
 {
     this.m_SaveLoadHelper                    = helper;
     this.m_State                             = state;
     this.m_ItemClickedCallback               = itemClickedCallback;
     this.settingsMenuRightMargin             = 10f;
     this.useOnePixelOverlappedGrid           = false;
     this.alwaysShowScrollAreaHorizontalLines = true;
     this.marginsForList                      = new RectOffset(10, 10, 5, 5);
     this.marginsForGrid                      = new RectOffset(5, 5, 5, 5);
     this.m_PresetLibraryFileLocation         = PresetLibraryLocations.GetFileLocationFromPath(this.currentLibraryWithoutExtension);
 }
        public static string GetDefaultFilePathForFileLocation(PresetFileLocation fileLocation)
        {
            switch (fileLocation)
            {
                case PresetFileLocation.PreferencesFolder:
                    return (InternalEditorUtility.unityPreferencesFolder + "/Presets/");

                case PresetFileLocation.ProjectFolder:
                    return "Assets/Editor/";
            }
            Debug.LogError("Enum not handled!");
            return string.Empty;
        }
Esempio n. 11
0
 public static string GetDefaultFilePathForFileLocation(PresetFileLocation fileLocation)
 {
     if (fileLocation == PresetFileLocation.PreferencesFolder)
     {
         return(InternalEditorUtility.unityPreferencesFolder + "/Presets/");
     }
     if (fileLocation != PresetFileLocation.ProjectFolder)
     {
         Debug.LogError("Enum not handled!");
         return(string.Empty);
     }
     return("Assets/Editor/");
 }
		public static string GetDefaultFilePathForFileLocation(PresetFileLocation fileLocation)
		{
			if (fileLocation == PresetFileLocation.PreferencesFolder)
			{
				return InternalEditorUtility.unityPreferencesFolder + "/Presets/";
			}
			if (fileLocation != PresetFileLocation.ProjectFolder)
			{
				Debug.LogError("Enum not handled!");
				return string.Empty;
			}
			return "Assets/Editor/";
		}
        public static string GetDefaultFilePathForFileLocation(PresetFileLocation fileLocation)
        {
            switch (fileLocation)
            {
            case PresetFileLocation.PreferencesFolder:
                return(InternalEditorUtility.unityPreferencesFolder + "/Presets/");

            case PresetFileLocation.ProjectFolder:
                return("Assets/Editor/");

            default:
                Debug.LogError((object)"Enum not handled!");
                return(string.Empty);
            }
        }
 private static List<string> GetDirectoryPaths(PresetFileLocation fileLocation)
 {
     List<string> list = new List<string>();
     if (fileLocation != PresetFileLocation.PreferencesFolder)
     {
         if (fileLocation == PresetFileLocation.ProjectFolder)
         {
             string[] collection = Directory.GetDirectories("Assets/", "Editor", SearchOption.AllDirectories);
             list.AddRange(collection);
             return list;
         }
         Debug.LogError("Enum not handled!");
         return list;
     }
     list.Add(GetDefaultFilePathForFileLocation(PresetFileLocation.PreferencesFolder));
     return list;
 }
Esempio n. 15
0
 public PresetLibraryEditor(ScriptableObjectSaveLoadHelper <T> helper, PresetLibraryEditorState state, Action <int, object> itemClickedCallback)
 {
     this.m_DragState                         = new DragState <T>();
     this.m_Grid                              = new VerticalGrid();
     this.m_MinMaxPreviewHeight               = new Vector2(14f, 64f);
     this.m_PreviewAspect                     = 8f;
     this.m_ShowAddNewPresetItem              = true;
     this.m_IsOpenForEdit                     = true;
     this.m_SaveLoadHelper                    = helper;
     this.m_State                             = state;
     this.m_ItemClickedCallback               = itemClickedCallback;
     this.settingsMenuRightMargin             = 10f;
     this.useOnePixelOverlappedGrid           = false;
     this.alwaysShowScrollAreaHorizontalLines = true;
     this.marginsForList                      = new RectOffset(10, 10, 5, 5);
     this.marginsForGrid                      = new RectOffset(5, 5, 5, 5);
     this.m_PresetLibraryFileLocation         = PresetLibraryLocations.GetFileLocationFromPath(this.currentLibraryWithoutExtension);
 }
Esempio n. 16
0
        private static List <string> GetDirectoryPaths(PresetFileLocation fileLocation)
        {
            List <string> list = new List <string>();

            if (fileLocation != PresetFileLocation.PreferencesFolder)
            {
                if (fileLocation == PresetFileLocation.ProjectFolder)
                {
                    string[] collection = Directory.GetDirectories("Assets/", "Editor", SearchOption.AllDirectories);
                    list.AddRange(collection);
                    return(list);
                }
                Debug.LogError("Enum not handled!");
                return(list);
            }
            list.Add(GetDefaultFilePathForFileLocation(PresetFileLocation.PreferencesFolder));
            return(list);
        }
 private static List<string> GetDirectoryPaths(PresetFileLocation fileLocation)
 {
   List<string> stringList = new List<string>();
   switch (fileLocation)
   {
     case PresetFileLocation.PreferencesFolder:
       stringList.Add(PresetLibraryLocations.GetDefaultFilePathForFileLocation(PresetFileLocation.PreferencesFolder));
       break;
     case PresetFileLocation.ProjectFolder:
       string[] directories = Directory.GetDirectories("Assets/", "Editor", SearchOption.AllDirectories);
       stringList.AddRange((IEnumerable<string>) directories);
       break;
     default:
       Debug.LogError((object) "Enum not handled!");
       break;
   }
   return stringList;
 }
		private static List<string> GetDirectoryPaths(PresetFileLocation fileLocation)
		{
			List<string> list = new List<string>();
			if (fileLocation != PresetFileLocation.PreferencesFolder)
			{
				if (fileLocation != PresetFileLocation.ProjectFolder)
				{
					Debug.LogError("Enum not handled!");
				}
				else
				{
					string[] directories = Directory.GetDirectories("Assets/", "Editor", SearchOption.AllDirectories);
					list.AddRange(directories);
				}
			}
			else
			{
				list.Add(PresetLibraryLocations.GetDefaultFilePathForFileLocation(PresetFileLocation.PreferencesFolder));
			}
			return list;
		}
        private static List <string> GetDirectoryPaths(PresetFileLocation fileLocation)
        {
            List <string> stringList = new List <string>();

            switch (fileLocation)
            {
            case PresetFileLocation.PreferencesFolder:
                stringList.Add(PresetLibraryLocations.GetDefaultFilePathForFileLocation(PresetFileLocation.PreferencesFolder));
                break;

            case PresetFileLocation.ProjectFolder:
                string[] directories = Directory.GetDirectories("Assets/", "Editor", SearchOption.AllDirectories);
                stringList.AddRange((IEnumerable <string>)directories);
                break;

            default:
                Debug.LogError((object)"Enum not handled!");
                break;
            }
            return(stringList);
        }
Esempio n. 20
0
        public static string GetDefaultFilePathForFileLocation(PresetFileLocation fileLocation)
        {
            string result;

            if (fileLocation != PresetFileLocation.PreferencesFolder)
            {
                if (fileLocation != PresetFileLocation.ProjectFolder)
                {
                    Debug.LogError("Enum not handled!");
                    result = "";
                }
                else
                {
                    result = "Assets/Editor/";
                }
            }
            else
            {
                result = InternalEditorUtility.unityPreferencesFolder + "/Presets/";
            }
            return(result);
        }
Esempio n. 21
0
        static List <string> GetDirectoryPaths(PresetFileLocation fileLocation)
        {
            List <string> folderPaths = new List <string>();

            switch (fileLocation)
            {
            case PresetFileLocation.PreferencesFolder:
                folderPaths.Add(GetDefaultFilePathForFileLocation(PresetFileLocation.PreferencesFolder));
                break;

            case PresetFileLocation.ProjectFolder:
                string[] editorFolders = Directory.GetDirectories("Assets/", "Editor", SearchOption.AllDirectories);
                folderPaths.AddRange(editorFolders);
                break;

            default:
                Debug.LogError("Enum not handled!");
                break;
            }

            return(folderPaths);
        }
Esempio n. 22
0
        // Returns an error string. If no errors occured then null is returned
        string CreateNewLibraryCallback(string libraryName, PresetFileLocation fileLocation)
        {
            if (libraryName.Contains(":"))
            {
                return("A filename cannot contain the following character ':'");
            }

            string defaultPath = PresetLibraryLocations.GetDefaultFilePathForFileLocation(fileLocation);

            if (libraryName.StartsWith("\\") || libraryName.StartsWith("/"))
            {
                libraryName = libraryName.Substring(1);
            }

            string pathWithoutExtension = Path.Combine(defaultPath, libraryName);

            if (CreateNewLibrary(pathWithoutExtension) != null)
            {
                currentLibraryWithoutExtension = pathWithoutExtension;
            }
            return(PresetLibraryManager.instance.GetLastError());
        }
 public Texts()
 {
     PresetFileLocation[] locationArray1 = new PresetFileLocation[2];
     locationArray1[1] = PresetFileLocation.ProjectFolder;
     this.fileLocationOrder = locationArray1;
 }
 public Texts()
 {
     PresetFileLocation[] locationArray1 = new PresetFileLocation[2];
     locationArray1[1]      = PresetFileLocation.ProjectFolder;
     this.fileLocationOrder = locationArray1;
 }