-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
143 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
_ _ _ ____ _ _____ | ||
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ | ||
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ | ||
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | | ||
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| | ||
Copyright 2015-2016 Łukasz "JustArchi" Domeradzki | ||
Contact: [email protected] | ||
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. | ||
*/ | ||
|
||
namespace GUI { | ||
internal static class Debugging { | ||
#if DEBUG | ||
internal static readonly bool IsDebugBuild = true; | ||
#else | ||
internal static readonly bool IsDebugBuild = false; | ||
#endif | ||
|
||
internal static bool IsReleaseBuild => !IsDebugBuild; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,9 @@ _ _ _ ____ _ _____ | |
Copyright 2015-2016 Florian "KlappPC" Lang | ||
Contact: [email protected] | ||
Copyright 2015-2016 Łukasz "JustArchi" Domeradzki | ||
Contact: [email protected] | ||
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 | ||
|
@@ -23,9 +26,9 @@ limitations under the License. | |
*/ | ||
|
||
using System; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
using System.ServiceModel; | ||
using System.IO; | ||
|
||
namespace GUI { | ||
|
||
|
@@ -43,11 +46,16 @@ 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); | ||
string ASF = "ASF.exE"; | ||
if (!File.Exists(ASF)) { | ||
ASF = "../../../ArchiSteamFarm/bin/" + (Debugging.IsDebugBuild ? "Debug" : "Release") + "/ArchiSteamFarm.exe2"; | ||
if (!File.Exists(ASF)) { | ||
Logging.LogGenericError("ASF binary could not be found!"); | ||
Environment.Exit(1); | ||
} | ||
} | ||
|
||
proc = new ServerProcess(ASF, "--server", textBox2); | ||
proc.Start(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
_ _ _ ____ _ _____ | ||
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ | ||
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ | ||
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | | ||
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| | ||
Copyright 2015-2016 Łukasz "JustArchi" Domeradzki | ||
Contact: [email protected] | ||
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.Diagnostics; | ||
using System.Runtime.CompilerServices; | ||
using System.Windows.Forms; | ||
|
||
namespace GUI { | ||
internal static class Logging { | ||
internal static void LogGenericInfo(string message) { | ||
if (string.IsNullOrEmpty(message)) { | ||
return; | ||
} | ||
|
||
MessageBox.Show(message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); | ||
} | ||
|
||
internal static void LogGenericWTF(string message, [CallerMemberName] string previousMethodName = "") { | ||
if (string.IsNullOrEmpty(message)) { | ||
return; | ||
} | ||
|
||
MessageBox.Show(previousMethodName + "() " + message, "WTF", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
|
||
internal static void LogGenericError(string message, [CallerMemberName] string previousMethodName = "") { | ||
if (string.IsNullOrEmpty(message)) { | ||
return; | ||
} | ||
|
||
MessageBox.Show(previousMethodName + "() " + message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
} | ||
|
||
internal static void LogGenericException(Exception exception, [CallerMemberName] string previousMethodName = "") { | ||
if (exception == null) { | ||
return; | ||
} | ||
|
||
MessageBox.Show(previousMethodName + "() " + exception.Message + Environment.NewLine + exception.StackTrace, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); | ||
|
||
if (exception.InnerException != null) { | ||
LogGenericException(exception.InnerException, previousMethodName); | ||
} | ||
} | ||
|
||
internal static void LogGenericWarning(string message, [CallerMemberName] string previousMethodName = "") { | ||
if (string.IsNullOrEmpty(message)) { | ||
return; | ||
} | ||
|
||
MessageBox.Show(previousMethodName + "() " + message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); | ||
} | ||
|
||
internal static void LogNullError(string nullObjectName, [CallerMemberName] string previousMethodName = "") { | ||
if (string.IsNullOrEmpty(nullObjectName)) { | ||
return; | ||
} | ||
|
||
LogGenericError(nullObjectName + " is null!", previousMethodName); | ||
} | ||
|
||
[Conditional("DEBUG")] | ||
internal static void LogGenericDebug(string message, [CallerMemberName] string previousMethodName = "") { | ||
if (string.IsNullOrEmpty(message)) { | ||
return; | ||
} | ||
|
||
MessageBox.Show(previousMethodName + "() " + message, "Debug", MessageBoxButtons.OK, MessageBoxIcon.Information); | ||
} | ||
} | ||
} |