Novetus_src/Novetus/NovetusURI/Forms/QuickConfigure.cs

112 lines
2.6 KiB
C#

/*
* Created by SharpDevelop.
* User: BITL
* Date: 6/13/2017
* Time: 4:16 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
using System.IO;
using System.ComponentModel;
using NovetusLauncher;
namespace NovetusURI
{
/// <summary>
/// Description of QuickConfigure.
/// </summary>
public partial class QuickConfigure : Form
{
public QuickConfigure()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void QuickConfigureLoad(object sender, EventArgs e)
{
ReadConfigValues(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName);
}
void Button3Click(object sender, EventArgs e)
{
GeneratePlayerID();
}
void ReadConfigValues(string cfgpath)
{
GlobalFuncs.Config(cfgpath, false);
textBox2.Text = GlobalVars.UserConfiguration.UserID.ToString();
label3.Text = GlobalVars.UserConfiguration.PlayerTripcode.ToString();
textBox1.Text = GlobalVars.UserConfiguration.PlayerName;
}
void GeneratePlayerID()
{
GlobalFuncs.GeneratePlayerID();
textBox2.Text = GlobalVars.UserConfiguration.UserID.ToString();
}
void TextBox1TextChanged(object sender, EventArgs e)
{
GlobalVars.UserConfiguration.PlayerName = textBox1.Text;
}
void TextBox2TextChanged(object sender, EventArgs e)
{
int parsedValue;
if (int.TryParse(textBox2.Text, out parsedValue))
{
if (textBox2.Text.Equals(""))
{
GlobalVars.UserConfiguration.UserID = 0;
}
else
{
GlobalVars.UserConfiguration.UserID = Convert.ToInt32(textBox2.Text);
}
}
else
{
GlobalVars.UserConfiguration.UserID = 0;
}
}
void Button1Click(object sender, EventArgs e)
{
switch(GlobalVars.UserConfiguration.LauncherStyle)
{
case Settings.UIOptions.Style.Extended:
CharacterCustomizationExtended ccustom = new CharacterCustomizationExtended();
ccustom.Show();
break;
case Settings.UIOptions.Style.Compact:
CharacterCustomizationCompact ccustom2 = new CharacterCustomizationCompact();
ccustom2.Show();
break;
default:
break;
}
}
void Button2Click(object sender, EventArgs e)
{
Close();
}
void QuickConfigureClose(object sender, CancelEventArgs e)
{
GlobalFuncs.Config(GlobalPaths.ConfigDir + "\\" + GlobalPaths.ConfigName, true);
LocalVars.ReadyToLaunch = true;
}
}
}