private void settingsWindow_Load(object sender, EventArgs e)
        {
            var devices = ESPRGB.updateAudioDevices();

            DeviceBox.Items.Clear();
            foreach (var item in devices)
            {
                DeviceBox.Items.Add(item.Key);
            }
            DeviceBox.SelectedItem = (string)ESPRGB.selectedaudioDevices["fullName"];

            byte[] value = startup_explorer.GetValue("ESPRGB-Client") as byte[];

            if (value != null)
            {
                byte[] bytearr = { 02, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 };
                if (value.SequenceEqual(bytearr))
                {
                    startupCheckbox.Checked = true;
                }
                else
                {
                    startupCheckbox.Checked = false;
                }
            }
        }
        private async void saveDevice()
        {
            if (ipAddress.Text == "")
            {
                exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Enter ipaddress");
                exitMessage.StartPosition = FormStartPosition.CenterParent;
                exitMessage.ShowDialog();
                return;
            }
            foreach (var item in ESPRGB._appControls)
            {
                if (item.ipaddress == ipAddress.Text)
                {
                    exceptions exitMessage = new exceptions(0, "ESPRGB-Exception", "Device already exists");
                    exitMessage.StartPosition = FormStartPosition.CenterParent;
                    exitMessage.ShowDialog();
                    return;
                }
            }

            try
            {
                if (ws != null && ws.IsAlive)
                {
                    ws.Close();
                }
                var jsonString = "";
                using (StreamReader file = new StreamReader(ESPRGB.fileLocation.FullName, false)) jsonString = await file.ReadToEndAsync();
                var    dataJson = JObject.Parse(jsonString);
                JArray items    = (JArray)dataJson["Devices"];

                var newData = new JObject();

                string name;
                try
                {
                    name = (ipAddress.Text.Split('-')[1]).Split('.')[0];
                }
                catch
                {
                    name = ipAddress.Text;
                }

                newData.Add("name", name);
                newData.Add("ipaddress", ipAddress.Text);
                newData.Add("syncDevice", false);
                items.Add(newData);

                using (StreamWriter file = new StreamWriter(ESPRGB.fileLocation.FullName, false)) await file.WriteAsync(dataJson.ToString());
                ESPRGB.addThisTab(name, ipAddress.Text);
            }
            catch
            {
            }
        }
 private void DeviceBox_SelectionChangeCommitted(object sender, EventArgs e)
 {
     ESPRGB.InitializeAudioDevice((string)DeviceBox.SelectedItem);
 }