namespace Holo.Virtual.Users.Items { using Holo; using System; using System.Text; internal class virtualSongEditor { private int machineID; private int[] Slot; private int userID; internal virtualSongEditor(int machineID, int userID) { this.machineID = machineID; this.userID = userID; this.Slot = new int[4]; this.loadSoundsets(); } internal void addSoundset(int soundSetID, int slotID) { this.Slot[slotID - 1] = soundSetID; DB.runQuery(string.Concat(new object[] { "UPDATE furniture SET roomid = '-3',soundmachine_machineid = '", this.machineID, "',soundmachine_slot = '", slotID, "' WHERE ownerid = '", this.userID, "' AND soundmachine_soundset = '", soundSetID, "' ORDER BY id ASC LIMIT 1" })); } internal string getSoundsets() { int i = 0; StringBuilder builder = new StringBuilder(); for (int j = 0; j < 4; j++) { int num3 = this.Slot[j]; if (num3 > 0) { builder.Append(Holo.Encoding.encodeVL64(j + 1) + Holo.Encoding.encodeVL64(num3) + "QB"); int num4 = (num3 * 9) - 8; for (int k = num4; k <= (num4 + 8); k++) { builder.Append(Holo.Encoding.encodeVL64(k)); } i++; } } return ("PA" + Holo.Encoding.encodeVL64(i) + builder.ToString()); } internal void loadSoundsets() { for (int i = 0; i < 4; i++) { this.Slot[i] = DB.runReadUnsafe(string.Concat(new object[] { "SELECT soundmachine_soundset FROM furniture WHERE soundmachine_machineid = '", this.machineID, "' AND soundmachine_slot = '", i + 1, "' ORDER BY id ASC" }), null); } } internal void removeSoundset(int slotID) { this.Slot[slotID - 1] = 0; DB.runQuery(string.Concat(new object[] { "UPDATE furniture SET roomid = '0',soundmachine_machineid = NULL,soundmachine_slot = NULL WHERE ownerid = '", this.userID, "' AND soundmachine_machineid = '", this.machineID, "' AND soundmachine_slot = '", slotID, "' LIMIT 1" })); } internal bool slotFree(int slotID) { return (this.Slot[slotID - 1] == 0); } } }