public static void add(string name, ELevelSize size, ELevelType type) { if (!ReadWrite.folderExists("/Maps/" + name)) { ReadWrite.createFolder("/Maps/" + name); Block block = new Block(); block.writeByte(Level.SAVEDATA_VERSION); block.writeSteamID(Provider.client); block.writeByte((byte)size); block.writeByte((byte)type); ReadWrite.writeBlock("/Maps/" + name + "/Level.dat", false, block); ReadWrite.copyFile("/Bundles/Level/Charts.unity3d", "/Maps/" + name + "/Charts.unity3d"); ReadWrite.copyFile("/Bundles/Level/Details.unity3d", "/Maps/" + name + "/Terrain/Details.unity3d"); ReadWrite.copyFile("/Bundles/Level/Details.dat", "/Maps/" + name + "/Terrain/Details.dat"); ReadWrite.copyFile("/Bundles/Level/Materials.unity3d", "/Maps/" + name + "/Terrain/Materials.unity3d"); ReadWrite.copyFile("/Bundles/Level/Materials.dat", "/Maps/" + name + "/Terrain/Materials.dat"); ReadWrite.copyFile("/Bundles/Level/Resources.dat", "/Maps/" + name + "/Terrain/Resources.dat"); ReadWrite.copyFile("/Bundles/Level/Lighting.dat", "/Maps/" + name + "/Environment/Lighting.dat"); ReadWrite.copyFile("/Bundles/Level/Roads.unity3d", "/Maps/" + name + "/Environment/Roads.unity3d"); ReadWrite.copyFile("/Bundles/Level/Roads.dat", "/Maps/" + name + "/Environment/Roads.dat"); ReadWrite.copyFile("/Bundles/Level/Ambience.unity3d", "/Maps/" + name + "/Environment/Ambience.unity3d"); if (Level.onLevelsRefreshed != null) { Level.onLevelsRefreshed(); } } }
// Token: 0x06003A2B RID: 14891 RVA: 0x001BDBC8 File Offset: 0x001BBFC8 public static bool tryGetLanguage(out string local, out string path) { local = string.Empty; path = string.Empty; string[] commandLineArgs = Environment.GetCommandLineArgs(); for (int i = 0; i < commandLineArgs.Length; i++) { if (commandLineArgs[i].Substring(0, 1) == "+") { local = commandLineArgs[i].Substring(1, commandLineArgs[i].Length - 1); if (Provider.provider.workshopService.ugc != null) { for (int j = 0; j < Provider.provider.workshopService.ugc.Count; j++) { SteamContent steamContent = Provider.provider.workshopService.ugc[j]; if (steamContent.type == ESteamUGCType.LOCALIZATION && ReadWrite.folderExists(steamContent.path + "/" + local, false)) { path = steamContent.path + "/"; return(true); } } } if (ReadWrite.folderExists("/Localization/" + local)) { path = ReadWrite.PATH + "/Localization/"; return(true); } } } return(false); }
private static void onClickedTutorialButton(SleekButton button) { if (ReadWrite.folderExists("/Worlds/Singleplayer_" + Characters.selected + "/Level/Tutorial")) { ReadWrite.deleteFolder("/Worlds/Singleplayer_" + Characters.selected + "/Level/Tutorial"); } if (ReadWrite.folderExists(string.Concat(new object[] { "/Worlds/Singleplayer_", Characters.selected, "/Players/", Provider.user, "_", Characters.selected, "/Tutorial" }))) { ReadWrite.deleteFolder(string.Concat(new object[] { "/Worlds/Singleplayer_", Characters.selected, "/Players/", Provider.user, "_", Characters.selected, "/Tutorial" })); } Provider.map = "Tutorial"; Provider.singleplayer(EGameMode.TUTORIAL, false); }
// Token: 0x0600347C RID: 13436 RVA: 0x00159224 File Offset: 0x00157624 public static void export(ushort id, bool isLegacy) { string text = Level.info.path; if (isLegacy) { text += "/Exported_Legacy_Spawn_Tables"; } else { text += "/Exported_Proxy_Spawn_Tables"; } if (ReadWrite.folderExists(text, false)) { ReadWrite.deleteFolder(text, false); } Data data = new Data(); data.writeString("ID", "Spawn"); SpawnTableTool.exportItems(text, data, ref id, isLegacy); SpawnTableTool.exportVehicles(text, data, ref id, isLegacy); SpawnTableTool.exportZombies(text, data, ref id, isLegacy); SpawnTableTool.exportAnimals(text, data, ref id, isLegacy); data.isCSV = true; ReadWrite.writeData(text + "/IDs.csv", false, false, data); }
public static LevelInfo getLevel(string name) { if (ReadWrite.folderExists("/Maps/" + name)) { return Level.getLevel("/Maps/" + name, true); } if (Provider.provider.workshopService.ugc != null) { for (int i = 0; i < Provider.provider.workshopService.ugc.Count; i++) { SteamContent steamContent = Provider.provider.workshopService.ugc[i]; if (steamContent.type == ESteamUGCType.MAP && ReadWrite.folderExists(steamContent.path + "/" + name, false)) { return Level.getLevel(steamContent.path + "/" + name, false); } } } else { string[] folders = ReadWrite.getFolders("/Bundles/Workshop/Maps"); for (int j = 0; j < folders.Length; j++) { if (ReadWrite.folderExists(folders[j] + "/" + name, false)) { return Level.getLevel(folders[j] + "/" + name, false); } } string[] folders2 = ReadWrite.getFolders(ServerSavedata.directory + "/" + Provider.serverID + "/Workshop/Maps"); for (int k = 0; k < folders2.Length; k++) { if (ReadWrite.folderExists(folders2[k] + "/" + name, false)) { return Level.getLevel(folders2[k] + "/" + name, false); } } if (ReadWrite.folderExists(string.Concat(new string[] { ServerSavedata.directory, "/", Provider.serverID, "/Maps/", name }))) { return Level.getLevel(string.Concat(new string[] { ServerSavedata.directory, "/", Provider.serverID, "/Maps/", name }), true); } } return null; }
private static bool checkValid() { if (MenuWorkshopSubmitUI.pathField.text.Length == 0 || !ReadWrite.folderExists(MenuWorkshopSubmitUI.pathField.text, false)) { MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Path")); return(false); } ESteamUGCType state = (ESteamUGCType)MenuWorkshopSubmitUI.typeState.state; bool flag = MenuWorkshopSubmitUI.forState.state == 1; if (flag) { if (state != ESteamUGCType.ITEM && state != ESteamUGCType.SKIN) { MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Curated")); return(false); } } else if (state == ESteamUGCType.SKIN) { MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Curated")); return(false); } bool flag2 = false; if (state == ESteamUGCType.MAP) { flag2 = WorkshopTool.checkMapValid(MenuWorkshopSubmitUI.pathField.text, false); if (!flag2) { MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Map")); } } else if (state == ESteamUGCType.LOCALIZATION) { flag2 = WorkshopTool.checkLocalizationValid(MenuWorkshopSubmitUI.pathField.text, false); if (!flag2) { MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Localization")); } } else if (state == ESteamUGCType.OBJECT || state == ESteamUGCType.ITEM || state == ESteamUGCType.VEHICLE || state == ESteamUGCType.SKIN) { flag2 = WorkshopTool.checkBundleValid(MenuWorkshopSubmitUI.pathField.text, false); if (!flag2) { MenuUI.alert(MenuWorkshopSubmitUI.localization.format("Alert_Object")); } } return(flag2); }
// Token: 0x06003701 RID: 14081 RVA: 0x0017CDF4 File Offset: 0x0017B1F4 private static void onClickedResetButton(SleekButton button) { if (PlaySettings.singleplayerMap == null || PlaySettings.singleplayerMap.Length == 0) { return; } if (ReadWrite.folderExists(string.Concat(new object[] { "/Worlds/Singleplayer_", Characters.selected, "/Level/", PlaySettings.singleplayerMap }))) { ReadWrite.deleteFolder(string.Concat(new object[] { "/Worlds/Singleplayer_", Characters.selected, "/Level/", PlaySettings.singleplayerMap })); } if (ReadWrite.folderExists(string.Concat(new object[] { "/Worlds/Singleplayer_", Characters.selected, "/Players/", Provider.user, "_", Characters.selected, "/", PlaySettings.singleplayerMap }))) { ReadWrite.deleteFolder(string.Concat(new object[] { "/Worlds/Singleplayer_", Characters.selected, "/Players/", Provider.user, "_", Characters.selected, "/", PlaySettings.singleplayerMap })); } }
// Token: 0x06001FF3 RID: 8179 RVA: 0x000B0758 File Offset: 0x000AEB58 public static void deleteFolder(SteamPlayerID playerID) { if (PlayerSavedata.hasSync) { for (byte b = 0; b < Customization.FREE_CHARACTERS + Customization.PRO_CHARACTERS; b += 1) { if (ReadWrite.folderExists(string.Concat(new object[] { "/Sync/", playerID.steamID, "_", playerID.characterID }), false)) { ReadWrite.deleteFolder(string.Concat(new object[] { "/Sync/", playerID.steamID, "_", playerID.characterID }), false); } } } else { for (byte b2 = 0; b2 < Customization.FREE_CHARACTERS + Customization.PRO_CHARACTERS; b2 += 1) { if (ServerSavedata.folderExists(string.Concat(new object[] { "/Players/", playerID.steamID, "_", playerID.characterID }))) { ServerSavedata.deleteFolder(string.Concat(new object[] { "/Players/", playerID.steamID, "_", playerID.characterID })); } } } }
public static bool folderExists(string path) { return(ReadWrite.folderExists(ServerSavedata.directory + "/" + Provider.serverID + path)); }
private static void onItemDownloaded(DownloadItemResult_t callback) { if (DedicatedUGC.installing == null || DedicatedUGC.installing.Count == 0) { return; } if (!DedicatedUGC.installing.Remove(callback.m_nPublishedFileId.m_PublishedFileId)) { return; } if (callback.m_eResult == 1) { CommandWindow.Log("Successfully downloaded workshop item: " + callback.m_nPublishedFileId.m_PublishedFileId); ulong num; string text; uint num2; if (SteamGameServerUGC.GetItemInstallInfo(callback.m_nPublishedFileId, ref num, ref text, 1024u, ref num2) && ReadWrite.folderExists(text, false)) { if (WorkshopTool.checkMapMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.MAP)); if (ReadWrite.folderExists(text + "/Bundles", false)) { Assets.load(text + "/Bundles", false, false, EAssetOrigin.WORKSHOP); } } else if (WorkshopTool.checkLocalizationMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.LOCALIZATION)); } else if (WorkshopTool.checkObjectMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.OBJECT)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkItemMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.ITEM)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } else if (WorkshopTool.checkVehicleMeta(text, false)) { DedicatedUGC.ugc.Add(new SteamContent(callback.m_nPublishedFileId, text, ESteamUGCType.VEHICLE)); Assets.load(text, false, false, EAssetOrigin.WORKSHOP); } if (Directory.Exists(text + "/Translations")) { Translator.registerTranslationDirectory(text + "/Translations"); } if (Directory.Exists(text + "/Content")) { Assets.searchForAndLoadContent(text + "/Content"); } } } else { CommandWindow.Log("Failed downloading workshop item: " + callback.m_nPublishedFileId.m_PublishedFileId); } DedicatedUGC.installNextItem(); }
public static bool folderExists(string path) { return(ReadWrite.folderExists(path, true)); }