public static void SetVersusSettingForRomType(RomType romType, VersusSetting versusSetting, byte[] rawSetting) { VersusSettings[romType] = versusSetting; // Construct the local path string localPath = string.Format(VERSUS_SETTING_PATH, romType.ToString()); // Write out the file File.WriteAllBytes(localPath, rawSetting); }
public static async Task HandleVersus(RomType romType, Dictionary <string, byte[]> data, VersusSetting previousSetting, VersusSetting newSetting, byte[] rawFile) { await DiscordBot.LoggingChannel.SendMessageAsync($"**[VS] <@{Configuration.LoadedConfiguration.DiscordConfig.AdministratorIds[0]}> Settings for {romType.ToString()} updated."); }
public static Task HandleVersusSetting(RomType romType, Dictionary <string, byte[]> data, VersusSetting previousSetting, VersusSetting newSetting, byte[] rawFile) { FileCache.SetVersusSettingForRomType(romType, newSetting, rawFile); return(Task.FromResult(0)); }
public static Task HandleVersus(RomType romType, Dictionary <string, byte[]> data, VersusSetting previousSetting, VersusSetting newSetting, byte[] rawFile) { lock (WebFileHandler.Lock) { // Get the WebConfig JelonzoBotWebConfig webConfig = ((JelonzoBotConfiguration)Configuration.LoadedConfiguration).WebConfig; // Connect to the remote server if needed WebFileHandler.Connect(webConfig); // Deserialize the VersusSetting dynamically dynamic settingDynamic = ByamlLoader.GetByamlDynamic(rawFile); // Get the FestivalSetting JSON path string path = webConfig.VersusSettingPath; switch (romType) { case RomType.NorthAmerica: path = string.Format(path, "na"); break; case RomType.Europe: path = string.Format(path, "eu"); break; case RomType.Japan: path = string.Format(path, "jp"); break; default: throw new Exception("Invalid RomType"); } // Upload to the server WebFileHandler.WriteSerializedJson(path, settingDynamic); // Disconnect WebFileHandler.Disconnect(); } return(Task.FromResult(0)); }