Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Added support for remote ASF.
Browse files Browse the repository at this point in the history
  • Loading branch information
alvr committed Jun 25, 2016
1 parent 3b5bfb8 commit 74b26a5
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 43 deletions.
41 changes: 20 additions & 21 deletions ASFui/ASFui.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 20 additions & 8 deletions ASFui/ASFui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public ASFui()
Environment.Exit(-2);
}
InitializeComponent();
ASFProcess.StartInfo.FileName = Properties.Settings.Default.ASFBinary;
}

private void ASFui_Resize(object sender, EventArgs e)
Expand All @@ -48,20 +49,21 @@ private void ASFui_Resize(object sender, EventArgs e)

private void ASFui_FormClosing(object sender, FormClosingEventArgs e)
{
if (!_asfRunning) return;
if (!_asfRunning || !Properties.Settings.Default.IsLocal) return;
ASFProcess.Kill();
ASFProcess.CancelOutputRead();
BackgroundWorker.CancelAsync();
}

private void BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
{
if (!Properties.Settings.Default.IsLocal) return;
ASFProcess.Start();
ASFProcess.BeginOutputReadLine();
ASFProcess.WaitForExit();
}

private void ProcesoASF_OutputDataReceived(object sender, DataReceivedEventArgs e)
private void ASFProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
rtbOutput.AppendText(e.Data + Environment.NewLine);
rtbOutput.SelectionStart = rtbOutput.Text.Length;
Expand Down Expand Up @@ -141,14 +143,20 @@ private void btnASFuiSettings_Click(object sender, EventArgs e)
#region Cards Buttons
private void btnFarm_Click(object sender, EventArgs e)
{
var result = Util.SendCommand(Util.GenerateCommand("farm", cbBotList.SelectedItem.ToString()));
tsslCommandOutput.Text = @"!farm <" + cbBotList.SelectedItem + @">: " + result;
Task.Run(() =>
{
var result = Util.SendCommand(Util.GenerateCommand("farm", cbBotList.SelectedItem.ToString()));
tsslCommandOutput.Text = @"!farm <" + cbBotList.SelectedItem + @">: " + result;
});
}

private void btnLoot_Click(object sender, EventArgs e)
{
var result = Util.SendCommand(Util.GenerateCommand("loot", cbBotList.SelectedItem.ToString()));
tsslCommandOutput.Text = @"!loot <" + cbBotList.SelectedItem + @">: " + result;
Task.Run(() =>
{
var result = Util.SendCommand(Util.GenerateCommand("loot", cbBotList.SelectedItem.ToString()));
tsslCommandOutput.Text = @"!loot <" + cbBotList.SelectedItem + @">: " + result;
});
}
#endregion

Expand Down Expand Up @@ -181,8 +189,12 @@ private void btnOwns_Click(object sender, EventArgs e)

private void btnPlay_Click(object sender, EventArgs e)
{
var result = Util.SendCommand(Util.GenerateCommand("play", cbBotList.SelectedItem.ToString(), Util.MultiToOne(tbInput.Lines)));
tsslCommandOutput.Text = @"!play <" + cbBotList.SelectedItem + @">: " + result;
Task.Run(() =>
{
var result =
Util.SendCommand(Util.GenerateCommand("play", cbBotList.SelectedItem.ToString(), Util.MultiToOne(tbInput.Lines)));
tsslCommandOutput.Text = @"!play <" + cbBotList.SelectedItem + @">: " + result;
});
}
#endregion

Expand Down
3 changes: 3 additions & 0 deletions ASFui/ASFui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ASFProcess.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ASFui.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
16 changes: 8 additions & 8 deletions ASFui/ASFui.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ASFProcess.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>174, 17</value>
</metadata>
<metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>504, 17</value>
</metadata>
<metadata name="BackgroundWorker.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="TrayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>287, 17</value>
<value>274, 17</value>
</metadata>
<metadata name="cmsTrayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>385, 17</value>
<value>372, 17</value>
</metadata>
<metadata name="StatusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>491, 17</value>
</metadata>
<metadata name="ASFProcess.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>174, 17</value>
</metadata>
</root>
6 changes: 6 additions & 0 deletions ASFui/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
<setting name="ASFBinary" serializeAs="String">
<value>ASF.exe</value>
</setting>
<setting name="IsLocal" serializeAs="String">
<value>True</value>
</setting>
<setting name="RemoteURL" serializeAs="String">
<value />
</setting>
</ASFui.Properties.Settings>
</userSettings>
</configuration>
24 changes: 24 additions & 0 deletions ASFui/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ASFui/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@
<Setting Name="ASFBinary" Type="System.String" Scope="User">
<Value Profile="(Default)">ASF.exe</Value>
</Setting>
<Setting Name="IsLocal" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="RemoteURL" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
82 changes: 81 additions & 1 deletion ASFui/SettingsForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 74b26a5

Please sign in to comment.