コード例 #1
0
 internal static MoodlightPreset GeneratePreset(string Data)
 {
     string[] array = Data.Split(new char[]
     {
         ','
     });
     if (!MoodlightData.IsValidColor(array[0]))
     {
         array[0] = "#000000";
     }
     return(new MoodlightPreset(array[0], int.Parse(array[1]), CyberEnvironment.EnumToBool(array[2])));
 }
コード例 #2
0
        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;
        }