| | |
| | | { |
| | | foreach (var fileName in ReadRegionFiles (path)) { |
| | | System.IO.File.Delete (System.IO.Path.Combine (path, fileName)); |
| | | Console.WriteLine ("Del region file :" + fileName); |
| | | Utlis.WriteLine ("Del region file :" + fileName); |
| | | } |
| | | } |
| | | |
| | |
| | | System.IO.FileInfo fileInfo = new System.IO.FileInfo (regionRootPath + NextFile.Name); |
| | | if (fileInfo.Exists) { |
| | | fileInfo.MoveTo (Application.RootPath + NextFile.Name); |
| | | Console.WriteLine ("Restroe : "+ NextFile.Name); |
| | | Utlis.WriteLine ("Restroe : "+ NextFile.Name); |
| | | } |
| | | Application.RunOnMainThread (() => { |
| | | int pro = (int)(index * 1.0 / folderCount * 50) + 50; |
| | |
| | | #if DEBUG |
| | | DirectoryInfo root = new DirectoryInfo (RootPath); |
| | | foreach (DirectoryInfo d in root.GetDirectories ()) { |
| | | Console.WriteLine ("文件夹:" + d.Name); |
| | | Utlis.WriteLine ("文件夹:" + d.Name); |
| | | } |
| | | #endif |
| | | if (System.IO.Directory.Exists (srcPath)) { |
| | |
| | | List<string> listFiles = new List<string> (); |
| | | DirectoryInfo TheFolder = new DirectoryInfo (path); |
| | | foreach (FileInfo NextFile in TheFolder.GetFiles ()) { |
| | | Console.WriteLine (NextFile.Name); |
| | | Utlis.WriteLine (NextFile.Name); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | #if DEBUG |
| | | foreach (DirectoryInfo d in root.GetDirectories ()) { |
| | | Console.WriteLine ("文件夹:" + d.Name); |
| | | Utlis.WriteLine ("文件夹:" + d.Name); |
| | | } |
| | | #endif |
| | | } |
| | |
| | | /// <param name="filePath">File path.</param> |
| | | public static bool Exists (string filePath) |
| | | { |
| | | //System.Console.WriteLine ("Exists==" + System.IO.Path.Combine (RootPath, filePath)); |
| | | //Utlis.WriteLine ("Exists==" + System.IO.Path.Combine (RootPath, filePath)); |
| | | return System.IO.File.Exists (System.IO.Path.Combine (RootPath, filePath)); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | System.IO.File.Delete (System.IO.Path.Combine (RootPath, fileName)); |
| | | Console.WriteLine ("删除文件名为:" + fileName); |
| | | Utlis.WriteLine ("删除文件名为:" + fileName); |
| | | //if (UserConfig.Instance.LocalFiles.Contains (fileName)) { |
| | | // UserConfig.Instance.LocalFiles.Remove (fileName); |
| | | //} |
| | |
| | | fileName += "_" + (loopID.Length < 2 ? "0" + loopID : loopID); |
| | | } |
| | | common.SavePath = fileName; |
| | | Console.WriteLine (fileName); |
| | | Utlis.WriteLine (fileName); |
| | | WriteFileByBytes (fileName, SimpleControl.CommonPage.MyEncodingUTF8.GetBytes (Newtonsoft.Json.JsonConvert.SerializeObject (common))); |
| | | } |
| | | |
| | |
| | | fs = new FileStream (System.IO.Path.Combine (RootPath, fileName), FileMode.Create, FileAccess.Write); |
| | | fs.Write (bytes, 0, bytes.Length); |
| | | fs.Flush (); |
| | | Console.WriteLine ("SaveFile:" + fileName); |
| | | Utlis.WriteLine ("SaveFile:" + fileName); |
| | | //if (!UserConfig.Instance.LocalFiles.Contains (fileName)) { |
| | | // UserConfig.Instance.LocalFiles.Add (fileName); |
| | | //} |
| | | return true; |
| | | } catch (Exception ex) { |
| | | Console.WriteLine ("FileUtiles Code 113:" + ex.ToString ()); |
| | | Utlis.WriteLine ("FileUtiles Code 113:" + ex.ToString ()); |
| | | return false; |
| | | } finally { |
| | | try { |
| | |
| | | fs.Close (); |
| | | } |
| | | } catch (Exception ex) { |
| | | Console.WriteLine ("FileUtils Code 121 :" + ex.ToString ()); |
| | | Utlis.WriteLine ("FileUtils Code 121 :" + ex.ToString ()); |
| | | } |
| | | } |
| | | } |