Initial Commit
This commit is contained in:
292
gui/launcher/CreateVanillaInstance.Designer.cs
generated
Normal file
292
gui/launcher/CreateVanillaInstance.Designer.cs
generated
Normal file
@@ -0,0 +1,292 @@
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
partial class CreateVanillaInstance
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.versionsList = new System.Windows.Forms.ListView();
|
||||
this.mcVer = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.releaseDate = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.releaseType = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.filterLabel = new System.Windows.Forms.Label();
|
||||
this.releasesCheck = new System.Windows.Forms.CheckBox();
|
||||
this.snapshotsCheck = new System.Windows.Forms.CheckBox();
|
||||
this.betasCheck = new System.Windows.Forms.CheckBox();
|
||||
this.alphasCheck = new System.Windows.Forms.CheckBox();
|
||||
this.loaderLabel = new System.Windows.Forms.Label();
|
||||
this.noLoader = new System.Windows.Forms.RadioButton();
|
||||
this.forgeLoader = new System.Windows.Forms.RadioButton();
|
||||
this.fabricLoader = new System.Windows.Forms.RadioButton();
|
||||
this.liteLoader = new System.Windows.Forms.RadioButton();
|
||||
this.nameLabel = new System.Windows.Forms.Label();
|
||||
this.instanceName = new System.Windows.Forms.TextBox();
|
||||
this.createInstance = new System.Windows.Forms.Button();
|
||||
this.loaderVersionLabel = new System.Windows.Forms.Label();
|
||||
this.loaderDropdown = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// versionsList
|
||||
//
|
||||
this.versionsList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.mcVer,
|
||||
this.releaseDate,
|
||||
this.releaseType});
|
||||
this.versionsList.FullRowSelect = true;
|
||||
this.versionsList.HideSelection = false;
|
||||
this.versionsList.Location = new System.Drawing.Point(12, 43);
|
||||
this.versionsList.Name = "versionsList";
|
||||
this.versionsList.Size = new System.Drawing.Size(358, 240);
|
||||
this.versionsList.TabIndex = 0;
|
||||
this.versionsList.UseCompatibleStateImageBehavior = false;
|
||||
this.versionsList.View = System.Windows.Forms.View.Details;
|
||||
this.versionsList.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
|
||||
//
|
||||
// mcVer
|
||||
//
|
||||
this.mcVer.Text = "Version";
|
||||
this.mcVer.Width = 142;
|
||||
//
|
||||
// releaseDate
|
||||
//
|
||||
this.releaseDate.Text = "Released";
|
||||
this.releaseDate.Width = 93;
|
||||
//
|
||||
// releaseType
|
||||
//
|
||||
this.releaseType.Text = "Type";
|
||||
this.releaseType.Width = 103;
|
||||
//
|
||||
// filterLabel
|
||||
//
|
||||
this.filterLabel.AutoSize = true;
|
||||
this.filterLabel.Location = new System.Drawing.Point(388, 43);
|
||||
this.filterLabel.Name = "filterLabel";
|
||||
this.filterLabel.Size = new System.Drawing.Size(29, 13);
|
||||
this.filterLabel.TabIndex = 1;
|
||||
this.filterLabel.Text = "Filter";
|
||||
//
|
||||
// releasesCheck
|
||||
//
|
||||
this.releasesCheck.AutoSize = true;
|
||||
this.releasesCheck.Checked = true;
|
||||
this.releasesCheck.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.releasesCheck.Location = new System.Drawing.Point(391, 63);
|
||||
this.releasesCheck.Name = "releasesCheck";
|
||||
this.releasesCheck.Size = new System.Drawing.Size(70, 17);
|
||||
this.releasesCheck.TabIndex = 2;
|
||||
this.releasesCheck.Text = "Releases";
|
||||
this.releasesCheck.UseVisualStyleBackColor = true;
|
||||
this.releasesCheck.CheckedChanged += new System.EventHandler(this.releasesCheck_CheckedChanged);
|
||||
//
|
||||
// snapshotsCheck
|
||||
//
|
||||
this.snapshotsCheck.AutoSize = true;
|
||||
this.snapshotsCheck.Location = new System.Drawing.Point(391, 86);
|
||||
this.snapshotsCheck.Name = "snapshotsCheck";
|
||||
this.snapshotsCheck.Size = new System.Drawing.Size(76, 17);
|
||||
this.snapshotsCheck.TabIndex = 3;
|
||||
this.snapshotsCheck.Text = "Snapshots";
|
||||
this.snapshotsCheck.UseVisualStyleBackColor = true;
|
||||
this.snapshotsCheck.CheckedChanged += new System.EventHandler(this.snapshotsCheck_CheckedChanged);
|
||||
//
|
||||
// betasCheck
|
||||
//
|
||||
this.betasCheck.AutoSize = true;
|
||||
this.betasCheck.Location = new System.Drawing.Point(391, 109);
|
||||
this.betasCheck.Name = "betasCheck";
|
||||
this.betasCheck.Size = new System.Drawing.Size(53, 17);
|
||||
this.betasCheck.TabIndex = 5;
|
||||
this.betasCheck.Text = "Betas";
|
||||
this.betasCheck.UseVisualStyleBackColor = true;
|
||||
this.betasCheck.CheckedChanged += new System.EventHandler(this.betasCheck_CheckedChanged);
|
||||
//
|
||||
// alphasCheck
|
||||
//
|
||||
this.alphasCheck.AutoSize = true;
|
||||
this.alphasCheck.Location = new System.Drawing.Point(391, 132);
|
||||
this.alphasCheck.Name = "alphasCheck";
|
||||
this.alphasCheck.Size = new System.Drawing.Size(58, 17);
|
||||
this.alphasCheck.TabIndex = 6;
|
||||
this.alphasCheck.Text = "Alphas";
|
||||
this.alphasCheck.UseVisualStyleBackColor = true;
|
||||
this.alphasCheck.CheckedChanged += new System.EventHandler(this.alphasCheck_CheckedChanged);
|
||||
//
|
||||
// loaderLabel
|
||||
//
|
||||
this.loaderLabel.AutoSize = true;
|
||||
this.loaderLabel.Location = new System.Drawing.Point(9, 294);
|
||||
this.loaderLabel.Name = "loaderLabel";
|
||||
this.loaderLabel.Size = new System.Drawing.Size(64, 13);
|
||||
this.loaderLabel.TabIndex = 8;
|
||||
this.loaderLabel.Text = "Mod Loader";
|
||||
//
|
||||
// noLoader
|
||||
//
|
||||
this.noLoader.AutoSize = true;
|
||||
this.noLoader.Checked = true;
|
||||
this.noLoader.Location = new System.Drawing.Point(79, 292);
|
||||
this.noLoader.Name = "noLoader";
|
||||
this.noLoader.Size = new System.Drawing.Size(51, 17);
|
||||
this.noLoader.TabIndex = 13;
|
||||
this.noLoader.TabStop = true;
|
||||
this.noLoader.Text = "None";
|
||||
this.noLoader.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// forgeLoader
|
||||
//
|
||||
this.forgeLoader.AutoSize = true;
|
||||
this.forgeLoader.Location = new System.Drawing.Point(134, 292);
|
||||
this.forgeLoader.Name = "forgeLoader";
|
||||
this.forgeLoader.Size = new System.Drawing.Size(52, 17);
|
||||
this.forgeLoader.TabIndex = 14;
|
||||
this.forgeLoader.Text = "Forge";
|
||||
this.forgeLoader.UseVisualStyleBackColor = true;
|
||||
this.forgeLoader.CheckedChanged += new System.EventHandler(this.forgeLoader_CheckedChanged);
|
||||
//
|
||||
// fabricLoader
|
||||
//
|
||||
this.fabricLoader.AutoSize = true;
|
||||
this.fabricLoader.Enabled = false;
|
||||
this.fabricLoader.Location = new System.Drawing.Point(192, 292);
|
||||
this.fabricLoader.Name = "fabricLoader";
|
||||
this.fabricLoader.Size = new System.Drawing.Size(54, 17);
|
||||
this.fabricLoader.TabIndex = 15;
|
||||
this.fabricLoader.Text = "Fabric";
|
||||
this.fabricLoader.UseVisualStyleBackColor = true;
|
||||
this.fabricLoader.CheckedChanged += new System.EventHandler(this.fabricLoader_CheckedChanged);
|
||||
//
|
||||
// liteLoader
|
||||
//
|
||||
this.liteLoader.AutoSize = true;
|
||||
this.liteLoader.Enabled = false;
|
||||
this.liteLoader.Location = new System.Drawing.Point(252, 292);
|
||||
this.liteLoader.Name = "liteLoader";
|
||||
this.liteLoader.Size = new System.Drawing.Size(78, 17);
|
||||
this.liteLoader.TabIndex = 16;
|
||||
this.liteLoader.Text = "Lite Loader";
|
||||
this.liteLoader.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Location = new System.Drawing.Point(12, 16);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(38, 13);
|
||||
this.nameLabel.TabIndex = 18;
|
||||
this.nameLabel.Text = "Name:";
|
||||
//
|
||||
// instanceName
|
||||
//
|
||||
this.instanceName.Location = new System.Drawing.Point(56, 13);
|
||||
this.instanceName.Name = "instanceName";
|
||||
this.instanceName.Size = new System.Drawing.Size(314, 20);
|
||||
this.instanceName.TabIndex = 19;
|
||||
//
|
||||
// createInstance
|
||||
//
|
||||
this.createInstance.Location = new System.Drawing.Point(391, 317);
|
||||
this.createInstance.Name = "createInstance";
|
||||
this.createInstance.Size = new System.Drawing.Size(75, 23);
|
||||
this.createInstance.TabIndex = 20;
|
||||
this.createInstance.Text = "Create";
|
||||
this.createInstance.UseVisualStyleBackColor = true;
|
||||
this.createInstance.Click += new System.EventHandler(this.createInstance_Click);
|
||||
//
|
||||
// loaderVersionLabel
|
||||
//
|
||||
this.loaderVersionLabel.AutoSize = true;
|
||||
this.loaderVersionLabel.Location = new System.Drawing.Point(9, 322);
|
||||
this.loaderVersionLabel.Name = "loaderVersionLabel";
|
||||
this.loaderVersionLabel.Size = new System.Drawing.Size(81, 13);
|
||||
this.loaderVersionLabel.TabIndex = 21;
|
||||
this.loaderVersionLabel.Text = "Loader Version:";
|
||||
//
|
||||
// loaderDropdown
|
||||
//
|
||||
this.loaderDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.loaderDropdown.FormattingEnabled = true;
|
||||
this.loaderDropdown.Location = new System.Drawing.Point(96, 319);
|
||||
this.loaderDropdown.Name = "loaderDropdown";
|
||||
this.loaderDropdown.Size = new System.Drawing.Size(274, 21);
|
||||
this.loaderDropdown.TabIndex = 22;
|
||||
//
|
||||
// CreateVanillaInstance
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(497, 351);
|
||||
this.Controls.Add(this.loaderDropdown);
|
||||
this.Controls.Add(this.loaderVersionLabel);
|
||||
this.Controls.Add(this.createInstance);
|
||||
this.Controls.Add(this.instanceName);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.liteLoader);
|
||||
this.Controls.Add(this.fabricLoader);
|
||||
this.Controls.Add(this.forgeLoader);
|
||||
this.Controls.Add(this.noLoader);
|
||||
this.Controls.Add(this.loaderLabel);
|
||||
this.Controls.Add(this.alphasCheck);
|
||||
this.Controls.Add(this.betasCheck);
|
||||
this.Controls.Add(this.snapshotsCheck);
|
||||
this.Controls.Add(this.releasesCheck);
|
||||
this.Controls.Add(this.filterLabel);
|
||||
this.Controls.Add(this.versionsList);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CreateVanillaInstance";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Create Instance";
|
||||
this.Load += new System.EventHandler(this.CreateVanillaInstance_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ListView versionsList;
|
||||
private System.Windows.Forms.ColumnHeader mcVer;
|
||||
private System.Windows.Forms.ColumnHeader releaseDate;
|
||||
private System.Windows.Forms.ColumnHeader releaseType;
|
||||
private System.Windows.Forms.Label filterLabel;
|
||||
private System.Windows.Forms.CheckBox releasesCheck;
|
||||
private System.Windows.Forms.CheckBox snapshotsCheck;
|
||||
private System.Windows.Forms.CheckBox betasCheck;
|
||||
private System.Windows.Forms.CheckBox alphasCheck;
|
||||
private System.Windows.Forms.Label loaderLabel;
|
||||
private System.Windows.Forms.RadioButton noLoader;
|
||||
private System.Windows.Forms.RadioButton forgeLoader;
|
||||
private System.Windows.Forms.RadioButton fabricLoader;
|
||||
private System.Windows.Forms.RadioButton liteLoader;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.TextBox instanceName;
|
||||
private System.Windows.Forms.Button createInstance;
|
||||
private System.Windows.Forms.Label loaderVersionLabel;
|
||||
private System.Windows.Forms.ComboBox loaderDropdown;
|
||||
}
|
||||
}
|
||||
262
gui/launcher/CreateVanillaInstance.cs
Normal file
262
gui/launcher/CreateVanillaInstance.cs
Normal file
@@ -0,0 +1,262 @@
|
||||
using CmlLib.Core;
|
||||
using CmlLib.Core.Installer.FabricMC;
|
||||
using CmlLib.Core.Installer.Forge.Versions;
|
||||
using CmlLib.Core.Version;
|
||||
using CmlLib.Core.VersionLoader;
|
||||
using CmlLib.Core.VersionMetadata;
|
||||
using Semver;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using WolfLauncher.core;
|
||||
using WolfLauncher.model;
|
||||
|
||||
/**
|
||||
* Author: HypherionSA
|
||||
* Instance Creation dialog
|
||||
**/
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
public partial class CreateVanillaInstance : Form
|
||||
{
|
||||
// Set launcher instance
|
||||
private Launcher launcher = Launcher.INSTANCE;
|
||||
private CMLauncher l;
|
||||
|
||||
// Cache
|
||||
private List<ListViewItem> items = new List<ListViewItem>();
|
||||
private ListViewItem lastItem;
|
||||
|
||||
// First MC version that supports fabric
|
||||
private SemVersion fabricLowest = SemVersion.Parse("1.14.2");
|
||||
|
||||
public CreateVanillaInstance()
|
||||
{
|
||||
InitializeComponent();
|
||||
l = launcher.getCMLauncher();
|
||||
l.VersionLoader = new MojangVersionLoader();
|
||||
|
||||
this.Text = String.Format("{0} - {1} - {2}", "Create Instance", LauncherConstants.LauncherName, LauncherConstants.Version);
|
||||
}
|
||||
|
||||
private async void CreateVanillaInstance_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Get game versions
|
||||
MVersionCollection versions = await l.GetAllVersionsAsync();
|
||||
versionsList.Items.Clear();
|
||||
|
||||
// Load Versions into list
|
||||
foreach(MVersionMetadata meta in versions)
|
||||
{
|
||||
ListViewItem itm = new ListViewItem(meta.Name);
|
||||
itm.SubItems.Add(meta.ReleaseTimeStr);
|
||||
itm.SubItems.Add(meta.Type);
|
||||
versionsList.Items.Add(itm);
|
||||
items.Add(itm);
|
||||
}
|
||||
|
||||
// Apply version filtering
|
||||
sortItems();
|
||||
}
|
||||
|
||||
private void sortItems()
|
||||
{
|
||||
// Clear List
|
||||
versionsList.Items.Clear();
|
||||
|
||||
foreach (ListViewItem itm in items)
|
||||
{
|
||||
// Release Version
|
||||
if (itm.SubItems[2].Text.Equals("release") && releasesCheck.Checked)
|
||||
versionsList.Items.Add(itm);
|
||||
|
||||
// Snapshot Version
|
||||
if (itm.SubItems[2].Text.Equals("snapshot") && snapshotsCheck.Checked)
|
||||
versionsList.Items.Add(itm);
|
||||
|
||||
// Beta Version
|
||||
if (itm.SubItems[2].Text.Equals("old_beta") && betasCheck.Checked)
|
||||
versionsList.Items.Add(itm);
|
||||
|
||||
// Alpha version
|
||||
if (itm.SubItems[2].Text.Equals("old_alpha") && alphasCheck.Checked)
|
||||
versionsList.Items.Add(itm);
|
||||
}
|
||||
|
||||
// Select first item in list
|
||||
if (versionsList.Items.Count > 0)
|
||||
versionsList.Items[0].Selected = true;
|
||||
}
|
||||
|
||||
private void releasesCheck_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Apply Filter
|
||||
sortItems();
|
||||
}
|
||||
|
||||
private void snapshotsCheck_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Apply Filter
|
||||
sortItems();
|
||||
}
|
||||
|
||||
private void betasCheck_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Apply Filter
|
||||
sortItems();
|
||||
}
|
||||
|
||||
private void alphasCheck_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Apply Filter
|
||||
sortItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* Selected version changed. Update Loaders list if needed
|
||||
**/
|
||||
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (versionsList.SelectedItems.Count > 0)
|
||||
{
|
||||
// Refresh Forge
|
||||
if (forgeLoader.Checked)
|
||||
loadForge();
|
||||
|
||||
// Refresh Fabric
|
||||
if (fabricLoader.Enabled && fabricLoader.Checked)
|
||||
loadFabric();
|
||||
|
||||
// Update instance name, if the user didn't change it
|
||||
ListViewItem sel = versionsList.SelectedItems[0];
|
||||
if (lastItem == null || instanceName.Text == lastItem.Text || String.IsNullOrEmpty(instanceName.Text))
|
||||
{
|
||||
instanceName.Text = sel.Text;
|
||||
lastItem = sel;
|
||||
}
|
||||
|
||||
// Load fabric versions if available
|
||||
try
|
||||
{
|
||||
SemVersion currentVer = SemVersion.Parse(sel.Text);
|
||||
fabricLoader.Enabled = currentVer.ComparePrecedenceTo(fabricLowest) >= 0;
|
||||
} catch
|
||||
{
|
||||
fabricLoader.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and Filter forge versions
|
||||
**/
|
||||
private async void loadForge()
|
||||
{
|
||||
// Clear dropdown
|
||||
loaderDropdown.Items.Clear();
|
||||
|
||||
try
|
||||
{
|
||||
// Load Forge Versions for selected minecraft version
|
||||
var forgeLoader = new ForgeVersionLoader(new System.Net.Http.HttpClient());
|
||||
var versions = await forgeLoader.GetForgeVersions(versionsList.SelectedItems[0].Text);
|
||||
var recommended = versions.First(v => v.IsRecommendedVersion);
|
||||
|
||||
foreach (var version in versions)
|
||||
{
|
||||
// Mark item as recommended if it is
|
||||
String ver = version.ForgeVersionName;
|
||||
if (recommended != null && version.ForgeVersionName == recommended.ForgeVersionName)
|
||||
ver += " (Recommended)";
|
||||
|
||||
// Add item to dropdown
|
||||
loaderDropdown.Items.Add(ver);
|
||||
}
|
||||
|
||||
} catch { }
|
||||
}
|
||||
|
||||
/**
|
||||
* Load Fabric Versions
|
||||
**/
|
||||
private async void loadFabric()
|
||||
{
|
||||
// Clear dropdown
|
||||
loaderDropdown.Items.Clear();
|
||||
|
||||
// Load Fabric Versions
|
||||
var fabricLoader = new FabricVersionLoader();
|
||||
var fabricVersions = await fabricLoader.GetVersionMetadatasAsync();
|
||||
|
||||
foreach (var v in fabricVersions)
|
||||
{
|
||||
// Add item to dropdown
|
||||
loaderDropdown.Items.Add(v.Name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forge radio checked, so we refresh forge
|
||||
**/
|
||||
private void forgeLoader_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (forgeLoader.Checked)
|
||||
loadForge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up instance meta data ready to be written to the disk
|
||||
**/
|
||||
private void createInstance_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Create new instance manifest
|
||||
Instance instance = new Instance();
|
||||
|
||||
// Set game version for instance
|
||||
instance.gameVersion = versionsList.SelectedItems[0].Text;
|
||||
// Set instance name
|
||||
instance.name = instanceName.Text;
|
||||
|
||||
// Local install. This instance will be ignored from update checkers
|
||||
instance.localInstall = true;
|
||||
|
||||
// Check if a mod loader should be installed
|
||||
if (loaderDropdown.Items.Count > 0 && loaderDropdown.SelectedItem != null)
|
||||
{
|
||||
// Loader is forge
|
||||
if (forgeLoader.Checked)
|
||||
instance.loader = "forge:" + loaderDropdown.SelectedItem.ToString().Replace(" (Recommended)", "");
|
||||
|
||||
// Loader is fabric
|
||||
if (fabricLoader.Checked)
|
||||
instance.loader = "fabric:" + loaderDropdown.SelectedItem.ToString();
|
||||
}
|
||||
|
||||
// Set default settings for instance
|
||||
instance.settings = new Instance.Settings
|
||||
{
|
||||
maxRam = 2024,
|
||||
minRam = 512,
|
||||
screenHeight = "auto",
|
||||
screenWidth = "auto",
|
||||
javaPath = "",
|
||||
javaArgs = ""
|
||||
};
|
||||
|
||||
// Persist to disk
|
||||
var s = launcher.install(instance);
|
||||
|
||||
// Close the window if the instance was created
|
||||
if (s)
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void fabricLoader_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Fabric selected, load fabric versions
|
||||
if (fabricLoader.Checked)
|
||||
loadFabric();
|
||||
}
|
||||
}
|
||||
}
|
||||
120
gui/launcher/CreateVanillaInstance.resx
Normal file
120
gui/launcher/CreateVanillaInstance.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
85
gui/launcher/InstallerForm.Designer.cs
generated
Normal file
85
gui/launcher/InstallerForm.Designer.cs
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
partial class InstallerForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.downloadLabel = new System.Windows.Forms.Label();
|
||||
this.dlProgressbar = new System.Windows.Forms.ProgressBar();
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// downloadLabel
|
||||
//
|
||||
this.downloadLabel.AutoEllipsis = true;
|
||||
this.downloadLabel.Location = new System.Drawing.Point(9, 9);
|
||||
this.downloadLabel.Name = "downloadLabel";
|
||||
this.downloadLabel.Size = new System.Drawing.Size(373, 20);
|
||||
this.downloadLabel.TabIndex = 1;
|
||||
this.downloadLabel.Text = "Downloading 0/0 files";
|
||||
this.downloadLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// dlProgressbar
|
||||
//
|
||||
this.dlProgressbar.Location = new System.Drawing.Point(12, 32);
|
||||
this.dlProgressbar.Name = "dlProgressbar";
|
||||
this.dlProgressbar.Size = new System.Drawing.Size(370, 23);
|
||||
this.dlProgressbar.TabIndex = 2;
|
||||
//
|
||||
// backgroundWorker1
|
||||
//
|
||||
this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
|
||||
this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
|
||||
//
|
||||
// InstallerForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(396, 70);
|
||||
this.Controls.Add(this.dlProgressbar);
|
||||
this.Controls.Add(this.downloadLabel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "InstallerForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Installing Instance";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.InstallerForm_FormClosing);
|
||||
this.Load += new System.EventHandler(this.InstallerForm_Load);
|
||||
this.Shown += new System.EventHandler(this.InstallerForm_Shown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Label downloadLabel;
|
||||
private System.Windows.Forms.ProgressBar dlProgressbar;
|
||||
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||
private System.ComponentModel.BackgroundWorker backgroundWorker2;
|
||||
}
|
||||
}
|
||||
137
gui/launcher/InstallerForm.cs
Normal file
137
gui/launcher/InstallerForm.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using CmlLib.Core;
|
||||
using CmlLib.Core.Downloader;
|
||||
using CmlLib.Core.Files;
|
||||
using CmlLib.Core.Installer.FabricMC;
|
||||
using CmlLib.Core.Installer.Forge;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using WolfLauncher.core;
|
||||
using WolfLauncher.model;
|
||||
|
||||
/**
|
||||
* Author: HypherionSA
|
||||
* Instance Installer/Verifier
|
||||
**/
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
public partial class InstallerForm : Form
|
||||
{
|
||||
// References to Launcher instance
|
||||
private Launcher launcer = Launcher.INSTANCE;
|
||||
private Instance i;
|
||||
private CMLauncher l;
|
||||
|
||||
public InstallerForm(Instance instance)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Setup Variables
|
||||
i = instance;
|
||||
l = launcer.getCMLauncher();
|
||||
Control.CheckForIllegalCrossThreadCalls = false;
|
||||
|
||||
this.Text = String.Format("{0} - {1} - {2}", "Preparing " + instance.name, LauncherConstants.LauncherName, LauncherConstants.Version);
|
||||
}
|
||||
|
||||
private void InstallerForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Register Event Listeners
|
||||
l.FileChanged += downloadFileChanged;
|
||||
l.ProgressChanged += downloadProgress;
|
||||
}
|
||||
|
||||
private void downloadProgress(object sender, ProgressChangedEventArgs e)
|
||||
{
|
||||
// Update Progress Bar
|
||||
dlProgressbar.Value = e.ProgressPercentage;
|
||||
}
|
||||
|
||||
private void downloadFileChanged(DownloadFileChangedEventArgs e)
|
||||
{
|
||||
// Verification, so we ignore
|
||||
if (e.Source is IFileChecker)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
// Update progress label
|
||||
downloadLabel.Text = "Downloading " + e.FileKind.ToString() + " - " + e.ProgressedFileCount + "/" + e.TotalFileCount + " files";
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void InstallerForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
// Start Installation/Verifaction Process
|
||||
if (!backgroundWorker1.IsBusy)
|
||||
backgroundWorker1.RunWorkerAsync();
|
||||
}
|
||||
|
||||
private async void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
// Check if we should install a loader
|
||||
if (i.loader != null && i.loader != "none")
|
||||
{
|
||||
|
||||
// Instance requires forge
|
||||
if (i.loader.Contains("forge:"))
|
||||
{
|
||||
// Parse forge version from manifest
|
||||
var loader = i.loader.Replace("forge:", "");
|
||||
LauncherLogger.INSTANCE.addLog("Installing Forge " + loader);
|
||||
|
||||
// Install Forge
|
||||
var forge = new MForge(l);
|
||||
forge.ProgressChanged += downloadProgress;
|
||||
forge.FileChanged += downloadFileChanged;
|
||||
forge.Install(i.gameVersion, loader).Wait();
|
||||
l.GetAllVersions();
|
||||
}
|
||||
|
||||
// Instance requires Fabric
|
||||
if (i.loader.Contains("fabric:"))
|
||||
{
|
||||
// Parse fabric version from manifest
|
||||
var loader = i.loader.Replace("fabric:", "");
|
||||
LauncherLogger.INSTANCE.addLog("Installing Fabric " + loader);
|
||||
|
||||
// Install Fabric
|
||||
var fabricLoader = new FabricVersionLoader();
|
||||
var fabricV = await fabricLoader.GetVersionMetadatasAsync();
|
||||
var fabric = fabricV.GetVersionMetadata(loader);
|
||||
fabric.Save(l.MinecraftPath);
|
||||
|
||||
// Vanilla Install
|
||||
l.CheckAndDownload(l.GetVersion(i.gameVersion));
|
||||
l.GetAllVersions();
|
||||
}
|
||||
} else
|
||||
{
|
||||
// Vanilla Install
|
||||
l.CheckAndDownload(l.GetVersion(i.gameVersion));
|
||||
l.GetAllVersions();
|
||||
}
|
||||
}
|
||||
|
||||
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
// Progress is finished, so we remove listeners
|
||||
l.FileChanged -= downloadFileChanged;
|
||||
l.ProgressChanged -= downloadProgress;
|
||||
|
||||
// Wait for all threads to shut down and close the dialog
|
||||
Thread.Sleep(1000);
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void InstallerForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
// Worker is busy, so form cannot be closed
|
||||
if (backgroundWorker1.IsBusy)
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
126
gui/launcher/InstallerForm.resx
Normal file
126
gui/launcher/InstallerForm.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="backgroundWorker2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>181, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
191
gui/launcher/InstanceSettings.Designer.cs
generated
Normal file
191
gui/launcher/InstanceSettings.Designer.cs
generated
Normal file
@@ -0,0 +1,191 @@
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
partial class InstanceSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.maxRamLabel = new System.Windows.Forms.Label();
|
||||
this.minRamLabel = new System.Windows.Forms.Label();
|
||||
this.maxRam = new System.Windows.Forms.NumericUpDown();
|
||||
this.minRam = new System.Windows.Forms.NumericUpDown();
|
||||
this.javaArgsLabel = new System.Windows.Forms.Label();
|
||||
this.jvmArgs = new System.Windows.Forms.TextBox();
|
||||
this.screenHeightLabel = new System.Windows.Forms.Label();
|
||||
this.screenWidthLabel = new System.Windows.Forms.Label();
|
||||
this.screenWidth = new System.Windows.Forms.TextBox();
|
||||
this.screenHeight = new System.Windows.Forms.TextBox();
|
||||
this.saveSettings = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxRam)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.minRam)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// maxRamLabel
|
||||
//
|
||||
this.maxRamLabel.AutoSize = true;
|
||||
this.maxRamLabel.Location = new System.Drawing.Point(12, 9);
|
||||
this.maxRamLabel.Name = "maxRamLabel";
|
||||
this.maxRamLabel.Size = new System.Drawing.Size(80, 13);
|
||||
this.maxRamLabel.TabIndex = 0;
|
||||
this.maxRamLabel.Text = "Max Ram (MB):";
|
||||
//
|
||||
// minRamLabel
|
||||
//
|
||||
this.minRamLabel.AutoSize = true;
|
||||
this.minRamLabel.Location = new System.Drawing.Point(12, 37);
|
||||
this.minRamLabel.Name = "minRamLabel";
|
||||
this.minRamLabel.Size = new System.Drawing.Size(77, 13);
|
||||
this.minRamLabel.TabIndex = 1;
|
||||
this.minRamLabel.Text = "Min Ram (MB):";
|
||||
//
|
||||
// maxRam
|
||||
//
|
||||
this.maxRam.Increment = new decimal(new int[] {
|
||||
512,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.maxRam.Location = new System.Drawing.Point(106, 7);
|
||||
this.maxRam.Name = "maxRam";
|
||||
this.maxRam.Size = new System.Drawing.Size(120, 20);
|
||||
this.maxRam.TabIndex = 2;
|
||||
//
|
||||
// minRam
|
||||
//
|
||||
this.minRam.Increment = new decimal(new int[] {
|
||||
512,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.minRam.Location = new System.Drawing.Point(106, 35);
|
||||
this.minRam.Name = "minRam";
|
||||
this.minRam.Size = new System.Drawing.Size(120, 20);
|
||||
this.minRam.TabIndex = 3;
|
||||
//
|
||||
// javaArgsLabel
|
||||
//
|
||||
this.javaArgsLabel.AutoSize = true;
|
||||
this.javaArgsLabel.Location = new System.Drawing.Point(12, 62);
|
||||
this.javaArgsLabel.Name = "javaArgsLabel";
|
||||
this.javaArgsLabel.Size = new System.Drawing.Size(57, 13);
|
||||
this.javaArgsLabel.TabIndex = 4;
|
||||
this.javaArgsLabel.Text = "Java Args:";
|
||||
//
|
||||
// jvmArgs
|
||||
//
|
||||
this.jvmArgs.Location = new System.Drawing.Point(106, 61);
|
||||
this.jvmArgs.Multiline = true;
|
||||
this.jvmArgs.Name = "jvmArgs";
|
||||
this.jvmArgs.Size = new System.Drawing.Size(330, 195);
|
||||
this.jvmArgs.TabIndex = 5;
|
||||
//
|
||||
// screenHeightLabel
|
||||
//
|
||||
this.screenHeightLabel.AutoSize = true;
|
||||
this.screenHeightLabel.Location = new System.Drawing.Point(12, 294);
|
||||
this.screenHeightLabel.Name = "screenHeightLabel";
|
||||
this.screenHeightLabel.Size = new System.Drawing.Size(78, 13);
|
||||
this.screenHeightLabel.TabIndex = 7;
|
||||
this.screenHeightLabel.Text = "Screen Height:";
|
||||
//
|
||||
// screenWidthLabel
|
||||
//
|
||||
this.screenWidthLabel.AutoSize = true;
|
||||
this.screenWidthLabel.Location = new System.Drawing.Point(12, 266);
|
||||
this.screenWidthLabel.Name = "screenWidthLabel";
|
||||
this.screenWidthLabel.Size = new System.Drawing.Size(75, 13);
|
||||
this.screenWidthLabel.TabIndex = 6;
|
||||
this.screenWidthLabel.Text = "Screen Width:";
|
||||
//
|
||||
// screenWidth
|
||||
//
|
||||
this.screenWidth.Location = new System.Drawing.Point(106, 263);
|
||||
this.screenWidth.Name = "screenWidth";
|
||||
this.screenWidth.Size = new System.Drawing.Size(120, 20);
|
||||
this.screenWidth.TabIndex = 8;
|
||||
//
|
||||
// screenHeight
|
||||
//
|
||||
this.screenHeight.Location = new System.Drawing.Point(106, 291);
|
||||
this.screenHeight.Name = "screenHeight";
|
||||
this.screenHeight.Size = new System.Drawing.Size(120, 20);
|
||||
this.screenHeight.TabIndex = 9;
|
||||
//
|
||||
// saveSettings
|
||||
//
|
||||
this.saveSettings.Location = new System.Drawing.Point(361, 288);
|
||||
this.saveSettings.Name = "saveSettings";
|
||||
this.saveSettings.Size = new System.Drawing.Size(75, 23);
|
||||
this.saveSettings.TabIndex = 10;
|
||||
this.saveSettings.Text = "Save";
|
||||
this.saveSettings.UseVisualStyleBackColor = true;
|
||||
this.saveSettings.Click += new System.EventHandler(this.saveSettings_Click);
|
||||
//
|
||||
// InstanceSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(449, 324);
|
||||
this.Controls.Add(this.saveSettings);
|
||||
this.Controls.Add(this.screenHeight);
|
||||
this.Controls.Add(this.screenWidth);
|
||||
this.Controls.Add(this.screenHeightLabel);
|
||||
this.Controls.Add(this.screenWidthLabel);
|
||||
this.Controls.Add(this.jvmArgs);
|
||||
this.Controls.Add(this.javaArgsLabel);
|
||||
this.Controls.Add(this.minRam);
|
||||
this.Controls.Add(this.maxRam);
|
||||
this.Controls.Add(this.minRamLabel);
|
||||
this.Controls.Add(this.maxRamLabel);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "InstanceSettings";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Instance Settings";
|
||||
this.Load += new System.EventHandler(this.InstanceSettings_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.maxRam)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.minRam)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label maxRamLabel;
|
||||
private System.Windows.Forms.Label minRamLabel;
|
||||
private System.Windows.Forms.NumericUpDown maxRam;
|
||||
private System.Windows.Forms.NumericUpDown minRam;
|
||||
private System.Windows.Forms.Label javaArgsLabel;
|
||||
private System.Windows.Forms.TextBox jvmArgs;
|
||||
private System.Windows.Forms.Label screenHeightLabel;
|
||||
private System.Windows.Forms.Label screenWidthLabel;
|
||||
private System.Windows.Forms.TextBox screenWidth;
|
||||
private System.Windows.Forms.TextBox screenHeight;
|
||||
private System.Windows.Forms.Button saveSettings;
|
||||
}
|
||||
}
|
||||
77
gui/launcher/InstanceSettings.cs
Normal file
77
gui/launcher/InstanceSettings.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using WolfLauncher.core;
|
||||
using WolfLauncher.model;
|
||||
|
||||
/**
|
||||
* Author: HypherionSA
|
||||
* Instance settings dialog like Ram, JVM args, Screensize etc
|
||||
**/
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
public partial class InstanceSettings : Form
|
||||
{
|
||||
// Reference to launcher instance
|
||||
private Instance instance;
|
||||
|
||||
public InstanceSettings(Instance ins)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
instance = ins;
|
||||
this.Text = String.Format("{0} - {1} - {2}", "Settings for " + ins.name, LauncherConstants.LauncherName, LauncherConstants.Version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read instance settings from manifest
|
||||
**/
|
||||
private void InstanceSettings_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Get system information
|
||||
var i = new Microsoft.VisualBasic.Devices.ComputerInfo();
|
||||
|
||||
// Set max ram values. Adds in a buffer so you still have memory left for the OS
|
||||
maxRam.Maximum = i.TotalPhysicalMemory / (1024 * 1024) - 1024;
|
||||
minRam.Maximum = maxRam.Maximum / 2;
|
||||
|
||||
// Check if instance has settings, otherwise apply defaults
|
||||
if (instance.settings == null)
|
||||
{
|
||||
instance.settings = new Instance.Settings
|
||||
{
|
||||
maxRam = 2024,
|
||||
minRam = 512,
|
||||
screenHeight = "auto",
|
||||
screenWidth = "auto",
|
||||
javaPath = "",
|
||||
javaArgs = ""
|
||||
};
|
||||
}
|
||||
|
||||
// Set values from manifest
|
||||
maxRam.Value = instance.settings.maxRam;
|
||||
minRam.Value = instance.settings.minRam;
|
||||
jvmArgs.Text = instance.settings.javaArgs;
|
||||
screenWidth.Text = instance.settings.screenWidth;
|
||||
screenHeight.Text = instance.settings.screenHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Persist Settings to instance manifest
|
||||
**/
|
||||
private void saveSettings_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Add values to manifest
|
||||
instance.settings.maxRam = (int)maxRam.Value;
|
||||
instance.settings.minRam = (int)minRam.Value;
|
||||
instance.settings.javaArgs = jvmArgs.Text;
|
||||
instance.settings.screenWidth = screenWidth.Text;
|
||||
instance.settings.screenHeight = screenHeight.Text;
|
||||
|
||||
// Save Settings
|
||||
Launcher.INSTANCE.updateInstanceSettings(instance);
|
||||
|
||||
MessageBox.Show("Settings Saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
120
gui/launcher/InstanceSettings.resx
Normal file
120
gui/launcher/InstanceSettings.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
273
gui/launcher/InstanceWindow.Designer.cs
generated
Normal file
273
gui/launcher/InstanceWindow.Designer.cs
generated
Normal file
@@ -0,0 +1,273 @@
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
partial class InstanceWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.logTab = new System.Windows.Forms.TabControl();
|
||||
this.logPage = new System.Windows.Forms.TabPage();
|
||||
this.logContainer = new System.Windows.Forms.Panel();
|
||||
this.logWindow = new System.Windows.Forms.RichTextBox();
|
||||
this.logPanelBottom = new System.Windows.Forms.Panel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.launchBtn = new System.Windows.Forms.Button();
|
||||
this.launchOfflineBtn = new System.Windows.Forms.Button();
|
||||
this.demoBtn = new System.Windows.Forms.Button();
|
||||
this.closeBtn = new System.Windows.Forms.Button();
|
||||
this.topPanel = new System.Windows.Forms.Panel();
|
||||
this.copyLog = new System.Windows.Forms.Button();
|
||||
this.uploadLog = new System.Windows.Forms.Button();
|
||||
this.clearLog = new System.Windows.Forms.Button();
|
||||
this.wrapLines = new System.Windows.Forms.CheckBox();
|
||||
this.updateLog = new System.Windows.Forms.CheckBox();
|
||||
this.logTab.SuspendLayout();
|
||||
this.logPage.SuspendLayout();
|
||||
this.logContainer.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.topPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// logTab
|
||||
//
|
||||
this.logTab.Controls.Add(this.logPage);
|
||||
this.logTab.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logTab.Location = new System.Drawing.Point(0, 0);
|
||||
this.logTab.Name = "logTab";
|
||||
this.logTab.SelectedIndex = 0;
|
||||
this.logTab.Size = new System.Drawing.Size(800, 450);
|
||||
this.logTab.TabIndex = 0;
|
||||
//
|
||||
// logPage
|
||||
//
|
||||
this.logPage.Controls.Add(this.logContainer);
|
||||
this.logPage.Controls.Add(this.panel1);
|
||||
this.logPage.Controls.Add(this.topPanel);
|
||||
this.logPage.Location = new System.Drawing.Point(4, 22);
|
||||
this.logPage.Name = "logPage";
|
||||
this.logPage.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.logPage.Size = new System.Drawing.Size(792, 424);
|
||||
this.logPage.TabIndex = 0;
|
||||
this.logPage.Text = "Minecraft Log";
|
||||
this.logPage.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// logContainer
|
||||
//
|
||||
this.logContainer.Controls.Add(this.logWindow);
|
||||
this.logContainer.Controls.Add(this.logPanelBottom);
|
||||
this.logContainer.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logContainer.Location = new System.Drawing.Point(3, 38);
|
||||
this.logContainer.Name = "logContainer";
|
||||
this.logContainer.Size = new System.Drawing.Size(786, 351);
|
||||
this.logContainer.TabIndex = 2;
|
||||
//
|
||||
// logWindow
|
||||
//
|
||||
this.logWindow.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.logWindow.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.logWindow.Location = new System.Drawing.Point(0, 0);
|
||||
this.logWindow.Name = "logWindow";
|
||||
this.logWindow.ReadOnly = true;
|
||||
this.logWindow.Size = new System.Drawing.Size(786, 319);
|
||||
this.logWindow.TabIndex = 1;
|
||||
this.logWindow.Text = "";
|
||||
this.logWindow.WordWrap = false;
|
||||
//
|
||||
// logPanelBottom
|
||||
//
|
||||
this.logPanelBottom.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.logPanelBottom.Location = new System.Drawing.Point(0, 319);
|
||||
this.logPanelBottom.Name = "logPanelBottom";
|
||||
this.logPanelBottom.Size = new System.Drawing.Size(786, 32);
|
||||
this.logPanelBottom.TabIndex = 0;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.launchBtn);
|
||||
this.panel1.Controls.Add(this.launchOfflineBtn);
|
||||
this.panel1.Controls.Add(this.demoBtn);
|
||||
this.panel1.Controls.Add(this.closeBtn);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel1.Location = new System.Drawing.Point(3, 389);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(786, 32);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// launchBtn
|
||||
//
|
||||
this.launchBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.launchBtn.Location = new System.Drawing.Point(346, 5);
|
||||
this.launchBtn.Name = "launchBtn";
|
||||
this.launchBtn.Size = new System.Drawing.Size(114, 23);
|
||||
this.launchBtn.TabIndex = 5;
|
||||
this.launchBtn.Text = "Launch";
|
||||
this.launchBtn.UseVisualStyleBackColor = true;
|
||||
this.launchBtn.Click += new System.EventHandler(this.launchBtn_Click);
|
||||
//
|
||||
// launchOfflineBtn
|
||||
//
|
||||
this.launchOfflineBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.launchOfflineBtn.Enabled = false;
|
||||
this.launchOfflineBtn.Location = new System.Drawing.Point(466, 5);
|
||||
this.launchOfflineBtn.Name = "launchOfflineBtn";
|
||||
this.launchOfflineBtn.Size = new System.Drawing.Size(114, 23);
|
||||
this.launchOfflineBtn.TabIndex = 4;
|
||||
this.launchOfflineBtn.Text = "Launch Offline";
|
||||
this.launchOfflineBtn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// demoBtn
|
||||
//
|
||||
this.demoBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.demoBtn.Enabled = false;
|
||||
this.demoBtn.Location = new System.Drawing.Point(586, 5);
|
||||
this.demoBtn.Name = "demoBtn";
|
||||
this.demoBtn.Size = new System.Drawing.Size(114, 23);
|
||||
this.demoBtn.TabIndex = 3;
|
||||
this.demoBtn.Text = "Launch Demo";
|
||||
this.demoBtn.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// closeBtn
|
||||
//
|
||||
this.closeBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.closeBtn.Location = new System.Drawing.Point(706, 5);
|
||||
this.closeBtn.Name = "closeBtn";
|
||||
this.closeBtn.Size = new System.Drawing.Size(75, 23);
|
||||
this.closeBtn.TabIndex = 2;
|
||||
this.closeBtn.Text = "Close";
|
||||
this.closeBtn.UseVisualStyleBackColor = true;
|
||||
this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click);
|
||||
//
|
||||
// topPanel
|
||||
//
|
||||
this.topPanel.Controls.Add(this.copyLog);
|
||||
this.topPanel.Controls.Add(this.uploadLog);
|
||||
this.topPanel.Controls.Add(this.clearLog);
|
||||
this.topPanel.Controls.Add(this.wrapLines);
|
||||
this.topPanel.Controls.Add(this.updateLog);
|
||||
this.topPanel.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.topPanel.Location = new System.Drawing.Point(3, 3);
|
||||
this.topPanel.Name = "topPanel";
|
||||
this.topPanel.Size = new System.Drawing.Size(786, 35);
|
||||
this.topPanel.TabIndex = 0;
|
||||
//
|
||||
// copyLog
|
||||
//
|
||||
this.copyLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.copyLog.Enabled = false;
|
||||
this.copyLog.Location = new System.Drawing.Point(544, 4);
|
||||
this.copyLog.Name = "copyLog";
|
||||
this.copyLog.Size = new System.Drawing.Size(75, 23);
|
||||
this.copyLog.TabIndex = 4;
|
||||
this.copyLog.Text = "Copy Log";
|
||||
this.copyLog.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// uploadLog
|
||||
//
|
||||
this.uploadLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.uploadLog.Enabled = false;
|
||||
this.uploadLog.Location = new System.Drawing.Point(625, 4);
|
||||
this.uploadLog.Name = "uploadLog";
|
||||
this.uploadLog.Size = new System.Drawing.Size(75, 23);
|
||||
this.uploadLog.TabIndex = 3;
|
||||
this.uploadLog.Text = "Upload Log";
|
||||
this.uploadLog.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// clearLog
|
||||
//
|
||||
this.clearLog.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.clearLog.Location = new System.Drawing.Point(706, 4);
|
||||
this.clearLog.Name = "clearLog";
|
||||
this.clearLog.Size = new System.Drawing.Size(75, 23);
|
||||
this.clearLog.TabIndex = 1;
|
||||
this.clearLog.Text = "Clear";
|
||||
this.clearLog.UseVisualStyleBackColor = true;
|
||||
this.clearLog.Click += new System.EventHandler(this.clearLog_Click);
|
||||
//
|
||||
// wrapLines
|
||||
//
|
||||
this.wrapLines.AutoSize = true;
|
||||
this.wrapLines.Checked = true;
|
||||
this.wrapLines.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.wrapLines.Location = new System.Drawing.Point(112, 8);
|
||||
this.wrapLines.Name = "wrapLines";
|
||||
this.wrapLines.Size = new System.Drawing.Size(80, 17);
|
||||
this.wrapLines.TabIndex = 2;
|
||||
this.wrapLines.Text = "Wrap Lines";
|
||||
this.wrapLines.UseVisualStyleBackColor = true;
|
||||
this.wrapLines.CheckedChanged += new System.EventHandler(this.wrapLines_CheckedChanged);
|
||||
//
|
||||
// updateLog
|
||||
//
|
||||
this.updateLog.AutoSize = true;
|
||||
this.updateLog.Checked = true;
|
||||
this.updateLog.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.updateLog.Location = new System.Drawing.Point(9, 8);
|
||||
this.updateLog.Name = "updateLog";
|
||||
this.updateLog.Size = new System.Drawing.Size(97, 17);
|
||||
this.updateLog.TabIndex = 1;
|
||||
this.updateLog.Text = "Keep Updating";
|
||||
this.updateLog.UseVisualStyleBackColor = true;
|
||||
this.updateLog.CheckedChanged += new System.EventHandler(this.updateLog_CheckedChanged);
|
||||
//
|
||||
// InstanceWindow
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.logTab);
|
||||
this.Name = "InstanceWindow";
|
||||
this.Text = "InstanceWindow";
|
||||
this.Load += new System.EventHandler(this.InstanceWindow_Load);
|
||||
this.logTab.ResumeLayout(false);
|
||||
this.logPage.ResumeLayout(false);
|
||||
this.logContainer.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.topPanel.ResumeLayout(false);
|
||||
this.topPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TabControl logTab;
|
||||
private System.Windows.Forms.TabPage logPage;
|
||||
private System.Windows.Forms.Panel topPanel;
|
||||
private System.Windows.Forms.CheckBox updateLog;
|
||||
private System.Windows.Forms.CheckBox wrapLines;
|
||||
private System.Windows.Forms.Button clearLog;
|
||||
private System.Windows.Forms.Button uploadLog;
|
||||
private System.Windows.Forms.Button copyLog;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button closeBtn;
|
||||
private System.Windows.Forms.Button demoBtn;
|
||||
private System.Windows.Forms.Button launchOfflineBtn;
|
||||
private System.Windows.Forms.Button launchBtn;
|
||||
private System.Windows.Forms.Panel logContainer;
|
||||
private System.Windows.Forms.Panel logPanelBottom;
|
||||
private System.Windows.Forms.RichTextBox logWindow;
|
||||
}
|
||||
}
|
||||
67
gui/launcher/InstanceWindow.cs
Normal file
67
gui/launcher/InstanceWindow.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using WolfLauncher.core;
|
||||
using WolfLauncher.model;
|
||||
|
||||
/**
|
||||
* Author: HypherionSA
|
||||
* Console window for instances
|
||||
**/
|
||||
namespace WolfLauncher.gui.launcher
|
||||
{
|
||||
public partial class InstanceWindow : Form
|
||||
{
|
||||
// Reference to launcher instance
|
||||
private Instance instance;
|
||||
|
||||
public InstanceWindow(Instance ins)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.instance = ins;
|
||||
|
||||
this.Text = String.Format("{0} - {1} - {2}", "Console window for " + ins.name, LauncherConstants.LauncherName, LauncherConstants.Version);
|
||||
}
|
||||
|
||||
private void wrapLines_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Apply wordwrapping based on checkbox
|
||||
logWindow.WordWrap = wrapLines.Checked;
|
||||
}
|
||||
|
||||
private void InstanceWindow_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Setup default values
|
||||
logWindow.WordWrap = wrapLines.Checked;
|
||||
|
||||
// Load log from logger if it exists
|
||||
LauncherLogger.INSTANCE.logWindow = this.logWindow;
|
||||
LauncherLogger.INSTANCE.loadLog(instance);
|
||||
LauncherLogger.INSTANCE.canUpdateLog = true;
|
||||
}
|
||||
|
||||
private void clearLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Clear the log
|
||||
logWindow.Clear();
|
||||
LauncherLogger.INSTANCE.clearLog();
|
||||
}
|
||||
|
||||
private void closeBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Close the window... Really? I needed to comment this??
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void launchBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Launch Instance
|
||||
MainLauncherForm.INSTANCE.launchInstance(instance);
|
||||
}
|
||||
|
||||
private void updateLog_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Set if log can be updated in the window or not
|
||||
LauncherLogger.INSTANCE.canUpdateLog = updateLog.Checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
gui/launcher/InstanceWindow.resx
Normal file
120
gui/launcher/InstanceWindow.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user