Ejemplo n.º 1
0
        public static void LogTest()
        {
            UnityEngine.Debug.LogError(AutoToolConstants.logPath);

            ATLog.Debug("this is debug log !");
            ATLog.Warn("this is warn log !");
            ATLog.Error("this is error log !");
            ATLog.Info("this is info log !");
        }
Ejemplo n.º 2
0
        private void OnClickSelectUnityInstallDirectoryBtn()
        {
            UnityEXE = EditorUtility.OpenFilePanel("Unity安装路径", System.Environment.CurrentDirectory, "exe");

            System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
            //Debug.LogError(currentProcess.MainModule.FileName);
            if (currentProcess.MainModule.FileName.Replace("\\", "/") != UnityEXE || !AutoToolConstants.UnityVersion.Equals(Application.unityVersion))
            {
                EditorUtility.DisplayDialog("错误", "未选择" + AutoToolConstants.UnityVersion + "的Unity.exe!", "OK");
                ATLog.Warn("未找到相应版本的Unity!");
                UnityEXE = null;
                return;
            }

            EditorPrefs.SetString(AutoToolPrefKeys.UnityEXE, UnityEXE);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 移除文件夹及其子文件
        /// </summary>
        /// <param name="path">文件夹路径</param>
        public static void RemoveFullFolder(string path)
        {
            path = path.Replace("\\", "/");

            if (!Directory.Exists(path))
            {
                ATLog.Warn("文件夹不存在! \r\n " + path);
                return;
            }

            List <string> files = new List <string>(Directory.GetFiles(path));

            files.ForEach(c =>
            {
                string tempFileName = Path.Combine(path, Path.GetFileName(c));
                FileInfo fileInfo   = new FileInfo(tempFileName);
                if (fileInfo.Attributes != FileAttributes.Normal)
                {
                    fileInfo.Attributes = FileAttributes.Normal;
                }
                fileInfo.Delete();
                //File.Delete(tempFileName);
            });

            List <string> folders = new List <string>(Directory.GetDirectories(path));

            folders.ForEach(c =>
            {
                string tempFolderName = Path.Combine(path, Path.GetFileName(c));
                RemoveFullFolder(tempFolderName);
            });

            if (Directory.Exists(path))
            {
                DirectoryInfo directoryInfo = new DirectoryInfo(path);
                if (directoryInfo.Attributes != FileAttributes.Normal)
                {
                    directoryInfo.Attributes = FileAttributes.Normal;
                }
                directoryInfo.Delete();
                //Directory.Delete(path);
                return;
            }
        }