public static void MoveMonsterBundlesToFolders(string saveFolderName = "MonstersMod") { var thePath = Application.streamingAssetsPath; //Check if folder exists if (!Directory.Exists(thePath)) { return; } var bundleFiles = BunddlesInFolder(thePath); int startToRemove = thePath.Length + 1; for (int i = 0; i < bundleFiles.Count; i++) { var curName = bundleFiles[i].Remove(0, startToRemove); var originalName = curName; if (curName.Contains(manifestText)) { var nLoot = curName.Split("."[0]); curName = nLoot[0]; } var finalNameForFolder = curName; if (curName.Contains("_")) { var charst = finalNameForFolder.ToCharArray(); var nextPos = curName.IndexOf("_"); charst[nextPos + 1] = char.ToUpper(charst[nextPos + 1]); finalNameForFolder = new string(charst); } else { var chars = finalNameForFolder.ToUpperInvariant(); finalNameForFolder = chars; } //Check if folder exists var curContentPath = Application.streamingAssetsPath + "/" + saveFolderName + "/" + finalNameForFolder; var fixContentPath = curContentPath.Replace("\\", "/"); //If not create the folder if (!Directory.Exists(fixContentPath)) { Debug.Log(fixContentPath); Directory.CreateDirectory(fixContentPath); } FileUtil.MoveFileOrDirectory(bundleFiles[i], fixContentPath + "/" + originalName); } Debug.Log("Moved : " + bundleFiles.Count); WorldsEditorTools.RefreshDb(); }
private static void DeleteAllBundlesInMonstersMod() { if (!MosntersFolderExist) { return; } var curFiles = allBundlesFilesIn(mosnterModFolder); if (curFiles.Count > 0) { Debug.Log("Deleting: " + curFiles.Count + " Files"); for (int i = 0; i < curFiles.Count; i++) { FileUtil.DeleteFileOrDirectory(curFiles[i]); } WorldsEditorTools.RefreshDb(); } }