Created
May 19, 2020 19:47
-
-
Save herpdederp/9e61724376006352535b63f1ccd0302c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if false | |
[MenuItem("SERVERBUILD/Server/Modes/Server Mode")] | |
public static void TurnToServerMode() | |
{ | |
ExcludeFiles(true); | |
} | |
[MenuItem("SERVERBUILD/Server/Modes/Client Mode")] | |
public static void TurnToClientMode() | |
{ | |
ExcludeFiles(false); | |
} | |
private static void ExcludeFiles(bool exclude) | |
{ | |
const string ROOT_FOLDER = @"Assets"; | |
var excludeExtensions = new[] { ".png", ".jpg", ".mat", ".shader", ".FBX", ".tga", ".wav", ".tif" }; | |
var directories = Directory.GetDirectories(ROOT_FOLDER, "*", SearchOption.AllDirectories); | |
foreach (var directory in directories) | |
{ | |
var files = Directory.GetFiles(directory); | |
foreach (var file in files) | |
{ | |
var pathExtension = Path.GetExtension(file); | |
if (!excludeExtensions.Contains(Path.GetExtension(file)) || | |
(exclude && file.Contains("~")) || (!exclude && !file.Contains("~"))) continue; // we don't want to exclude these | |
if (exclude) | |
File.Move(file, file.Replace(pathExtension, "") + "~" + pathExtension); | |
else | |
File.Move(file, file.Replace("~", "")); | |
} | |
} | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment