private void DrawCreateFolders()
        {
            KitGUILayout.BeginCleanFoldout("Create Folder Structure", ref ShowFolderSetup);
            if (ShowFolderSetup)
            {
                EditorGUILayout.Separator();

                const string MSG =
                    "This sets up the initial project structure by adding the selected folders to the \"Root Folder\" in the Assets Directory." +
                    "Leave blank for no root folder (new folders will be created under Assets/).";
                EditorGUILayout.HelpBox(MSG, MessageType.Info);

                KitGUILayout.BeginResponsive(RESPONSIVE_WIDTH);
                RootFolder = EditorGUILayout.TextField("Root Folder: ", RootFolder);
                Folders    = (FolderFlags)EditorGUILayout.EnumFlagsField("Folders: ", Folders);
                KitGUILayout.EndResponsive(RESPONSIVE_WIDTH);

                if (GUILayout.Button("Create Folders", GUILayout.Height(30)))
                {
                    _control.SetupFolderStructure(Folders, RootFolder);
                }
            }

            KitGUILayout.EndCleanFoldout();
        }
        static string GetPath(Folders KnownFolder, FolderFlags Flags,
                              bool DefaultUser)
        {
            int Result = SHGetFoldersPath(new Guid(_FolderGuiDs[(int)KnownFolder]), (uint)Flags, new IntPtr(DefaultUser ? -1 : 0), out IntPtr OutPath);

            if (Result >= 0)
            {
                string Path = Marshal.PtrToStringUni(OutPath);
                Marshal.FreeCoTaskMem(OutPath);
                return(Path);
            }

            throw new ExternalException("Unable to retrieve the known folder path. It may not be available on this system.", Result);
        }
        private static string GetPath(FolderEnum folderEnum, FolderFlags flags,
                                      bool defaultUser)
        {
            var result = SHGetKnownFolderPath(new Guid(_folderGuids[(int)folderEnum]),
                                              (uint)flags, new IntPtr(defaultUser ? -1 : 0), out var outPath);

            if (result >= 0)
            {
                string path = Marshal.PtrToStringUni(outPath) ?? throw new NullReferenceException("Marshal.PtrToStringUni(outPath)");
                Marshal.FreeCoTaskMem(outPath);
                return(path);
            }

            throw new ExternalException("Unable to retrieve the known folder path. It may not "
                                        + "be available on this system.", result);
        }
        internal void SetupFolderStructure(FolderFlags folders, string parent = "")
        {
            var values = Enum.GetValues(typeof(FolderFlags)).Cast <FolderFlags>()
                         .Where(flag => flag != FolderFlags.None && flag != FolderFlags.Default);

            foreach (var value in values)
            {
                if (!folders.HasFlag(value))
                {
                    continue;
                }

                Directory.CreateDirectory(Path.Combine(Application.dataPath, parent, value.ToString()));
            }

            AssetDatabase.Refresh();
        }
Beispiel #5
0
 internal static extern void desktop_set_style(FolderFlags flag, bool state);
Beispiel #6
0
 internal static extern bool desktop_get_style(FolderFlags flag);
Beispiel #7
0
 public static void Style(FolderFlags flag, bool state)
 {
     desktop_set_style(flag, state);
 }
Beispiel #8
0
 public static bool Style(FolderFlags flag)
 {
     return(desktop_get_style(flag));
 }
 private void ToggleFlag(FolderFlags flag)
 {
     explorerBrowser1.ViewFolderFlags ^= flag;
 }
 private bool IsFlagSet(FolderFlags flag)
 {
     return((explorerBrowser1.ViewFolderFlags & flag) == flag);
 }
 /// <see cref="FolderEntry.Flags"/>
 public Builder Flags(FolderFlags flags)
 {
     _folder.Flags = flags;
     return(this);
 }