Example #1
0
        /// <summary>
        /// 剪切文件夹(区别于复制文件夹)
        /// 注意:不会将路径的目录移动过去
        /// </summary>
        /// <param name="sPath"></param>
        /// <param name="tPath"></param>
        public static void MoveFolder(string sPath, string tPath)
        {
            if (Directory.Exists(sPath))
            {
                try
                {
                    if (Directory.Exists(tPath))
                    {
                        RemoveFullFolder(tPath);

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

                    Directory.Move(sPath, tPath);
                }
                catch (Exception ex)
                {
                    Debug.LogError(ex.Message);
                }
            }
            else
            {
                ATLog.Error("路径不存在! \r\n" + sPath);
                Debug.LogError(sPath + " : Not Found");
            }
        }
Example #2
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 !");
        }
Example #3
0
        /// <summary>
        /// 写内容到文件
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static string WriteToFile(string filePath, string content, FileMode mode = FileMode.OpenOrCreate)
        {
            string result = null;

            try
            {
                FileStream   fs = new FileStream(filePath, mode, FileAccess.Write);
                StreamWriter sw = new StreamWriter(fs);
                sw.WriteLine(content);
                sw.Close();
            }
            catch (Exception ex)
            {
                result = ex.Message;
                ATLog.Error(ex);
                return(result);
            }

            return(result);
        }