Exemple #1
0
        private void PerformSaving(object sender, System.ComponentModel.CancelEventArgs e)
        {
            WebhookSettings settings = new WebhookSettings();

            settings.url                 = WebhookURL.Text;
            settings.content             = WebhookContent.Text;
            settings.custom_name_enabled = Webhook_CustomNameOption.IsChecked.Value;
            settings.custom_name         = Webhook_CustomName.Text;
            System.IO.File.WriteAllText(Environment.GetEnvironmentVariable("APPDATA") + @"\DiscordWebhookControl.config.json", JsonConvert.SerializeObject(settings));
        }
Exemple #2
0
 private void PerformLoad(object sender, EventArgs e)
 {
     try
     {
         var             data     = System.IO.File.ReadAllText(Environment.GetEnvironmentVariable("APPDATA") + @"\DiscordWebhookControl.config.json");
         WebhookSettings settings = JsonConvert.DeserializeObject <WebhookSettings>(data);
         WebhookURL.Text     = settings.url;
         WebhookContent.Text = settings.content;
         Webhook_CustomNameOption.IsChecked = settings.custom_name_enabled;
         Webhook_CustomName.Text            = settings.custom_name;
     } catch (Exception) { }
 }