public static void MirrorFolder(string from, string to, Func <string, string, bool> comparer) { from = Path.GetFullPath(from); to = Path.GetFullPath(to); if (!Directory.Exists(from)) { if (Directory.Exists(to)) { Directory.Delete(to, true); } } else { if (!Directory.Exists(to)) { Directory.CreateDirectory(to); } IEnumerable <string> first = from s in Directory.GetFileSystemEntries(to) select FileMirroring.StripPrefix(s, to); IEnumerable <string> enumerable = from s in Directory.GetFileSystemEntries(@from) select FileMirroring.StripPrefix(s, @from); IEnumerable <string> enumerable2 = first.Except(enumerable); foreach (string current in enumerable2) { FileMirroring.DeleteFileOrDirectory(Path.Combine(to, current)); } foreach (string current2 in enumerable) { string text = Path.Combine(from, current2); string text2 = Path.Combine(to, current2); FileMirroring.FileEntryType fileEntryType = FileMirroring.FileEntryTypeFor(text); FileMirroring.FileEntryType fileEntryType2 = FileMirroring.FileEntryTypeFor(text2); if (fileEntryType == FileMirroring.FileEntryType.File && fileEntryType2 == FileMirroring.FileEntryType.Directory) { FileMirroring.DeleteFileOrDirectory(text2); } if (fileEntryType == FileMirroring.FileEntryType.Directory) { if (fileEntryType2 == FileMirroring.FileEntryType.File) { FileMirroring.DeleteFileOrDirectory(text2); } if (fileEntryType2 != FileMirroring.FileEntryType.Directory) { Directory.CreateDirectory(text2); } FileMirroring.MirrorFolder(text, text2); } if (fileEntryType == FileMirroring.FileEntryType.File) { FileMirroring.MirrorFile(text, text2, comparer); } } } }
public static void MirrorFolder(string from, string to, Func <string, string, bool> comparer) { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type FileMirroring.\u003CMirrorFolder\u003Ec__AnonStorey72 folderCAnonStorey72 = new FileMirroring.\u003CMirrorFolder\u003Ec__AnonStorey72(); // ISSUE: reference to a compiler-generated field folderCAnonStorey72.to = to; // ISSUE: reference to a compiler-generated field folderCAnonStorey72.from = from; // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field folderCAnonStorey72.from = Path.GetFullPath(folderCAnonStorey72.from); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated field folderCAnonStorey72.to = Path.GetFullPath(folderCAnonStorey72.to); // ISSUE: reference to a compiler-generated field if (!Directory.Exists(folderCAnonStorey72.from)) { // ISSUE: reference to a compiler-generated field if (!Directory.Exists(folderCAnonStorey72.to)) { return; } // ISSUE: reference to a compiler-generated field Directory.Delete(folderCAnonStorey72.to, true); } else { // ISSUE: reference to a compiler-generated field if (!Directory.Exists(folderCAnonStorey72.to)) { // ISSUE: reference to a compiler-generated field Directory.CreateDirectory(folderCAnonStorey72.to); } // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method IEnumerable <string> first = ((IEnumerable <string>)Directory.GetFileSystemEntries(folderCAnonStorey72.to)).Select <string, string>(new Func <string, string>(folderCAnonStorey72.\u003C\u003Em__FA)); // ISSUE: reference to a compiler-generated field // ISSUE: reference to a compiler-generated method IEnumerable <string> second = ((IEnumerable <string>)Directory.GetFileSystemEntries(folderCAnonStorey72.from)).Select <string, string>(new Func <string, string>(folderCAnonStorey72.\u003C\u003Em__FB)); foreach (string path2 in first.Except <string>(second)) { // ISSUE: reference to a compiler-generated field FileMirroring.DeleteFileOrDirectory(Path.Combine(folderCAnonStorey72.to, path2)); } foreach (string path2 in second) { // ISSUE: reference to a compiler-generated field string str1 = Path.Combine(folderCAnonStorey72.from, path2); // ISSUE: reference to a compiler-generated field string str2 = Path.Combine(folderCAnonStorey72.to, path2); FileMirroring.FileEntryType fileEntryType1 = FileMirroring.FileEntryTypeFor(str1); FileMirroring.FileEntryType fileEntryType2 = FileMirroring.FileEntryTypeFor(str2); if (fileEntryType1 == FileMirroring.FileEntryType.File && fileEntryType2 == FileMirroring.FileEntryType.Directory) { FileMirroring.DeleteFileOrDirectory(str2); } if (fileEntryType1 == FileMirroring.FileEntryType.Directory) { if (fileEntryType2 == FileMirroring.FileEntryType.File) { FileMirroring.DeleteFileOrDirectory(str2); } if (fileEntryType2 != FileMirroring.FileEntryType.Directory) { Directory.CreateDirectory(str2); } FileMirroring.MirrorFolder(str1, str2); } if (fileEntryType1 == FileMirroring.FileEntryType.File) { FileMirroring.MirrorFile(str1, str2, comparer); } } } }