public void Rescan() { files.Clear(); var dirInfo = new DirectoryInfo(Directory); var queue = new Queue <DirectoryInfo>(); queue.Enqueue(new DirectoryInfo(Directory)); while (queue.Count != 0) { var rootDirectoryInfo = queue.Dequeue(); foreach (var fileInfo in rootDirectoryInfo.EnumerateFiles()) { var file = fileInfo.FullName; if (cutDirectoryPrefix) { file = file.Remove(0, dirInfo.FullName.Length + 1); } file = CsprojSynchronization.ToUnixSlashes(file); files.Add(new FileInfo { Path = file, LastWriteTime = fileInfo.LastWriteTime }); } foreach (var directoryInfo in rootDirectoryInfo.EnumerateDirectories()) { if (scanFilter?.Invoke(directoryInfo) ?? true) { queue.Enqueue(directoryInfo); } } } // According to documentation the file order is not guaranteed. files.Sort((a, b) => string.Compare(a.Path, b.Path)); }
private static void SynchronizeAll() { var dontSynchronizeProject = The.Workspace.ProjectJson["DontSynchronizeProject"] as bool?; if (dontSynchronizeProject != null && dontSynchronizeProject.Value) { return; } var fileEnumerator = new ScanOptimizedFileEnumerator( The.Workspace.ProjectDirectory, CsprojSynchronization.SkipUnwantedDirectoriesPredicate, cutDirectoryPrefix: false ); foreach (var target in The.Workspace.Targets) { var limeProj = CsprojSynchronization.ToUnixSlashes(The.Workspace.GetLimeCsprojFilePath(target.Platform)); CsprojSynchronization.SynchronizeProject(limeProj); using (new DirectoryChanger(The.Workspace.ProjectDirectory)) { var dirInfo = new System.IO.DirectoryInfo(The.Workspace.ProjectDirectory); foreach (var fileInfo in fileEnumerator.Enumerate(The.Workspace.GetPlatformSuffix(target.Platform) + ".csproj")) { CsprojSynchronization.SynchronizeProject(fileInfo.Path); } ; if (target.ProjectPath != null) { foreach (var targetCsprojFile in fileEnumerator.Enumerate(Path.GetFileName(target.ProjectPath))) { CsprojSynchronization.SynchronizeProject(targetCsprojFile.Path); } } } } }
private static void SynchronizeAll() { var dontSynchronizeProject = The.Workspace.ProjectJson["DontSynchronizeProject"] as bool?; if (dontSynchronizeProject != null && dontSynchronizeProject.Value) { return; } foreach (var target in The.Workspace.Targets) { var platform = target.Platform; var limeProj = The.Workspace.GetLimeCsprojFilePath(platform); CsprojSynchronization.SynchronizeProject(limeProj); var dirInfo = new System.IO.DirectoryInfo(The.Workspace.ProjectDirectory); foreach (var fileInfo in dirInfo.GetFiles("*" + The.Workspace.GetPlatformSuffix(platform) + ".csproj", SearchOption.AllDirectories)) { CsprojSynchronization.SynchronizeProject(fileInfo.FullName); } if (target.ProjectPath != null) { foreach (var targetCsprojFile in dirInfo.GetFiles(Path.GetFileName(target.ProjectPath), SearchOption.AllDirectories)) { CsprojSynchronization.SynchronizeProject(targetCsprojFile.FullName); } } } }
public void Rescan() { files.Clear(); var dirInfo = new DirectoryInfo(Directory); var queue = new Queue <DirectoryInfo>(); queue.Enqueue(new DirectoryInfo(Directory)); while (queue.Count != 0) { var rootDirectoryInfo = queue.Dequeue(); foreach (var fileInfo in rootDirectoryInfo.EnumerateFiles()) { var file = fileInfo.FullName; if (cutDirectoryPrefix) { file = file.Remove(0, dirInfo.FullName.Length + 1); } file = CsprojSynchronization.ToUnixSlashes(file); files.Add(new FileInfo { Path = file, LastWriteTime = fileInfo.LastWriteTime }); } foreach (var directoryInfo in rootDirectoryInfo.EnumerateDirectories()) { if (scanFilter(directoryInfo)) { queue.Enqueue(directoryInfo); } } } }
public void Rescan() { files.Clear(); var dirInfo = new DirectoryInfo(Directory); foreach (var fileInfo in dirInfo.GetFiles("*.*", SearchOption.AllDirectories)) { var file = fileInfo.FullName; if (file.Contains(".svn")) { continue; } file = file.Remove(0, dirInfo.FullName.Length + 1); file = CsprojSynchronization.ToUnixSlashes(file); files.Add(new FileInfo { Path = file, LastWriteTime = fileInfo.LastWriteTime }); } }
public void Rescan() { files.Clear(); var dirInfo = new DirectoryInfo(Directory); foreach (var fileInfo in dirInfo.GetFiles("*.*", SearchOption.AllDirectories)) { var file = fileInfo.FullName; if (file.Contains(".svn")) { continue; } file = file.Remove(0, dirInfo.FullName.Length + 1); file = CsprojSynchronization.ToUnixSlashes(file); files.Add(new FileInfo { Path = file, LastWriteTime = fileInfo.LastWriteTime }); } // According to documentation the file order is not guaranteed. files.Sort((a, b) => string.Compare(a.Path, b.Path)); }
public static void SaveCodeCookerCache(CodeCookerCache codeCookerCache) { codeCookerCache.GeneratedProjectFileToModificationDate.Clear(); using (new DirectoryChanger(The.Workspace.ProjectDirectory)) { var projectName = The.Workspace.ProjectName; foreach (var platform in Enum.GetValues(typeof(TargetPlatform))) { var platformName = Enum.GetName(typeof(TargetPlatform), platform); var projectPath = $"{projectName}.{The.Workspace.GeneratedScenesPath}/{projectName}.GeneratedScenes.{platformName}.csproj"; if (File.Exists(projectPath)) { CsprojSynchronization.SynchronizeProject(projectPath); codeCookerCache.GeneratedProjectFileToModificationDate.Add(projectPath, File.GetLastWriteTime(projectPath)); } } } var codeCookerCachePath = GetCodeCachePath(); Directory.CreateDirectory(Path.GetDirectoryName(codeCookerCachePath)); using (FileStream stream = new FileStream(codeCookerCachePath, FileMode.Create, FileAccess.Write, FileShare.None)) { var js = new Yuzu.Json.JsonSerializer(); js.ToStream(codeCookerCache, stream); } }