<commit_before>﻿using System;
using System.Windows.Forms;
using System.Net;
using System.Drawing;
using System.Xml;

namespace RelhaxModpack
{
    public partial class SelectionViewer : Form
    {
        private int x, y;
        private WebClient client = new WebClient();
        private string url = "";
        private string modInfoFile = "";
        private int difference;
        public string SelectedXML = "";
        private string SelectedDocument = "";
        private const int titleBar = 23;//set origionally for 23
        public SelectionViewer(int xx, int yy, string urll)
        {
            InitializeComponent();
            //parse in the new ints location of where to display the application
            x = xx;
            y = yy;
            // modInfoFile = mi;
            url = urll;
        }
        private void SelectionViewer_Load(object sender, EventArgs e)
        {
            this.Location = new Point(x, y);
            //setting UI color
            Settings.setUIColor(this);
            //font scaling
            this.AutoScaleMode = Settings.appScalingMode;
            this.Font = Settings.appFont;
            if (Settings.appScalingMode == System.Windows.Forms.AutoScaleMode.Dpi)
            {
                this.Scale(new SizeF(Settings.scaleSize, Settings.scaleSize));
            }
            //title bar height
            //get the size of the title bar window
            Rectangle screenRektangle = RectangleToScreen(this.ClientRectangle);
            int titleHeight = screenRektangle.Top - this.Top;
            //largest possible is 46
            //mine (programmed for) is 23
            if (titleHeight > titleBar)
            {
                difference = titleHeight - titleBar;
            }
            //this.DialogResult = DialogResult.Cancel;
            SelectConfigLabel.Text = Translations.getTranslatedString("loading");
            SelectButton.Text = Translations.getTranslatedString("select");
            CancelCloseButton.Text = Translations.getTranslatedString("cancel");
            /*
            client.DownloadStringCompleted += Client_DownloadStringCompleted;
            try
            {
                client.DownloadStringAsync(new Uri(url));
            }
            catch (WebException ex)
            {
                Utils.exceptionLog(ex);
            }
            */
            SelectionRadioButton b = new SelectionRadioButton
            {
                XMLURL = "localFile",
                Text = Translations.getTranslatedString("localFile")
            };
            b.Location = new Point(6, (SelectConfigPanel.Controls.Count * b.Size.Height) + 5);
            SelectConfigPanel.Controls.Add(b);
            // XmlDocument doc = new XmlDocument();
            /*
            try
            {

                doc.LoadXml(e.Result);
                SelectConfigLabel.Text = Translations.getTranslatedString(SelectConfigLabel.Name);
            }
            catch
            {

                Utils.exceptionLog(e.Error);
                SelectConfigLabel.Text = Translations.getTranslatedString("error");
            }
            XmlNodeList Selections = doc.SelectNodes("//selections/selection");
            */
            /*
            foreach (XmlNode node in Selections)
            {
                SelectionRadioButton bb = new SelectionRadioButton
                {
                    XMLURL = node.InnerText,
                    Text = node.Attributes[0].InnerText
                };
                bb.Location = new Point(6, (SelectConfigPanel.Controls.Count * b.Size.Height) + 5);
                SelectConfigPanel.Controls.Add(bb);
            }*/
            foreach (var node in Settings.developerSelections)
            {
                SelectionRadioButton bb = new SelectionRadioButton
                {
                    XMLURL = node.internalName,
                    Text = node.displayName
                };
                bb.Location = new Point(6, (SelectConfigPanel.Controls.Count * b.Size.Height) + 5);
                SelectConfigPanel.Controls.Add(bb);
            }
        }

        private void SelectButton_Click(object sender, EventArgs e)
        {
            SelectedDocument = this.getSelectedXMLDoc();
            if(SelectedDocument.Equals("-1"))
            {
                //error
                Utils.appendToLog("ERROR: Failed to parse XML File");
                SelectedXML = SelectedDocument;
            }
            else if (SelectedDocument.Equals("localFile"))
            {
                //local file dialog box
                SelectedXML = SelectedDocument;
                this.DialogResult = DialogResult.OK;
            }
            else<commit_msg>removed unused code at SelectionViewer.cs<commit_after>﻿using System;
using System.Windows.Forms;
using System.Net;
using System.Drawing;
using System.Xml;

namespace RelhaxModpack
{
    public partial class SelectionViewer : Form
    {
        private int x, y;
        private WebClient client = new WebClient();
        private string url = "";
        private int difference;
        public string SelectedXML = "";
        private string SelectedDocument = "";
        private const int titleBar = 23;//set origionally for 23
        public SelectionViewer(int xx, int yy, string urll)
        {
            InitializeComponent();
            //parse in the new ints location of where to display the application
            x = xx;
            y = yy;
            url = urll;
        }
        private void SelectionViewer_Load(object sender, EventArgs e)
        {
            this.Location = new Point(x, y);
            //setting UI color
            Settings.setUIColor(this);
            //font scaling
            this.AutoScaleMode = Settings.appScalingMode;
            this.Font = Settings.appFont;
            if (Settings.appScalingMode == System.Windows.Forms.AutoScaleMode.Dpi)
            {
                this.Scale(new SizeF(Settings.scaleSize, Settings.scaleSize));
            }
            //title bar height
            //get the size of the title bar window
            Rectangle screenRektangle = RectangleToScreen(this.ClientRectangle);
            int titleHeight = screenRektangle.Top - this.Top;
            //largest possible is 46
            //mine (programmed for) is 23
            if (titleHeight > titleBar)
            {
                difference = titleHeight - titleBar;
            }
            //this.DialogResult = DialogResult.Cancel;
            SelectConfigLabel.Text = Translations.getTranslatedString("loading");
            SelectButton.Text = Translations.getTranslatedString("select");
            CancelCloseButton.Text = Translations.getTranslatedString("cancel");

            SelectionRadioButton b = new SelectionRadioButton
            {
                XMLURL = "localFile",
                Text = Translations.getTranslatedString("localFile")
            };
            b.Location = new Point(6, (SelectConfigPanel.Controls.Count * b.Size.Height) + 5);
            SelectConfigPanel.Controls.Add(b);

            foreach (var node in Settings.developerSelections)
            {
                SelectionRadioButton bb = new SelectionRadioButton
                {
                    XMLURL = node.internalName,
                    Text = node.displayName
                };
                bb.Location = new Point(6, (SelectConfigPanel.Controls.Count * b.Size.Height) + 5);
                SelectConfigPanel.Controls.Add(bb);
            }
        }

        private void SelectButton_Click(object sender, EventArgs e)
        {
            SelectedDocument = this.getSelectedXMLDoc();
            if(SelectedDocument.Equals("-1"))
            {
                //error
                Utils.appendToLog("ERROR: Failed to parse XML File");
                SelectedXML = SelectedDocument;
            }
            else if (SelectedDocument.Equals("localFile"))
            {
                //local file dialog box
                SelectedXML = SelectedDocument;
                this.DialogResult = DialogResult.OK;
            }
            else
{'fraction_non_alphanumeric': 0.08235149729995091, 'fraction_numerical': 0.003559155621011291, 'mean_word_length': 1.560967944688875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '800188', 'n_tokens_mistral': 2021, 'n_tokens_neox': 1897, 'n_words': 460}