mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 14:30:31 +00:00
Restructurize
This commit is contained in:
@@ -12,7 +12,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigGenerator", "ConfigGe
|
|||||||
{35AF7887-08B9-40E8-A5EA-797D8B60B30C} = {35AF7887-08B9-40E8-A5EA-797D8B60B30C}
|
{35AF7887-08B9-40E8-A5EA-797D8B60B30C} = {35AF7887-08B9-40E8-A5EA-797D8B60B30C}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui2", "WcfClientGui\Gui2.csproj", "{599121A9-5887-4522-A3D6-61470B90BAD4}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUI", "GUI\GUI.csproj", "{599121A9-5887-4522-A3D6-61470B90BAD4}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
{35AF7887-08B9-40E8-A5EA-797D8B60B30C} = {35AF7887-08B9-40E8-A5EA-797D8B60B30C}
|
{35AF7887-08B9-40E8-A5EA-797D8B60B30C} = {35AF7887-08B9-40E8-A5EA-797D8B60B30C}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("ArchiSteamFarm")]
|
[assembly: AssemblyProduct("ArchiSteamFarm")]
|
||||||
[assembly: AssemblyCopyright("Copyright © Łukasz Domeradzki 2015-2016")]
|
[assembly: AssemblyCopyright("Copyright © ArchiSteamFarm 2015-2016")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|||||||
@@ -104,12 +104,12 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||||
"$(SolutionDir)tools\ILRepack\ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out\ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
"$(SolutionDir)tools\ILRepack\ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out\ASF-ConfigGenerator.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||||
del "$(SolutionDir)out\ASF-GUI.exe.config"
|
del "$(SolutionDir)out\ASF-ConfigGenerator.exe.config"
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<PostBuildEvent Condition=" '$(OS)' == 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
<PostBuildEvent Condition=" '$(OS)' == 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||||
mono -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
mono -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-ConfigGenerator.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||||
rm "$(SolutionDir)out/ASF-GUI.exe.config"
|
rm "$(SolutionDir)out/ASF-ConfigGenerator.exe.config"
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("ConfigGenerator")]
|
[assembly: AssemblyProduct("ConfigGenerator")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © ArchiSteamFarm 2015-2016")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|||||||
125
WcfClientGui/Form1.Designer.cs → GUI/Form1.Designer.cs
generated
125
WcfClientGui/Form1.Designer.cs → GUI/Form1.Designer.cs
generated
@@ -1,33 +1,28 @@
|
|||||||
namespace Gui2
|
namespace GUI {
|
||||||
{
|
partial class Form1 {
|
||||||
partial class Form1
|
/// <summary>
|
||||||
{
|
/// Erforderliche Designervariable.
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Erforderliche Designervariable.
|
private System.ComponentModel.IContainer components = null;
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Verwendete Ressourcen bereinigen.
|
/// Verwendete Ressourcen bereinigen.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing) {
|
||||||
{
|
if (disposing && (components != null)) {
|
||||||
if (disposing && (components != null))
|
components.Dispose();
|
||||||
{
|
}
|
||||||
components.Dispose();
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Vom Windows Form-Designer generierter Code
|
#region Vom Windows Form-Designer generierter Code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Erforderliche Methode für die Designerunterstützung.
|
/// Erforderliche Methode für die Designerunterstützung.
|
||||||
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent() {
|
||||||
{
|
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||||
this.button5 = new System.Windows.Forms.Button();
|
this.button5 = new System.Windows.Forms.Button();
|
||||||
@@ -467,7 +462,7 @@
|
|||||||
this.Controls.Add(this.checkBox3);
|
this.Controls.Add(this.checkBox3);
|
||||||
this.Controls.Add(this.checkBox2);
|
this.Controls.Add(this.checkBox2);
|
||||||
this.Controls.Add(this.checkBox1);
|
this.Controls.Add(this.checkBox1);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
|
||||||
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
this.Name = "Form1";
|
this.Name = "Form1";
|
||||||
this.Text = "Form1";
|
this.Text = "Form1";
|
||||||
@@ -475,44 +470,44 @@
|
|||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Button button5;
|
private System.Windows.Forms.Button button5;
|
||||||
private System.Windows.Forms.Button button4;
|
private System.Windows.Forms.Button button4;
|
||||||
private System.Windows.Forms.Button button3;
|
private System.Windows.Forms.Button button3;
|
||||||
private System.Windows.Forms.Button button2;
|
private System.Windows.Forms.Button button2;
|
||||||
private System.Windows.Forms.Button button1;
|
private System.Windows.Forms.Button button1;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label label2;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.TextBox textBox2;
|
private System.Windows.Forms.TextBox textBox2;
|
||||||
private System.Windows.Forms.TextBox textBox1;
|
private System.Windows.Forms.TextBox textBox1;
|
||||||
private System.Windows.Forms.ComboBox comboBox1;
|
private System.Windows.Forms.ComboBox comboBox1;
|
||||||
private System.Windows.Forms.CheckBox checkBox3;
|
private System.Windows.Forms.CheckBox checkBox3;
|
||||||
private System.Windows.Forms.CheckBox checkBox2;
|
private System.Windows.Forms.CheckBox checkBox2;
|
||||||
private System.Windows.Forms.CheckBox checkBox1;
|
private System.Windows.Forms.CheckBox checkBox1;
|
||||||
private System.Windows.Forms.TextBox textBox3;
|
private System.Windows.Forms.TextBox textBox3;
|
||||||
private System.Windows.Forms.NotifyIcon ASFGUI;
|
private System.Windows.Forms.NotifyIcon ASFGUI;
|
||||||
private System.Windows.Forms.CheckBox checkBox4;
|
private System.Windows.Forms.CheckBox checkBox4;
|
||||||
private System.Windows.Forms.Button button6;
|
private System.Windows.Forms.Button button6;
|
||||||
private System.Windows.Forms.Button button7;
|
private System.Windows.Forms.Button button7;
|
||||||
private System.Windows.Forms.Button button8;
|
private System.Windows.Forms.Button button8;
|
||||||
private System.Windows.Forms.Button button9;
|
private System.Windows.Forms.Button button9;
|
||||||
private System.Windows.Forms.Button button10;
|
private System.Windows.Forms.Button button10;
|
||||||
private System.Windows.Forms.Button button11;
|
private System.Windows.Forms.Button button11;
|
||||||
private System.Windows.Forms.Button button12;
|
private System.Windows.Forms.Button button12;
|
||||||
private System.Windows.Forms.Button button13;
|
private System.Windows.Forms.Button button13;
|
||||||
private System.Windows.Forms.Button button14;
|
private System.Windows.Forms.Button button14;
|
||||||
private System.Windows.Forms.Button button15;
|
private System.Windows.Forms.Button button15;
|
||||||
private System.Windows.Forms.Button button16;
|
private System.Windows.Forms.Button button16;
|
||||||
private System.Windows.Forms.Button button17;
|
private System.Windows.Forms.Button button17;
|
||||||
private System.Windows.Forms.Button button18;
|
private System.Windows.Forms.Button button18;
|
||||||
private System.Windows.Forms.Button button19;
|
private System.Windows.Forms.Button button19;
|
||||||
private System.Windows.Forms.Label label3;
|
private System.Windows.Forms.Label label3;
|
||||||
private System.Windows.Forms.Label label4;
|
private System.Windows.Forms.Label label4;
|
||||||
private System.Windows.Forms.Button button20;
|
private System.Windows.Forms.Button button20;
|
||||||
private System.Windows.Forms.Label label5;
|
private System.Windows.Forms.Label label5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
302
GUI/Form1.cs
Normal file
302
GUI/Form1.cs
Normal file
@@ -0,0 +1,302 @@
|
|||||||
|
/*
|
||||||
|
_ _ _ ____ _ _____
|
||||||
|
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||||
|
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||||
|
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||||
|
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
||||||
|
|
||||||
|
Copyright 2015-2016 Florian "KlappPC" Lang
|
||||||
|
Contact: ichhoeremusik@gmx.net
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.ServiceModel;
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
public partial class Form1 : Form {
|
||||||
|
private bool safeMode = false;
|
||||||
|
private bool sendAll = false;
|
||||||
|
private bool sendAny = true;
|
||||||
|
private bool sendOne = false;
|
||||||
|
private string botName = "";
|
||||||
|
string[] botList;
|
||||||
|
private string URL = "";
|
||||||
|
ServerProcess proc;
|
||||||
|
private Client Client;
|
||||||
|
public Form1() {
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
// So either the ASF.exe is in the same directory, or we assume development environment.
|
||||||
|
if (System.IO.File.Exists("ASF.exe")) {
|
||||||
|
proc = new ServerProcess("ASF.exe", "--server", textBox2);
|
||||||
|
} else {
|
||||||
|
proc = new ServerProcess("../../../ArchiSteamFarm/bin/Release/ArchiSteamFarm.exe", "--server", textBox2);
|
||||||
|
}
|
||||||
|
proc.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnFormClosing(FormClosingEventArgs e) {
|
||||||
|
proc.Stop();
|
||||||
|
base.OnFormClosing(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a single command. can be lead by a ! but it does not have to.
|
||||||
|
*/
|
||||||
|
private string sendCommand(string command) {
|
||||||
|
if (command.StartsWith("!")) {
|
||||||
|
command = command.Substring(1);
|
||||||
|
}
|
||||||
|
if (Client == null) {
|
||||||
|
Client = new Client(new BasicHttpBinding(), new EndpointAddress(URL));
|
||||||
|
}
|
||||||
|
return Client.HandleCommand(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximize again when double clicked on tray icon
|
||||||
|
*/
|
||||||
|
private void ASFGUI_MouseDoubleClick(object sender, MouseEventArgs e) {
|
||||||
|
this.Show();
|
||||||
|
this.WindowState = FormWindowState.Normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Form1_Load(object sender, System.EventArgs e) {
|
||||||
|
this.Resize += new System.EventHandler(this.Form1_Resize);
|
||||||
|
textBox2.ScrollBars = ScrollBars.Vertical;
|
||||||
|
textBox1.ScrollBars = ScrollBars.Vertical;
|
||||||
|
checkBox4.Checked = true;
|
||||||
|
textBox3.Text = "http://localhost:1242/ASF";
|
||||||
|
URL = "http://localhost:1242/ASF";
|
||||||
|
textBox2.Anchor = (AnchorStyles.Right | AnchorStyles.Left);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Minimize to tray instead of taskbar
|
||||||
|
*/
|
||||||
|
private void Form1_Resize(object sender, EventArgs e) {
|
||||||
|
if (FormWindowState.Minimized == this.WindowState) {
|
||||||
|
ASFGUI.Visible = true;
|
||||||
|
this.Hide();
|
||||||
|
} else if (FormWindowState.Normal == this.WindowState) {
|
||||||
|
ASFGUI.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* generate a command from a simple command
|
||||||
|
* That means, adds a botName or makes multiple commands for multiple bots.
|
||||||
|
*/
|
||||||
|
private string generateCommand(string command, string arg = "") {
|
||||||
|
if (sendOne)
|
||||||
|
return command + " " + botName + " " + arg;
|
||||||
|
if (sendAll) {
|
||||||
|
string ret = "";
|
||||||
|
foreach (string str in botList) {
|
||||||
|
ret = ret + command + " " + str + " " + arg + "\r\n";
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return command + arg;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* One of the simple buttons got pressed
|
||||||
|
*/
|
||||||
|
private void buttonPressed(string command) {
|
||||||
|
textBox1.Text = generateCommand(command);
|
||||||
|
if (!safeMode)
|
||||||
|
button1_Click(this, null);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* One of the complicated buttons was pressed
|
||||||
|
* We get an argumentlist
|
||||||
|
*/
|
||||||
|
private void multiCommand(string command) {
|
||||||
|
if (sendAll)
|
||||||
|
return;
|
||||||
|
string[] arr = textBox1.Lines;
|
||||||
|
string cmd = "";
|
||||||
|
for (int i = 0; i < arr.Length; i++) {
|
||||||
|
if (!String.IsNullOrEmpty(arr[i].Trim())) {
|
||||||
|
cmd = cmd + generateCommand(command, arr[i].Trim()) + "\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
textBox1.Text = cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* updates the WCF URL in case of custom URL
|
||||||
|
*/
|
||||||
|
private void textBox3_TextChanged(object sender, EventArgs e) {
|
||||||
|
URL = textBox3.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) {
|
||||||
|
botName = comboBox1.SelectedItem.ToString();
|
||||||
|
}
|
||||||
|
//Ok, radiobuttons would have been better I guess, to lazy to change now.
|
||||||
|
private void checkBox3_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
//specific
|
||||||
|
if (checkBox3.Checked) {
|
||||||
|
sendAll = false;
|
||||||
|
sendAny = false;
|
||||||
|
sendOne = true;
|
||||||
|
checkBox2.Checked = false;
|
||||||
|
checkBox4.Checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox2_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
//all
|
||||||
|
if (checkBox2.Checked) {
|
||||||
|
sendAll = true;
|
||||||
|
sendAny = false;
|
||||||
|
sendOne = false;
|
||||||
|
checkBox3.Checked = false;
|
||||||
|
checkBox4.Checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox4_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
//any
|
||||||
|
if (checkBox4.Checked) {
|
||||||
|
sendAll = false;
|
||||||
|
sendAny = true;
|
||||||
|
sendOne = false;
|
||||||
|
checkBox2.Checked = false;
|
||||||
|
checkBox3.Checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkBox1_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
safeMode = checkBox1.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send command button.
|
||||||
|
*/
|
||||||
|
private void button1_Click(object sender, System.EventArgs e) {
|
||||||
|
for (int i = 0; i < textBox1.Lines.Length; i++) {
|
||||||
|
string command = textBox1.Lines[i];
|
||||||
|
if (!String.IsNullOrEmpty(command.Trim())) {
|
||||||
|
sendCommand(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Update /Generate Botlist button
|
||||||
|
*/
|
||||||
|
private void button6_Click(object sender, EventArgs e) {
|
||||||
|
string ret = sendCommand("statusall");
|
||||||
|
string[] arr = ret.Split('\n');
|
||||||
|
int botAmount = Convert.ToInt16(arr[arr.Length - 1].Split('/')[1].Trim().Split(' ')[0]);
|
||||||
|
botList = new string[botAmount];
|
||||||
|
for (int i = 0; i < botAmount; i++) {
|
||||||
|
botList[i] = arr[arr.Length - 2 - i].Substring(3).Trim().Split(' ')[0];
|
||||||
|
}
|
||||||
|
comboBox1.Items.AddRange(botList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//The Rest are simple buttons.
|
||||||
|
private void button3_Click(object sender, EventArgs e) {
|
||||||
|
multiCommand("redeem");
|
||||||
|
}
|
||||||
|
private void button2_Click(object sender, EventArgs e) {
|
||||||
|
textBox1.Text = generateCommand("loot");
|
||||||
|
if (!safeMode)
|
||||||
|
button1_Click(this, null);
|
||||||
|
}
|
||||||
|
private void button4_Click(object sender, EventArgs e) {
|
||||||
|
//2fa
|
||||||
|
textBox1.Text = generateCommand("2fa");
|
||||||
|
if (!safeMode)
|
||||||
|
button1_Click(this, null);
|
||||||
|
}
|
||||||
|
private void button5_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("2faok");
|
||||||
|
}
|
||||||
|
private void button7_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("2fano");
|
||||||
|
}
|
||||||
|
private void button8_Click(object sender, EventArgs e) {
|
||||||
|
if (sendAll)
|
||||||
|
return;
|
||||||
|
textBox1.Text = generateCommand("2faoff");
|
||||||
|
}
|
||||||
|
private void button9_Click(object sender, EventArgs e) {
|
||||||
|
textBox1.Text = "exit";
|
||||||
|
}
|
||||||
|
private void button10_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("farm");
|
||||||
|
}
|
||||||
|
private void button11_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("help");
|
||||||
|
}
|
||||||
|
private void button12_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("start");
|
||||||
|
}
|
||||||
|
private void button13_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("stop");
|
||||||
|
}
|
||||||
|
private void button14_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("pause");
|
||||||
|
}
|
||||||
|
private void button15_Click(object sender, EventArgs e) {
|
||||||
|
buttonPressed("status");
|
||||||
|
}
|
||||||
|
private void button16_Click(object sender, EventArgs e) {
|
||||||
|
textBox1.Text = "statusall";
|
||||||
|
if (!safeMode)
|
||||||
|
button1_Click(this, null);
|
||||||
|
}
|
||||||
|
private void button17_Click(object sender, EventArgs e) {
|
||||||
|
multiCommand("owns");
|
||||||
|
}
|
||||||
|
private void button18_Click(object sender, EventArgs e) {
|
||||||
|
multiCommand("addlicense");
|
||||||
|
}
|
||||||
|
private void button19_Click(object sender, EventArgs e) {
|
||||||
|
multiCommand("play");
|
||||||
|
}
|
||||||
|
private void button20_Click(object sender, EventArgs e) {
|
||||||
|
textBox1.Text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//############### After this point copied from Archie's WCF ###################
|
||||||
|
[ServiceContract]
|
||||||
|
interface IWCF {
|
||||||
|
[OperationContract]
|
||||||
|
string HandleCommand(string input);
|
||||||
|
}
|
||||||
|
class Client : ClientBase<IWCF>, IWCF {
|
||||||
|
internal Client(System.ServiceModel.Channels.Binding binding, EndpointAddress address) : base(binding, address) { }
|
||||||
|
|
||||||
|
public string HandleCommand(string input) {
|
||||||
|
try {
|
||||||
|
return Channel.HandleCommand(input);
|
||||||
|
} catch (Exception e) {
|
||||||
|
//Logging.LogGenericException(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
84
GUI/Form2.Designer.cs
generated
Normal file
84
GUI/Form2.Designer.cs
generated
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
namespace GUI {
|
||||||
|
partial class Form2 {
|
||||||
|
/// <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() {
|
||||||
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form2));
|
||||||
|
this.button1 = new System.Windows.Forms.Button();
|
||||||
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
this.button1.Location = new System.Drawing.Point(134, 93);
|
||||||
|
this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
|
this.button1.Name = "button1";
|
||||||
|
this.button1.Size = new System.Drawing.Size(87, 28);
|
||||||
|
this.button1.TabIndex = 0;
|
||||||
|
this.button1.Text = "OK";
|
||||||
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
this.textBox1.Location = new System.Drawing.Point(12, 63);
|
||||||
|
this.textBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
|
this.textBox1.Name = "textBox1";
|
||||||
|
this.textBox1.Size = new System.Drawing.Size(336, 20);
|
||||||
|
this.textBox1.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// label1
|
||||||
|
//
|
||||||
|
this.label1.AutoSize = true;
|
||||||
|
this.label1.Location = new System.Drawing.Point(10, 7);
|
||||||
|
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||||
|
this.label1.Name = "label1";
|
||||||
|
this.label1.Size = new System.Drawing.Size(35, 13);
|
||||||
|
this.label1.TabIndex = 2;
|
||||||
|
this.label1.Text = "label1";
|
||||||
|
//
|
||||||
|
// Form2
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(356, 132);
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
|
this.Controls.Add(this.textBox1);
|
||||||
|
this.Controls.Add(this.button1);
|
||||||
|
this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||||
|
this.Name = "Form2";
|
||||||
|
this.Text = "Input";
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.Button button1;
|
||||||
|
private System.Windows.Forms.TextBox textBox1;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,25 +24,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Gui2
|
namespace GUI {
|
||||||
{
|
/**
|
||||||
/**
|
|
||||||
* popup Message when Input is required
|
* popup Message when Input is required
|
||||||
*/
|
*/
|
||||||
public partial class Form2 : Form
|
public partial class Form2 : Form {
|
||||||
{
|
ServerProcess proc;
|
||||||
ServerProcess proc;
|
public Form2(ServerProcess proc, string msg) {
|
||||||
public Form2(ServerProcess proc, string msg)
|
this.proc = proc;
|
||||||
{
|
InitializeComponent();
|
||||||
this.proc = proc;
|
label1.Text = msg;
|
||||||
InitializeComponent();
|
button1.DialogResult = DialogResult.OK;
|
||||||
label1.Text = msg;
|
}
|
||||||
button1.DialogResult = DialogResult.OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e) {
|
||||||
{
|
proc.Write(textBox1.Text);
|
||||||
proc.Write(textBox1.Text);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
6293
GUI/Form2.resx
Normal file
6293
GUI/Form2.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,8 +7,8 @@
|
|||||||
<ProjectGuid>{599121A9-5887-4522-A3D6-61470B90BAD4}</ProjectGuid>
|
<ProjectGuid>{599121A9-5887-4522-A3D6-61470B90BAD4}</ProjectGuid>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Gui2</RootNamespace>
|
<RootNamespace>GUI</RootNamespace>
|
||||||
<AssemblyName>Gui2</AssemblyName>
|
<AssemblyName>GUI</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
@@ -40,10 +40,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>none</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>
|
||||||
|
</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -53,9 +54,6 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>cirno.ico</ApplicationIcon>
|
<ApplicationIcon>cirno.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
|
||||||
<StartupObject>Gui2.Program</StartupObject>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -136,12 +134,12 @@
|
|||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
<PostBuildEvent Condition=" '$(OS)' != 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||||
"$(SolutionDir)tools\ILRepack\ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out\ASF-WCF.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
"$(SolutionDir)tools\ILRepack\ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out\ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||||
del "$(SolutionDir)out\ASF-WCF.exe.config"
|
del "$(SolutionDir)out\ASF-GUI.exe.config"
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
<PostBuildEvent Condition=" '$(OS)' == 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
<PostBuildEvent Condition=" '$(OS)' == 'Unix' AND '$(ConfigurationName)' == 'Release' ">
|
||||||
mono -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-WCF.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
mono -O=all "$(SolutionDir)tools/ILRepack/ILRepack.exe" /ndebug /internalize /parallel /targetplatform:v4 /wildcards /out:"$(SolutionDir)out/ASF-GUI.exe" "$(TargetDir)$(TargetName).exe" "$(TargetDir)*.dll"
|
||||||
rm "$(SolutionDir)out/ASF-WCF.exe.config"
|
rm "$(SolutionDir)out/ASF-GUI.exe.config"
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
16
GUI/Program.cs
Normal file
16
GUI/Program.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
|
static class Program {
|
||||||
|
/// <summary>
|
||||||
|
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||||
|
/// </summary>
|
||||||
|
[STAThread]
|
||||||
|
static void Main() {
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.Run(new Form1());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,12 +5,12 @@ using System.Runtime.InteropServices;
|
|||||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||||
// die mit einer Assembly verknüpft sind.
|
// die mit einer Assembly verknüpft sind.
|
||||||
[assembly: AssemblyTitle("Gui2")]
|
[assembly: AssemblyTitle("GUI")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("Gui2")]
|
[assembly: AssemblyProduct("GUI")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
[assembly: AssemblyCopyright("Copyright © ArchiSteamFarm 2015-2016")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Gui2.Properties {
|
namespace GUI.Properties {
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ namespace Gui2.Properties {
|
|||||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
get {
|
get {
|
||||||
if (object.ReferenceEquals(resourceMan, null)) {
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Gui2.Properties.Resources", typeof(Resources).Assembly);
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GUI.Properties.Resources", typeof(Resources).Assembly);
|
||||||
resourceMan = temp;
|
resourceMan = temp;
|
||||||
}
|
}
|
||||||
return resourceMan;
|
return resourceMan;
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Gui2.Properties {
|
namespace GUI.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
180
GUI/ServerProcess.cs
Normal file
180
GUI/ServerProcess.cs
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
_ _ _ ____ _ _____
|
||||||
|
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||||
|
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||||
|
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||||
|
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
||||||
|
|
||||||
|
Copyright 2015-2016 Florian "KlappPC" Lang
|
||||||
|
Contact: ichhoeremusik@gmx.net
|
||||||
|
This file is mostly done by a friend who explicitly does not want to get mentioned in any way.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Threading;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GUI {
|
||||||
|
/*basically a class to run executables as controlled prozess in the background*/
|
||||||
|
public class ServerProcess {
|
||||||
|
//ASF.exe in our case
|
||||||
|
protected Process process;
|
||||||
|
//handling the output.
|
||||||
|
protected Thread outputThread;
|
||||||
|
protected bool stopping;
|
||||||
|
|
||||||
|
//the textbox from our Form, where we want to display output.
|
||||||
|
private TextBox output;
|
||||||
|
|
||||||
|
private object lockObj = new object();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New SeverProcess for filename with arguments and output to textBox.
|
||||||
|
* Console is hidden and IO redirected.
|
||||||
|
*/
|
||||||
|
public ServerProcess(string fileName, string argumants, TextBox textBox) {
|
||||||
|
|
||||||
|
|
||||||
|
output = textBox;
|
||||||
|
process = new System.Diagnostics.Process();
|
||||||
|
|
||||||
|
process.StartInfo.FileName = fileName;
|
||||||
|
process.StartInfo.Arguments = argumants;
|
||||||
|
process.StartInfo.UseShellExecute = false;
|
||||||
|
process.StartInfo.RedirectStandardInput = true;
|
||||||
|
process.StartInfo.RedirectStandardError = true;
|
||||||
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
|
process.StartInfo.CreateNoWindow = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
//needed for realizing when input is needed.
|
||||||
|
private int dotcounter = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* I'm not quite happy with this. I could not figure a way to notice when input is required
|
||||||
|
* besides reading char by char and searching for keywords. Will stop working, if the "Please enter"
|
||||||
|
* lines gets changed.
|
||||||
|
* Only tested for "Enter Password."
|
||||||
|
*/
|
||||||
|
private void NewOutput(object sender, char e) {
|
||||||
|
MethodInvoker mi = delegate {
|
||||||
|
output.AppendText(e.ToString());
|
||||||
|
};
|
||||||
|
|
||||||
|
if (e == '.') {
|
||||||
|
dotcounter++;
|
||||||
|
} else if (e == ':') {
|
||||||
|
dotcounter = 3;
|
||||||
|
} else {
|
||||||
|
dotcounter = 0;
|
||||||
|
}
|
||||||
|
if (dotcounter == 3) {
|
||||||
|
string[] arr = output.Lines;
|
||||||
|
string str = arr[arr.Length - 1];
|
||||||
|
if (str.Contains("Hit enter")) {
|
||||||
|
str = arr[arr.Length - 2] + " | " + str;
|
||||||
|
Form f = new Form2(this, str);
|
||||||
|
f.ShowDialog();
|
||||||
|
mi = delegate { output.AppendText(e.ToString() + "\n"); };
|
||||||
|
}
|
||||||
|
if (str.Contains("Please enter")) {
|
||||||
|
Form f = new Form2(this, str);
|
||||||
|
f.ShowDialog();
|
||||||
|
mi = delegate { output.AppendText(e.ToString() + "\n"); };
|
||||||
|
}
|
||||||
|
|
||||||
|
dotcounter = 0;
|
||||||
|
}
|
||||||
|
output.Invoke(mi);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NewOutput(object sender, string e) {
|
||||||
|
MethodInvoker mi = delegate {
|
||||||
|
output.AppendText(e + "\n");
|
||||||
|
};
|
||||||
|
output.Invoke(mi);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void printOutPut() {
|
||||||
|
char str;
|
||||||
|
int i;
|
||||||
|
string s;
|
||||||
|
while (!stopping) {
|
||||||
|
//thats ugly, but when using readline we can't catch input.
|
||||||
|
while (((i = process.StandardOutput.Read()) != 0)) {
|
||||||
|
str = System.Convert.ToChar(i);
|
||||||
|
NewOutput(this, str);
|
||||||
|
if (stopping)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (((s = process.StandardError.ReadLine()) != null)) {
|
||||||
|
NewOutput(this, s);
|
||||||
|
if (stopping)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Write(string msg) {
|
||||||
|
process.StandardInput.WriteLine(msg);
|
||||||
|
process.StandardInput.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Stop() {
|
||||||
|
Thread stopThread = new Thread(StopProcess);
|
||||||
|
stopThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StopProcess() {
|
||||||
|
|
||||||
|
if (process == null)
|
||||||
|
return;
|
||||||
|
stopping = true;
|
||||||
|
|
||||||
|
outputThread.Abort();
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
|
||||||
|
if (process == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (process.HasExited)
|
||||||
|
process.Close();
|
||||||
|
else
|
||||||
|
process.Kill();
|
||||||
|
|
||||||
|
process = null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* starts the process and a second thread to listen for output.
|
||||||
|
*/
|
||||||
|
public void Start() {
|
||||||
|
outputThread = new Thread(printOutPut);
|
||||||
|
process.Start();
|
||||||
|
outputThread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Process Process {
|
||||||
|
get {
|
||||||
|
return process;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
@@ -1,363 +0,0 @@
|
|||||||
/*
|
|
||||||
_ _ _ ____ _ _____
|
|
||||||
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
|
||||||
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
|
||||||
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
|
||||||
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
|
||||||
|
|
||||||
Copyright 2015-2016 Florian "KlappPC" Lang
|
|
||||||
Contact: ichhoeremusik@gmx.net
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.ServiceModel;
|
|
||||||
|
|
||||||
namespace Gui2
|
|
||||||
{
|
|
||||||
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
private bool safeMode = false;
|
|
||||||
private bool sendAll = false;
|
|
||||||
private bool sendAny = true;
|
|
||||||
private bool sendOne = false;
|
|
||||||
private string botName = "";
|
|
||||||
string[] botList;
|
|
||||||
private string URL = "";
|
|
||||||
ServerProcess proc;
|
|
||||||
private Client Client;
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
// So either the ASF.exe is in the same directory, or we assume development environment.
|
|
||||||
if (System.IO.File.Exists("ASF.exe"))
|
|
||||||
{
|
|
||||||
proc = new ServerProcess("ASF.exe", "--server", textBox2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
proc = new ServerProcess("../../../ArchiSteamFarm/bin/Release/ArchiSteamFarm.exe", "--server", textBox2);
|
|
||||||
}
|
|
||||||
proc.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
|
||||||
{
|
|
||||||
proc.Stop();
|
|
||||||
base.OnFormClosing(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sends a single command. can be lead by a ! but it does not have to.
|
|
||||||
*/
|
|
||||||
private string sendCommand(string command)
|
|
||||||
{
|
|
||||||
if (command.StartsWith("!"))
|
|
||||||
{
|
|
||||||
command=command.Substring(1);
|
|
||||||
}
|
|
||||||
if (Client == null)
|
|
||||||
{
|
|
||||||
Client = new Client(new BasicHttpBinding(), new EndpointAddress(URL));
|
|
||||||
}
|
|
||||||
return Client.HandleCommand(command);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximize again when double clicked on tray icon
|
|
||||||
*/
|
|
||||||
private void ASFGUI_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
this.Show();
|
|
||||||
this.WindowState = FormWindowState.Normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Form1_Load(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
this.Resize += new System.EventHandler(this.Form1_Resize);
|
|
||||||
textBox2.ScrollBars = ScrollBars.Vertical;
|
|
||||||
textBox1.ScrollBars = ScrollBars.Vertical;
|
|
||||||
checkBox4.Checked = true;
|
|
||||||
textBox3.Text = "http://localhost:1242/ASF";
|
|
||||||
URL = "http://localhost:1242/ASF";
|
|
||||||
textBox2.Anchor = (AnchorStyles.Right | AnchorStyles.Left);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Minimize to tray instead of taskbar
|
|
||||||
*/
|
|
||||||
private void Form1_Resize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (FormWindowState.Minimized == this.WindowState)
|
|
||||||
{
|
|
||||||
ASFGUI.Visible = true;
|
|
||||||
this.Hide();
|
|
||||||
}
|
|
||||||
else if (FormWindowState.Normal == this.WindowState)
|
|
||||||
{
|
|
||||||
ASFGUI.Visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* generate a command from a simple command
|
|
||||||
* That means, adds a botName or makes multiple commands for multiple bots.
|
|
||||||
*/
|
|
||||||
private string generateCommand(string command, string arg = "")
|
|
||||||
{
|
|
||||||
if (sendOne)
|
|
||||||
return command + " " + botName + " " + arg;
|
|
||||||
if (sendAll)
|
|
||||||
{
|
|
||||||
string ret = "";
|
|
||||||
foreach (string str in botList)
|
|
||||||
{
|
|
||||||
ret = ret + command + " " + str + " " + arg + "\r\n";
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
return command + arg;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* One of the simple buttons got pressed
|
|
||||||
*/
|
|
||||||
private void buttonPressed(string command)
|
|
||||||
{
|
|
||||||
textBox1.Text = generateCommand(command);
|
|
||||||
if (!safeMode)
|
|
||||||
button1_Click(this, null);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* One of the complicated buttons was pressed
|
|
||||||
* We get an argumentlist
|
|
||||||
*/
|
|
||||||
private void multiCommand(string command)
|
|
||||||
{
|
|
||||||
if (sendAll)
|
|
||||||
return;
|
|
||||||
string[] arr = textBox1.Lines;
|
|
||||||
string cmd = "";
|
|
||||||
for (int i = 0; i < arr.Length; i++)
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(arr[i].Trim()))
|
|
||||||
{
|
|
||||||
cmd = cmd + generateCommand(command, arr[i].Trim()) + "\r\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
textBox1.Text = cmd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* updates the WCF URL in case of custom URL
|
|
||||||
*/
|
|
||||||
private void textBox3_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
URL = textBox3.Text;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
botName= comboBox1.SelectedItem.ToString();
|
|
||||||
}
|
|
||||||
//Ok, radiobuttons would have been better I guess, to lazy to change now.
|
|
||||||
private void checkBox3_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//specific
|
|
||||||
if (checkBox3.Checked)
|
|
||||||
{
|
|
||||||
sendAll = false;
|
|
||||||
sendAny = false;
|
|
||||||
sendOne = true;
|
|
||||||
checkBox2.Checked = false;
|
|
||||||
checkBox4.Checked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkBox2_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//all
|
|
||||||
if (checkBox2.Checked)
|
|
||||||
{
|
|
||||||
sendAll = true;
|
|
||||||
sendAny = false;
|
|
||||||
sendOne = false;
|
|
||||||
checkBox3.Checked = false;
|
|
||||||
checkBox4.Checked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkBox4_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//any
|
|
||||||
if (checkBox4.Checked)
|
|
||||||
{
|
|
||||||
sendAll = false;
|
|
||||||
sendAny = true;
|
|
||||||
sendOne = false;
|
|
||||||
checkBox2.Checked = false;
|
|
||||||
checkBox3.Checked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
safeMode = checkBox1.Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send command button.
|
|
||||||
*/
|
|
||||||
private void button1_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < textBox1.Lines.Length; i++)
|
|
||||||
{
|
|
||||||
string command = textBox1.Lines[i];
|
|
||||||
if (!String.IsNullOrEmpty(command.Trim()))
|
|
||||||
{
|
|
||||||
sendCommand(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Update /Generate Botlist button
|
|
||||||
*/
|
|
||||||
private void button6_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
string ret = sendCommand("statusall");
|
|
||||||
string[] arr = ret.Split('\n');
|
|
||||||
int botAmount = Convert.ToInt16(arr[arr.Length - 1].Split('/')[1].Trim().Split(' ')[0]);
|
|
||||||
botList = new string[botAmount];
|
|
||||||
for (int i = 0; i < botAmount; i++)
|
|
||||||
{
|
|
||||||
botList[i] = arr[arr.Length - 2 - i].Substring(3).Trim().Split(' ')[0];
|
|
||||||
}
|
|
||||||
comboBox1.Items.AddRange(botList);
|
|
||||||
}
|
|
||||||
|
|
||||||
//The Rest are simple buttons.
|
|
||||||
private void button3_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
multiCommand("redeem");
|
|
||||||
}
|
|
||||||
private void button2_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
textBox1.Text = generateCommand("loot");
|
|
||||||
if (!safeMode)
|
|
||||||
button1_Click(this, null);
|
|
||||||
}
|
|
||||||
private void button4_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
//2fa
|
|
||||||
textBox1.Text = generateCommand("2fa");
|
|
||||||
if (!safeMode)
|
|
||||||
button1_Click(this, null);
|
|
||||||
}
|
|
||||||
private void button5_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("2faok");
|
|
||||||
}
|
|
||||||
private void button7_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("2fano");
|
|
||||||
}
|
|
||||||
private void button8_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (sendAll)
|
|
||||||
return;
|
|
||||||
textBox1.Text = generateCommand("2faoff");
|
|
||||||
}
|
|
||||||
private void button9_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
textBox1.Text = "exit";
|
|
||||||
}
|
|
||||||
private void button10_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("farm");
|
|
||||||
}
|
|
||||||
private void button11_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("help");
|
|
||||||
}
|
|
||||||
private void button12_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("start");
|
|
||||||
}
|
|
||||||
private void button13_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("stop");
|
|
||||||
}
|
|
||||||
private void button14_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("pause");
|
|
||||||
}
|
|
||||||
private void button15_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
buttonPressed("status");
|
|
||||||
}
|
|
||||||
private void button16_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
textBox1.Text = "statusall";
|
|
||||||
if (!safeMode)
|
|
||||||
button1_Click(this, null);
|
|
||||||
}
|
|
||||||
private void button17_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
multiCommand("owns");
|
|
||||||
}
|
|
||||||
private void button18_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
multiCommand("addlicense");
|
|
||||||
}
|
|
||||||
private void button19_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
multiCommand("play");
|
|
||||||
}
|
|
||||||
private void button20_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
textBox1.Text = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//############### After this point copied from Archie's WCF ###################
|
|
||||||
[ServiceContract]
|
|
||||||
interface IWCF
|
|
||||||
{
|
|
||||||
[OperationContract]
|
|
||||||
string HandleCommand(string input);
|
|
||||||
}
|
|
||||||
class Client : ClientBase<IWCF>, IWCF
|
|
||||||
{
|
|
||||||
internal Client(System.ServiceModel.Channels.Binding binding, EndpointAddress address) : base(binding, address) { }
|
|
||||||
|
|
||||||
public string HandleCommand(string input)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return Channel.HandleCommand(input);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
//Logging.LogGenericException(e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
83
WcfClientGui/Form2.Designer.cs
generated
83
WcfClientGui/Form2.Designer.cs
generated
@@ -1,83 +0,0 @@
|
|||||||
namespace Gui2
|
|
||||||
{
|
|
||||||
partial class Form2
|
|
||||||
{
|
|
||||||
/// <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.button1 = new System.Windows.Forms.Button();
|
|
||||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
this.button1.Location = new System.Drawing.Point(178, 114);
|
|
||||||
this.button1.Name = "button1";
|
|
||||||
this.button1.Size = new System.Drawing.Size(116, 34);
|
|
||||||
this.button1.TabIndex = 0;
|
|
||||||
this.button1.Text = "OK";
|
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
|
||||||
//
|
|
||||||
// textBox1
|
|
||||||
//
|
|
||||||
this.textBox1.Location = new System.Drawing.Point(16, 77);
|
|
||||||
this.textBox1.Name = "textBox1";
|
|
||||||
this.textBox1.Size = new System.Drawing.Size(446, 22);
|
|
||||||
this.textBox1.TabIndex = 1;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(13, 9);
|
|
||||||
this.label1.Name = "label1";
|
|
||||||
this.label1.Size = new System.Drawing.Size(46, 17);
|
|
||||||
this.label1.TabIndex = 2;
|
|
||||||
this.label1.Text = "label1";
|
|
||||||
//
|
|
||||||
// Form2
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(474, 162);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.textBox1);
|
|
||||||
this.Controls.Add(this.button1);
|
|
||||||
this.Name = "Form2";
|
|
||||||
this.Text = "Input";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private System.Windows.Forms.Button button1;
|
|
||||||
private System.Windows.Forms.TextBox textBox1;
|
|
||||||
private System.Windows.Forms.Label label1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Gui2
|
|
||||||
{
|
|
||||||
static class Program
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
|
||||||
/// </summary>
|
|
||||||
[STAThread]
|
|
||||||
static void Main()
|
|
||||||
{
|
|
||||||
Application.EnableVisualStyles();
|
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
|
||||||
Application.Run(new Form1());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
/*
|
|
||||||
_ _ _ ____ _ _____
|
|
||||||
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
|
||||||
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
|
||||||
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
|
||||||
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
|
||||||
|
|
||||||
Copyright 2015-2016 Florian "KlappPC" Lang
|
|
||||||
Contact: ichhoeremusik@gmx.net
|
|
||||||
This file is mostly done by a friend who explicitly does not want to get mentioned in any way.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Gui2
|
|
||||||
{
|
|
||||||
/*basically a class to run executables as controlled prozess in the background*/
|
|
||||||
public class ServerProcess
|
|
||||||
{
|
|
||||||
//ASF.exe in our case
|
|
||||||
protected Process process;
|
|
||||||
//handling the output.
|
|
||||||
protected Thread outputThread;
|
|
||||||
protected bool stopping;
|
|
||||||
|
|
||||||
//the textbox from our Form, where we want to display output.
|
|
||||||
private TextBox output;
|
|
||||||
|
|
||||||
private object lockObj = new object();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* New SeverProcess for filename with arguments and output to textBox.
|
|
||||||
* Console is hidden and IO redirected.
|
|
||||||
*/
|
|
||||||
public ServerProcess(string fileName, string argumants,TextBox textBox){
|
|
||||||
|
|
||||||
|
|
||||||
output = textBox;
|
|
||||||
process = new System.Diagnostics.Process();
|
|
||||||
|
|
||||||
process.StartInfo.FileName = fileName;
|
|
||||||
process.StartInfo.Arguments = argumants;
|
|
||||||
process.StartInfo.UseShellExecute = false;
|
|
||||||
process.StartInfo.RedirectStandardInput = true;
|
|
||||||
process.StartInfo.RedirectStandardError = true;
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
|
||||||
process.StartInfo.CreateNoWindow = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
//needed for realizing when input is needed.
|
|
||||||
private int dotcounter = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* I'm not quite happy with this. I could not figure a way to notice when input is required
|
|
||||||
* besides reading char by char and searching for keywords. Will stop working, if the "Please enter"
|
|
||||||
* lines gets changed.
|
|
||||||
* Only tested for "Enter Password."
|
|
||||||
*/
|
|
||||||
private void NewOutput(object sender, char e)
|
|
||||||
{
|
|
||||||
MethodInvoker mi = delegate
|
|
||||||
{
|
|
||||||
output.AppendText(e.ToString());
|
|
||||||
};
|
|
||||||
|
|
||||||
if (e == '.')
|
|
||||||
{
|
|
||||||
dotcounter++;
|
|
||||||
}
|
|
||||||
else if(e == ':') {
|
|
||||||
dotcounter = 3;
|
|
||||||
}else{
|
|
||||||
dotcounter = 0;
|
|
||||||
}
|
|
||||||
if (dotcounter == 3) {
|
|
||||||
string[] arr = output.Lines;
|
|
||||||
string str = arr[arr.Length - 1];
|
|
||||||
if (str.Contains("Hit enter"))
|
|
||||||
{
|
|
||||||
str = arr[arr.Length - 2] + " | " + str;
|
|
||||||
Form f = new Form2(this, str);
|
|
||||||
f.ShowDialog();
|
|
||||||
mi = delegate{output.AppendText(e.ToString()+"\n");};
|
|
||||||
}
|
|
||||||
if (str.Contains("Please enter"))
|
|
||||||
{
|
|
||||||
Form f = new Form2(this, str);
|
|
||||||
f.ShowDialog();
|
|
||||||
mi = delegate { output.AppendText(e.ToString() + "\n"); };
|
|
||||||
}
|
|
||||||
|
|
||||||
dotcounter = 0;
|
|
||||||
}
|
|
||||||
output.Invoke(mi);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void NewOutput(object sender, string e)
|
|
||||||
{
|
|
||||||
MethodInvoker mi = delegate
|
|
||||||
{
|
|
||||||
output.AppendText(e+"\n");
|
|
||||||
};
|
|
||||||
output.Invoke(mi);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void printOutPut() {
|
|
||||||
char str;
|
|
||||||
int i;
|
|
||||||
string s;
|
|
||||||
while (!stopping)
|
|
||||||
{
|
|
||||||
//thats ugly, but when using readline we can't catch input.
|
|
||||||
while (((i = process.StandardOutput.Read()) != 0))
|
|
||||||
{
|
|
||||||
str=System.Convert.ToChar(i);
|
|
||||||
NewOutput(this, str);
|
|
||||||
if (stopping)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (((s = process.StandardError.ReadLine()) != null))
|
|
||||||
{
|
|
||||||
NewOutput(this, s);
|
|
||||||
if (stopping)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Write(string msg) {
|
|
||||||
process.StandardInput.WriteLine(msg);
|
|
||||||
process.StandardInput.Flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop() {
|
|
||||||
Thread stopThread = new Thread(StopProcess);
|
|
||||||
stopThread.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StopProcess() {
|
|
||||||
|
|
||||||
if (process == null)
|
|
||||||
return;
|
|
||||||
stopping = true;
|
|
||||||
|
|
||||||
outputThread.Abort();
|
|
||||||
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
|
|
||||||
if (process == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (process.HasExited)
|
|
||||||
process.Close();
|
|
||||||
else
|
|
||||||
process.Kill();
|
|
||||||
|
|
||||||
process = null;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* starts the process and a second thread to listen for output.
|
|
||||||
*/
|
|
||||||
public void Start() {
|
|
||||||
outputThread = new Thread(printOutPut);
|
|
||||||
process.Start();
|
|
||||||
outputThread.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Process Process {
|
|
||||||
get {
|
|
||||||
return process;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user