Ejemplo n.º 1
0
 /// <summary>
 /// 删除目录
 /// </summary>
 /// <param name="path"></param>
 public static void Delete(string path)
 {
     if (Directory.Exists(path))
     {
         Directory.Delete(path);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 创建目录
 /// </summary>
 /// <param name="path"></param>
 public static void CreateDirectory(string path)
 {
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
 }
Ejemplo n.º 3
0
        public void Cleanup()
        {
            var dir = Path.GetDirectoryName(m_UserSettingsRepo.path);

            if (Directory.Exists(dir))
            {
                Directory.Delete(dir);
            }
        }
Ejemplo n.º 4
0
        private static void OpenBuildFolder()
        {
            var path = System.IO.Directory.GetCurrentDirectory() + "\\" + "Release" + "\\";

            if (Directory.Exists(path))
            {
                var processStartInfo = new ProcessStartInfo
                {
                    Arguments = path,
                    FileName  = "explorer.exe"
                };

                Process.Start(processStartInfo);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 是否存在
 /// </summary>
 /// <param name="path"></param>
 public static bool Exists(string path)
 {
     return(Directory.Exists(path));;
 }
Ejemplo n.º 6
0
        static void OnToolsGUI(string rootNs, string viewNs, string constNs, string dataNs, string autoDir,
                               string scriptDir)
        {
            EditorGUILayout.LabelField("生成目录", generateDir);
            if (GUILayout.Button("设置生成目录"))
            {
                generateDir = EditorUtility.OpenFolderPanel("选择生成目录", Application.dataPath, "");
            }
            EditorGUILayout.Space();

            EditorGUILayout.LabelField("资源目录", sourDir);
            if (GUILayout.Button("设置资源目录"))
            {
                sourDir = EditorUtility.OpenFolderPanel("选择资源目录", Application.dataPath, "");
            }
            EditorGUILayout.Space();

            nameSpace = EditorGUILayout.TextField("命名空间", nameSpace);

            HasParentClass = EditorGUILayout.Toggle("是否具有父类", HasParentClass);
            if (HasParentClass)
            {
                parentClass     = EditorGUILayout.TextField("父类名", parentClass);
                IsGenericParent = EditorGUILayout.Toggle("父类是否是泛型类", IsGenericParent);
                if (IsGenericParent)
                {
                    IsGenericParamSelf = EditorGUILayout.Toggle("泛型参数是不是本类名", IsGenericParamSelf);
                    if (!IsGenericParamSelf)
                    {
                        GenericParam = EditorGUILayout.TextField("泛型参数", GenericParam);
                    }
                }
            }

            EditorGUILayout.Space();
            if (GUILayout.Button("开始生成", GUILayout.Height(3 * EditorGUIUtility.singleLineHeight)))
            {
                if (!Directory.Exists(generateDir))
                {
                    Debug.LogError("生成目录不存在:" + generateDir);
                    return;
                }

                if (!Directory.Exists(sourDir))
                {
                    Debug.LogError("资源目录不存在:" + sourDir);
                    return;
                }

                if (string.IsNullOrEmpty(nameSpace))
                {
                    Debug.LogError("命名空间不能为空");
                    return;
                }

                if (HasParentClass)
                {
                    if (string.IsNullOrEmpty(parentClass))
                    {
                        Debug.LogError("父类不能为空");
                        return;
                    }
                    else
                    {
                        if (IsGenericParent && !IsGenericParamSelf && string.IsNullOrEmpty(GenericParam))
                        {
                            Debug.LogError("泛型参数不能为空");
                            return;
                        }
                    }
                }

                Create();
            }
        }