private void ParseLinkedFiles(string jsonString) { string directory = Directory; Regex matcher = new Regex("file\\([\\S]+\\)"); foreach (Match match in matcher.Matches(jsonString)) { string matchValue = match.Value; // Sigh, special case these because they're more like folders instead of files if (matchValue != "file(animations)" && matchValue != "file(effects)") { string linkedFile = JsonHelper.GetFileFromFileJson(match.Value, directory); linkedFile = JsonHelper.NormalizeSystemPath(linkedFile); if (!System.IO.File.Exists(linkedFile) && !System.IO.Directory.Exists(linkedFile)) { AddError("Links to non-existent file " + linkedFile); continue; } if (LinkedFileData.ContainsKey(linkedFile)) { continue; } FileData linkedFileData = GetFileDataFactory(linkedFile); if (linkedFileData != null) { LinkedFileData.Add(linkedFile, linkedFileData); linkedFileData.ReferencedByFileData[GetAliasOrFlatName()] = this; } } } }
public override bool Clone(string newPath, CloneObjectParameters parameters, HashSet <string> alreadyCloned, bool execute) { if (execute) { string newDirectory = System.IO.Path.GetDirectoryName(newPath); System.IO.Directory.CreateDirectory(newDirectory); if (!System.IO.File.Exists(newPath)) { System.IO.File.Copy(Path, newPath); } } string qmoPath = GetQmoPath(); if (mIsQb && LinkedFileData.ContainsKey(qmoPath)) { string newQmoPath = newPath.Replace(".qb", ".qmo"); if (!alreadyCloned.Contains(newQmoPath)) { alreadyCloned.Add(newQmoPath); LinkedFileData[qmoPath].Clone(newQmoPath, parameters, alreadyCloned, execute); } } return(true); }