public void ExportMonstersFiles() { var nPath = WorldsEditorTools.ExportFolder(mosnterModFolder, "MonstersMod"); if (string.IsNullOrEmpty(nPath)) { return; } //Remove all metas at path var allfiles = WorldsEditorTools.GetFileInfoFull(nPath); for (int i = 0; i < allfiles.Length; i++) { if (allfiles[i].Extension == ".meta") { FileUtil.DeleteFileOrDirectory(allfiles[i].FullName); } } if (_curMonstersToRemove != null) { for (int i = 0; i < _curMonstersToRemove.MonstersIds.Count; i++) { CreateRemoveAt(nPath, _curMonstersToRemove.MonstersIds[i]); } } Debug.Log("xported To : " + nPath); }
private static List <string> BunddlesInFolder(string mainFolder, bool checkManifest = true) { List <string> curFiles = new List <string>(); var fillFileName = mainFolder + "/"; var objsInfolders = WorldsEditorTools.GetFileInfos(fillFileName); for (int x = 0; x < objsInfolders.Length; x++) { if (objsInfolders[x].Extension == ".meta") { continue; } if (objsInfolders[x].Name == "StreamingAssets" || objsInfolders[x].Name == "StreamingAssets.manifest") { continue; } if (objsInfolders[x].Extension == "") { curFiles.Add(objsInfolders[x].ToString()); } if (checkManifest && objsInfolders[x].Extension == manifestText) { curFiles.Add(objsInfolders[x].ToString()); } } return(curFiles); }
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(); } }