<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TestME
{
    public partial class frmStart : Form
    {
        public frmStart()
        {
            InitializeComponent();
        }

        private void frmStart_Load(object sender, EventArgs e)
        {
            tabMain.SelectTab(1);
            string[] fill=Utilities.loadSettings("StoredSettings",4);
            txthost.Text = fill[0];
            txtuname.Text = fill[1];
            txtpasswd.Text = fill[2];
            txtDatabase.Text = fill[3];
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void btnMin_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start(linkLabel1.Text);
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            Utilities.runInThread(() => {
                
                if (Globals.Connected)
                {
                    //Test Logged User
                    Globals.logUser = new User(1, "demo", "fe01ce2a7fbac8fafaed7c982a04e229", "<EMAIL>");


                    //Load Tags
                    Globals.colTags = Utilities.AsyncDB().column("SELECT DISTINCT nametag FROM tags");

                    //Add also some extra Tags in case db is empty
                    Globals.colTags.Add("TestTag");
                    Globals.colTags.Add("DemoTag");
                    Globals.colTags.Add("UserTag");
                    Globals.colTags.Add("SomeTag");
                    Globals.colTags.Add("SomeTag");

                    this.Hide();
                    new frmMain().Show();
                }
                else
                {
                    Utilities.notifyThem(ntfBox1, "Not connected to DB!", NotificationBox.Type.Warning);
                }
            }).Start();

        }

        private void btnconnect_Click(object sender, EventArgs e)
        {
            Utilities.runInThread(() => {
                Globals.ConnectionStr(txthost.Text, txtuname.Text, txtpasswd.Text, txtDatabase.Text);
                if (Utilities.AsyncDB().Connected())
                {
                    Globals.Connected = true;                   
                }
                if (Globals.Connected)
                {
                    if (checkBoxRemember.Checked)
                    {
                        Utilities.saveSettings("StoredSettings", txthost.Text, txtuname.Text, txtpasswd.Text, txtDatabase.Text);
                    }
                    Utilities.notifyThem(ntfBox3, "Successfully Connected !", NotificationBox.Type.Success);

                }
                else
                {
                    Utilities.notifyThem(ntfBox3, "Could not Connect to the Database.", NotificationBox.Type.Error);
                }
            }).Start();
        }

        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (Globals.Connected)<commit_msg>fixed small issue with login<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace TestME
{
    public partial class frmStart : Form
    {
        public frmStart()
        {
            InitializeComponent();
        }

        private void frmStart_Load(object sender, EventArgs e)
        {
            tabMain.SelectTab(1);
            string[] fill=Utilities.loadSettings("StoredSettings",4);
            txthost.Text = fill[0];
            txtuname.Text = fill[1];
            txtpasswd.Text = fill[2];
            txtDatabase.Text = fill[3];
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void btnMin_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start(linkLabel1.Text);
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Globals.Connected)
            {
                frmStart cFRM = this;

                Utilities.runInThread(() => {            
                    //Test Logged User
                    Globals.logUser = new User(1, "demo", "<PASSWORD>", "<EMAIL>");

                    //Load Tags
                    Globals.colTags = Utilities.AsyncDB().column("SELECT DISTINCT nametag FROM tags");

                    //Add also some extra Tags in case db is empty
                    Globals.colTags.Add("TestTag");
                    Globals.colTags.Add("DemoTag");
                    Globals.colTags.Add("UserTag");
                    Globals.colTags.Add("SomeTag");
                    Globals.colTags.Add("SomeTag");

                    cFRM.Invoke((MethodInvoker)(() =>
                    {
                        cFRM.Hide();
                        new frmMain().Show();
                    }));

                }).Start();
            }
            else
            {
                Utilities.notifyThem(ntfBox1, "Not connected to DB!", NotificationBox.Type.Warning);
            }
        }

        private void btnconnect_Click(object sender, EventArgs e)
        {
            Utilities.runInThread(() => {
                Globals.ConnectionStr(txthost.Text, txtuname.Text, txtpasswd.Text, txtDatabase.Text);
                if (Utilities.AsyncDB().Connected())
                {
                    Globals.Connected = true;                   
                }
                if (Globals.Connected)
                {
                    if (checkBoxRemember.Checked)
                    {
                        Utilities.saveSettings("StoredSettings", txthost.Text, txtuname.Text, txtpasswd.Text, txtDatabase.Text);
                    }
                    Utilities.notifyThem(ntfBox3, "Successfully Connected !", NotificationBox.Type.Success);

                }
                else
                {
                    Utilities.notifyThem(ntfBox3, "Could not Connect to the Database.", NotificationBox.Type.Error);
                }
            }).Start();
        }

        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (Globals.Connected)
{'fraction_non_alphanumeric': 0.0944534353391202, 'fraction_numerical': 0.005884949242312785, 'mean_word_length': 1.427857142857143, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2835486', 'n_tokens_mistral': 1835, 'n_tokens_neox': 1729, 'n_words': 335}