public void SaveWired(WiredItem Item) { if (Item == null) { return; } checked { using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { string text = ""; int num = 0; foreach (RoomItem current in Item.Items) { if (num != 0) { text += ";"; } text += current.Id; num++; } if (Item.OtherString == null) { Item.OtherString = ""; } if (Item.OtherExtraString == null) { Item.OtherExtraString = ""; } if (Item.OtherExtraString2 == null) { Item.OtherExtraString2 = ""; } queryreactor.setQuery("REPLACE INTO wired_items VALUES (@id, @items, @delay, @string, @bool, @extrastring, @extrastring2)"); queryreactor.addParameter("id", Item.Item.Id); queryreactor.addParameter("items", text); queryreactor.addParameter("delay", Item.Delay); queryreactor.addParameter("string", Item.OtherString); queryreactor.addParameter("bool", CyberEnvironment.BoolToEnum(Item.OtherBool)); queryreactor.addParameter("extrastring", Item.OtherExtraString); queryreactor.addParameter("extrastring2", Item.OtherExtraString2); queryreactor.runQuery(); } } }
internal void UpdatePreset(int Preset, string Color, int Intensity, bool BgOnly, bool Hax = false) { if (!MoodlightData.IsValidColor(Color) || (!MoodlightData.IsValidIntensity(Intensity) && !Hax)) { return; } string text; switch (Preset) { case 2: text = "two"; goto IL_43; case 3: text = "three"; goto IL_43; } text = "one"; IL_43: using (IQueryAdapter queryreactor = CyberEnvironment.GetDatabaseManager().getQueryReactor()) { queryreactor.setQuery(string.Concat(new object[] { "UPDATE room_items_moodlight SET preset_", text, " = '@color,", Intensity, ",", CyberEnvironment.BoolToEnum(BgOnly), "' WHERE item_id = ", this.ItemId })); queryreactor.addParameter("color", Color); queryreactor.runQuery(); } this.GetPreset(Preset).ColorCode = Color; this.GetPreset(Preset).ColorIntensity = Intensity; this.GetPreset(Preset).BackgroundOnly = BgOnly; }