// --------------------- static public BackupFileElem Create(string filename, string relFilename, BackupConfigMode config) { string targetFilename = Path.Combine(Application.dataPath, relFilename); if (!File.Exists(targetFilename)) { //Debug.Log("Target file [" + targetFilename + "] doesn't exist!!!"); return(null); } string backupCode = File.ReadAllText(filename); string targetCode = File.ReadAllText(targetFilename); if ((backupCode.Length == targetCode.Length) && backupCode.Equals(targetCode)) { //Debug.Log("Target file is the same as backed up one [" + targetFilename + "]!"); return(null); } BackupFileElem file = new BackupFileElem(config.treeView); file.name = Path.GetFileName(filename); //file.config = config; file.lang = ConvertedScript.GetScriptLang(filename); file.pathIn = filename; file.pathOut = targetFilename; file.enabled = true; return(file); }
// ------------------- private BackupFileElem CreateFile(string path) { string relativePath = path.Replace(this.basePath, ""); BackupFileElem file = BackupFileElem.Create(path, relativePath, this); if (file == null) { return(null); } TreeViewElem parent = TreeViewElem.CreateDirectoryStructure(this.treeView, Path.GetDirectoryName(relativePath), this.CreateFolder); if (parent != null) { parent.AddChild(file); this.fileElems.Add(file); } return(file); }