Esempio n. 1
0
        private static void CreatePresetsFile()
        {
            // to see directories, view the PATHS.cs file.
            // if Directory in AppData does exist, create it.
            if (!Directory.Exists(Paths.PresetsDir))
            {
                Directory.CreateDirectory(Paths.PresetsDir);
            }

            // you can use List<T> or Dictionary<T, T>
            // If file "Presets.json" does exist, create it.
            if (!File.Exists(Paths.PresetsFileDir))
            {
                List <Presets> PresetsList = new List <Presets>()
                {
                    new Presets("Default", 0, 0, 0)
                };

                //Dictionary<string, Presets> PresetsList = new Dictionary<string, Presets>()
                //{
                //    { "Default", new Presets("Default", 0, 0 ,0) }
                //};

                SerializerControls.Serializer(PresetsList);
            }
        }
Esempio n. 2
0
        // get all presets in the presets.json file.
        private void getAllPresets()
        {
            //Dictionary<string, Presets> PresetsList = SerializerControls.DeserializeDictionary<Presets>();
            List <Presets> PresetsList = SerializerControls.Deserialize <Presets>();

            foreach (var Preset in PresetsList)
            {
                PresetsColor.Items.Add(Preset.Name);
            }

            if (PresetsList[0] != null)
            {
                PresetsColor.SelectedItem = PresetsList[0].Name;
            }
        }
Esempio n. 3
0
        // button to apply Effects
        // Save colors
        private void SaveColorBtn_Click(object sender, EventArgs e)
        {
            PresetNameForm Psf = new PresetNameForm();

            Psf.ShowDialog();

            if (Psf.DialogResult == DialogResult.OK)
            {
                Presets preset = new Presets(Psf.PresetNameBox.Text, R, G, B);
                SerializerControls.AddPreset(Psf.PresetNameBox.Text, preset);
                MessageBox.Show("Preset " + Psf.PresetNameBox.Text + " has been created.", "PRESETS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                PresetsColor.Items.Clear();
                getAllPresets();
            }
        }