Compare commits

..

15 Commits

Author SHA1 Message Date
JustArchi
51abdfb899 Bring back HackedLogOn()
It's still needed...
2016-07-12 03:56:35 +02:00
JustArchi
658d6129a7 Add --until-clean-exit 2016-07-11 19:22:25 +02:00
JustArchi
55c1674309 Add --aot to usage 2016-07-11 19:08:08 +02:00
JustArchi
9efae3edae Don't AOT by default 2016-07-11 19:07:17 +02:00
JustArchi
d1e047edf8 Remove old converter 2016-07-10 20:57:59 +02:00
JustArchi
8742ace3d7 Bump 2016-07-10 20:30:00 +02:00
JustArchi
feb3fbfe59 Get used to null propagation 2016-07-10 20:17:35 +02:00
JustArchi
0b06df4352 Misc 2016-07-10 20:10:14 +02:00
JustArchi
10b1d02a95 Rename JsonStorage -> InMemory 2016-07-09 12:24:21 +02:00
JustArchi
7731360f09 One more correction, thanks @Netshroud 2016-07-09 11:39:54 +02:00
JustArchi
02d3454d1b Avoid enumerating over Servers 2016-07-09 11:15:25 +02:00
JustArchi
54b8d3e6f3 Use extended result where appropriate 2016-07-09 09:20:56 +02:00
Łukasz Domeradzki
0b65e1d9a1 Merge pull request #286 from justin-gerhardt/master
preventing the creation of the default event source
2016-07-08 11:12:10 +02:00
Justin Gerhardt
1f5005f14d preventing the creation of the default event source 2016-07-08 05:04:48 -04:00
JustArchi
6414f375fd Bump 2016-07-08 10:30:08 +02:00
21 changed files with 110 additions and 186 deletions

View File

@@ -10,6 +10,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=FS/@EntryIndexedValue">FS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HTML/@EntryIndexedValue">HTML</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OK/@EntryIndexedValue">OK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=PIN/@EntryIndexedValue">PIN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SC/@EntryIndexedValue">SC</s:String>

View File

@@ -177,6 +177,44 @@ namespace ArchiSteamFarm {
*/
// TODO: Remove me once https://github.com/SteamRE/SteamKit/issues/305 is fixed
internal void LogOnWithoutMachineID(SteamUser.LogOnDetails details) {
ClientMsgProtobuf<CMsgClientLogon> logon = new ClientMsgProtobuf<CMsgClientLogon>(EMsg.ClientLogon);
SteamID steamId = new SteamID(details.AccountID, details.AccountInstance, Client.ConnectedUniverse, EAccountType.Individual);
if (details.LoginID != null) {
logon.Body.obfustucated_private_ip = details.LoginID.Value;
}
logon.ProtoHeader.client_sessionid = 0;
logon.ProtoHeader.steamid = steamId.ConvertToUInt64();
logon.Body.account_name = details.Username;
logon.Body.password = details.Password;
logon.Body.should_remember_password = details.ShouldRememberPassword;
logon.Body.protocol_version = MsgClientLogon.CurrentProtocol;
logon.Body.client_os_type = (uint) details.ClientOSType;
logon.Body.client_language = details.ClientLanguage;
logon.Body.cell_id = details.CellID;
logon.Body.steam2_ticket_request = details.RequestSteam2Ticket;
logon.Body.client_package_version = 1771;
logon.Body.auth_code = details.AuthCode;
logon.Body.two_factor_code = details.TwoFactorCode;
logon.Body.login_key = details.LoginKey;
logon.Body.sha_sentryfile = details.SentryFileHash;
logon.Body.eresult_sentryfile = (int) (details.SentryFileHash != null ? EResult.OK : EResult.FileNotFound);
Client.Send(logon);
}
internal void PlayGame(string gameName) {
if (!Client.IsConnected) {
return;

View File

@@ -46,6 +46,8 @@ namespace ArchiSteamFarm {
// System account, requires admin privilege to install
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
serviceInstaller.Installers.Clear();
EventLogInstaller logInstaller = new EventLogInstaller {
Log = SharedInfo.EventLog,
Source = SharedInfo.EventLogSource

View File

@@ -130,10 +130,9 @@
<Compile Include="JSON\GitHub.cs" />
<Compile Include="JSON\Steam.cs" />
<Compile Include="Logging.cs" />
<Compile Include="JsonStorageServerListProvider.cs" />
<Compile Include="InMemoryServerListProvider.cs" />
<Compile Include="MobileAuthenticator.cs" />
<Compile Include="Runtime.cs" />
<Compile Include="ObsoleteSteamGuardAccount.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SharedInfo.cs" />

View File

@@ -377,11 +377,8 @@ namespace ArchiSteamFarm {
string request = SteamCommunityURL + "/my/games/?xml=1";
XmlDocument response = await WebBrowser.UrlGetToXMLRetry(request).ConfigureAwait(false);
if (response == null) {
return null;
}
XmlNodeList xmlNodeList = response.SelectNodes("gamesList/games/game");
XmlNodeList xmlNodeList = response?.SelectNodes("gamesList/games/game");
if ((xmlNodeList == null) || (xmlNodeList.Count == 0)) {
return null;
}
@@ -492,11 +489,8 @@ namespace ArchiSteamFarm {
string request = SteamCommunityURL + "/tradeoffer/" + tradeID + "?l=english";
HtmlDocument htmlDocument = await WebBrowser.UrlGetToHtmlDocumentRetry(request).ConfigureAwait(false);
if (htmlDocument == null) {
return null;
}
HtmlNode htmlNode = htmlDocument.DocumentNode.SelectSingleNode("//div[@class='pagecontent']/script");
HtmlNode htmlNode = htmlDocument?.DocumentNode.SelectSingleNode("//div[@class='pagecontent']/script");
if (htmlNode == null) { // Trade can be no longer valid
return null;
}
@@ -713,11 +707,8 @@ namespace ArchiSteamFarm {
string request = SteamCommunityURL + "/my/inventory/json/" + Steam.Item.SteamAppID + "/" + Steam.Item.SteamContextID + "?trading=" + (tradable ? "1" : "0") + "&start=" + currentPage;
JObject jObject = await WebBrowser.UrlGetToJObjectRetry(request).ConfigureAwait(false);
if (jObject == null) {
return null;
}
IEnumerable<JToken> descriptions = jObject.SelectTokens("$.rgDescriptions.*");
IEnumerable<JToken> descriptions = jObject?.SelectTokens("$.rgDescriptions.*");
if (descriptions == null) {
return null; // OK, empty inventory
}
@@ -913,11 +904,7 @@ namespace ArchiSteamFarm {
string request = SteamCommunityURL + "/my/videos";
Uri uri = await WebBrowser.UrlHeadToUriRetry(request).ConfigureAwait(false);
if (uri == null) {
return null;
}
return !uri.AbsolutePath.StartsWith("/login", StringComparison.Ordinal);
return !uri?.AbsolutePath.StartsWith("/login", StringComparison.Ordinal);
}
private async Task<bool> RefreshSessionIfNeeded() {

View File

@@ -152,15 +152,6 @@ namespace ArchiSteamFarm {
return;
}
// TODO: Converter code will be removed soon
if (BotDatabase.SteamGuardAccount != null) {
Logging.LogGenericWarning("Converting old ASF 2FA V2.0 format into new ASF 2FA V2.1 format...", botName);
BotDatabase.MobileAuthenticator = MobileAuthenticator.LoadFromSteamGuardAccount(BotDatabase.SteamGuardAccount);
Logging.LogGenericInfo("Done! If you didn't make a copy of your revocation code yet, then it's a good moment to do so: " + BotDatabase.SteamGuardAccount.RevocationCode, botName);
Logging.LogGenericWarning("ASF will not keep this code anymore!", botName);
BotDatabase.SteamGuardAccount = null;
}
if (BotDatabase.MobileAuthenticator != null) {
BotDatabase.MobileAuthenticator.Init(this);
} else {
@@ -252,25 +243,11 @@ namespace ArchiSteamFarm {
LoginSemaphore.Dispose();
HandledGifts.Dispose();
if (AcceptConfirmationsTimer != null) {
AcceptConfirmationsTimer.Dispose();
}
if (ArchiWebHandler != null) {
ArchiWebHandler.Dispose();
}
if (CardsFarmer != null) {
CardsFarmer.Dispose();
}
if (SendItemsTimer != null) {
SendItemsTimer.Dispose();
}
if (Trading != null) {
Trading.Dispose();
}
AcceptConfirmationsTimer?.Dispose();
ArchiWebHandler?.Dispose();
CardsFarmer?.Dispose();
SendItemsTimer?.Dispose();
Trading?.Dispose();
}
internal async Task AcceptConfirmations(bool accept, Steam.ConfirmationDetails.EType acceptedType = Steam.ConfirmationDetails.EType.Unknown, ulong acceptedSteamID = 0, HashSet<ulong> acceptedTradeIDs = null) {
@@ -333,7 +310,7 @@ namespace ArchiSteamFarm {
return false;
}
if ((callback == null) || string.IsNullOrEmpty(callback.Nonce)) {
if (string.IsNullOrEmpty(callback?.Nonce)) {
Start().Forget();
return false;
}
@@ -1544,7 +1521,7 @@ namespace ArchiSteamFarm {
TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false);
}
SteamUser.LogOn(new SteamUser.LogOnDetails {
SteamUser.LogOnDetails logOnDetails = new SteamUser.LogOnDetails {
Username = BotConfig.SteamLogin,
Password = BotConfig.SteamPassword,
AuthCode = AuthCode,
@@ -1554,7 +1531,14 @@ namespace ArchiSteamFarm {
TwoFactorCode = TwoFactorCode,
SentryFileHash = sentryHash,
ShouldRememberPassword = true
});
};
try {
SteamUser.LogOn(logOnDetails);
} catch {
// TODO: Remove me once https://github.com/SteamRE/SteamKit/issues/305 is fixed
ArchiHandler.LogOnWithoutMachineID(logOnDetails);
}
}
private async void OnDisconnected(SteamClient.DisconnectedCallback callback) {
@@ -1609,7 +1593,7 @@ namespace ArchiSteamFarm {
}
private async void OnGuestPassList(SteamApps.GuestPassListCallback callback) {
if ((callback == null) || (callback.GuestPasses == null)) {
if (callback?.GuestPasses == null) {
Logging.LogNullError(nameof(callback) + " || " + nameof(callback.GuestPasses), BotName);
return;
}
@@ -1647,7 +1631,7 @@ namespace ArchiSteamFarm {
}
private void OnChatInvite(SteamFriends.ChatInviteCallback callback) {
if ((callback == null) || (callback.ChatRoomID == null) || (callback.PatronID == null)) {
if ((callback?.ChatRoomID == null) || (callback.PatronID == null)) {
Logging.LogNullError(nameof(callback) + " || " + nameof(callback.ChatRoomID) + " || " + nameof(callback.PatronID), BotName);
return;
}
@@ -1689,7 +1673,7 @@ namespace ArchiSteamFarm {
}
private void OnFriendsList(SteamFriends.FriendsListCallback callback) {
if ((callback == null) || (callback.FriendList == null)) {
if (callback?.FriendList == null) {
Logging.LogNullError(nameof(callback) + " || " + nameof(callback.FriendList), BotName);
return;
}
@@ -1722,7 +1706,7 @@ namespace ArchiSteamFarm {
}
private async void OnFriendMsgHistory(SteamFriends.FriendMsgHistoryCallback callback) {
if ((callback == null) || (callback.Messages == null) || (callback.SteamID == null)) {
if ((callback?.Messages == null) || (callback.SteamID == null)) {
Logging.LogNullError(nameof(callback) + " || " + nameof(callback.Messages) + " || " + nameof(callback.SteamID), BotName);
return;
}
@@ -1795,7 +1779,7 @@ namespace ArchiSteamFarm {
break;
case EResult.InvalidPassword:
InvalidPassword = true;
Logging.LogGenericWarning("Unable to login to Steam: " + callback.Result, BotName);
Logging.LogGenericWarning("Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult, BotName);
break;
case EResult.OK:
Logging.LogGenericInfo("Successfully logged on!", BotName);
@@ -1855,17 +1839,17 @@ namespace ArchiSteamFarm {
case EResult.ServiceUnavailable:
case EResult.Timeout:
case EResult.TryAnotherCM:
Logging.LogGenericWarning("Unable to login to Steam: " + callback.Result, BotName);
Logging.LogGenericWarning("Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult, BotName);
break;
default: // Unexpected result, shutdown immediately
Logging.LogGenericError("Unable to login to Steam: " + callback.Result, BotName);
Logging.LogGenericError("Unable to login to Steam: " + callback.Result + " / " + callback.ExtendedResult, BotName);
Stop();
break;
}
}
private void OnLoginKey(SteamUser.LoginKeyCallback callback) {
if ((callback == null) || string.IsNullOrEmpty(callback.LoginKey)) {
if (string.IsNullOrEmpty(callback?.LoginKey)) {
Logging.LogNullError(nameof(callback) + " || " + nameof(callback.LoginKey), BotName);
return;
}

View File

@@ -64,24 +64,6 @@ namespace ArchiSteamFarm {
}
}
// TODO: Converter code will be removed soon
[JsonProperty]
private ObsoleteSteamGuardAccount _SteamGuardAccount;
internal ObsoleteSteamGuardAccount SteamGuardAccount {
get {
return _SteamGuardAccount;
}
set {
if (_SteamGuardAccount == value) {
return;
}
_SteamGuardAccount = value;
Save();
}
}
private readonly object FileLock = new object();
private string FilePath;

View File

@@ -75,9 +75,7 @@ namespace ArchiSteamFarm {
FarmResetEvent.Dispose();
FarmingSemaphore.Dispose();
if (Timer != null) {
Timer.Dispose();
}
Timer?.Dispose();
}
internal async Task SwitchToManualMode(bool manualMode) {

View File

@@ -50,10 +50,6 @@ namespace ArchiSteamFarm {
public bool MoveNext() => Enumerator.MoveNext();
public void Reset() => Enumerator.Reset();
public void Dispose() {
if (Lock != null) {
Lock.ExitReadLock();
}
}
public void Dispose() => Lock?.ExitReadLock();
}
}

View File

@@ -100,11 +100,7 @@ namespace ArchiSteamFarm {
}
}
public void Dispose() {
if (Lock != null) {
Lock.Dispose();
}
}
public void Dispose() => Lock?.Dispose();
public void CopyTo(T[] array, int arrayIndex) {
Lock.EnterReadLock();

View File

@@ -57,7 +57,7 @@ namespace ArchiSteamFarm {
[JsonProperty(Required = Required.DisallowNull)]
[SuppressMessage("ReSharper", "AutoPropertyCanBeMadeGetOnly.Local")]
internal JsonStorageServerListProvider ServerListProvider { get; private set; } = new JsonStorageServerListProvider();
internal InMemoryServerListProvider ServerListProvider { get; private set; } = new InMemoryServerListProvider();
private readonly object FileLock = new object();
@@ -91,14 +91,7 @@ namespace ArchiSteamFarm {
return globalDatabase;
}
private void OnServerListUpdated(object sender, EventArgs e) {
if ((sender == null) || (e == null)) {
Logging.LogNullError(nameof(sender) + " || " + nameof(e));
return;
}
Save();
}
private void OnServerListUpdated(object sender, EventArgs e) => Save();
// This constructor is used when creating new database
private GlobalDatabase(string filePath) : this() {

View File

@@ -25,21 +25,20 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Newtonsoft.Json;
using SteamKit2.Discovery;
namespace ArchiSteamFarm {
internal sealed class JsonStorageServerListProvider : IServerListProvider {
internal sealed class InMemoryServerListProvider : IServerListProvider {
[JsonProperty(Required = Required.DisallowNull)]
[SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
private HashSet<IPEndPoint> Servers = new HashSet<IPEndPoint>();
internal event EventHandler ServerListUpdated = delegate { };
public Task<IEnumerable<IPEndPoint>> FetchServerListAsync() => Task.FromResult(Servers.Select(endpoint => endpoint));
public Task<IEnumerable<IPEndPoint>> FetchServerListAsync() => Task.FromResult<IEnumerable<IPEndPoint>>(Servers);
public Task UpdateServerListAsync(IEnumerable<IPEndPoint> endpoints) {
if (endpoints == null) {

View File

@@ -24,6 +24,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
@@ -33,6 +34,8 @@ using HtmlAgilityPack;
using Newtonsoft.Json;
namespace ArchiSteamFarm {
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
internal sealed class MobileAuthenticator {
internal sealed class Confirmation {
internal readonly uint ID;
@@ -57,30 +60,19 @@ namespace ArchiSteamFarm {
internal bool HasDeviceID => !string.IsNullOrEmpty(DeviceID);
#pragma warning disable 649
[JsonProperty(PropertyName = "shared_secret", Required = Required.DisallowNull)]
private string SharedSecret;
[JsonProperty(PropertyName = "identity_secret", Required = Required.DisallowNull)]
private string IdentitySecret;
#pragma warning restore 649
[JsonProperty(PropertyName = "device_id")]
private string DeviceID;
private Bot Bot;
internal static MobileAuthenticator LoadFromSteamGuardAccount(ObsoleteSteamGuardAccount sga) {
if (sga != null) {
return new MobileAuthenticator {
SharedSecret = sga.SharedSecret,
IdentitySecret = sga.IdentitySecret,
DeviceID = sga.DeviceID
};
}
Logging.LogNullError(nameof(sga));
return null;
}
private MobileAuthenticator() {
}
@@ -173,11 +165,8 @@ namespace ArchiSteamFarm {
}
HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetConfirmations(DeviceID, confirmationHash, time).ConfigureAwait(false);
if (htmlDocument == null) {
return null;
}
HtmlNodeCollection confirmationNodes = htmlDocument.DocumentNode.SelectNodes("//div[@class='mobileconf_list_entry']");
HtmlNodeCollection confirmationNodes = htmlDocument?.DocumentNode.SelectNodes("//div[@class='mobileconf_list_entry']");
if (confirmationNodes == null) {
return null;
}

View File

@@ -1,49 +0,0 @@
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
namespace ArchiSteamFarm {
// TODO: This will be completely removed soon
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "UnusedMember.Global")]
[SuppressMessage("ReSharper", "InconsistentNaming")]
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
[SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")]
public class ObsoleteSteamGuardAccount {
[JsonProperty("shared_secret")]
public string SharedSecret { get; set; }
[JsonProperty("serial_number")]
public string SerialNumber { get; set; }
[JsonProperty("revocation_code")]
public string RevocationCode { get; set; }
[JsonProperty("uri")]
public string URI { get; set; }
[JsonProperty("server_time")]
public long ServerTime { get; set; }
[JsonProperty("account_name")]
public string AccountName { get; set; }
[JsonProperty("token_gid")]
public string TokenGID { get; set; }
[JsonProperty("identity_secret")]
public string IdentitySecret { get; set; }
[JsonProperty("secret_1")]
public string Secret1 { get; set; }
[JsonProperty("status")]
public int Status { get; set; }
[JsonProperty("device_id")]
public string DeviceID { get; set; }
[JsonProperty("fully_enrolled")]
public bool FullyEnrolled { get; set; }
}
}

View File

@@ -437,8 +437,8 @@ namespace ArchiSteamFarm {
}
private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs args) {
if ((sender == null) || (args == null) || (args.ExceptionObject == null)) {
Logging.LogNullError(nameof(sender) + " || " + nameof(args) + " || " + nameof(args.ExceptionObject));
if (args?.ExceptionObject == null) {
Logging.LogNullError(nameof(args) + " || " + nameof(args.ExceptionObject));
return;
}
@@ -446,8 +446,8 @@ namespace ArchiSteamFarm {
}
private static void UnobservedTaskExceptionHandler(object sender, UnobservedTaskExceptionEventArgs args) {
if ((sender == null) || (args == null) || (args.Exception == null)) {
Logging.LogNullError(nameof(sender) + " || " + nameof(args) + " || " + nameof(args.Exception));
if (args?.Exception == null) {
Logging.LogNullError(nameof(args) + " || " + nameof(args.Exception));
return;
}

View File

@@ -24,7 +24,7 @@
namespace ArchiSteamFarm {
internal static class SharedInfo {
internal const string Version = "2.1.2.3";
internal const string Version = "2.1.2.5";
internal const string Copyright = "Copyright © ArchiSteamFarm 2015-2016";
internal const string GithubRepo = "JustArchi/ArchiSteamFarm";

View File

@@ -75,13 +75,8 @@ namespace ArchiSteamFarm {
}
public void Dispose() {
if (ServiceHost != null) {
ServiceHost.Close();
}
if (Client != null) {
Client.Close();
}
ServiceHost?.Close();
Client?.Close();
}
internal bool IsServerRunning() => ServiceHost != null;

View File

@@ -365,7 +365,7 @@ namespace ArchiSteamFarm {
}
using (HttpResponseMessage response = await UrlHeadToResponse(request, referer).ConfigureAwait(false)) {
return response == null ? null : response.RequestMessage.RequestUri;
return response?.RequestMessage.RequestUri;
}
}

View File

@@ -6,4 +6,4 @@ If my issue is not meeting contributing guidelines specified above, especially i
-----
Feel free to remove everything made up to this point, after all you're not being in a primary school.
Now that you read and understood the notice, feel free to remove it and fill with real issue.

8
cc.sh
View File

@@ -2,6 +2,7 @@
set -eu
BUILD="Release"
AOT=0
CLEAN=0
MONO_ARGS=("--aot" "--llvm" "--server" "-O=all")
@@ -10,7 +11,7 @@ BINARIES=("ArchiSteamFarm/bin/Release/ArchiSteamFarm.exe")
SOLUTION="ArchiSteamFarm.sln"
PRINT_USAGE() {
echo "Usage: $0 [--clean] [debug/release]"
echo "Usage: $0 [--clean] [--aot] [debug/release]"
exit 1
}
@@ -18,6 +19,7 @@ for ARG in "$@"; do
case "$ARG" in
release|Release) BUILD="Release" ;;
debug|Debug) BUILD="Debug" ;;
--aot) AOT=1 ;;
--clean) CLEAN=1 ;;
*) PRINT_USAGE
esac
@@ -51,8 +53,8 @@ if [[ ! -f "${BINARIES[0]}" ]]; then
echo "ERROR: ${BINARIES[0]} binary could not be found!"
fi
# If it's release build, use Mono AOT for output binaries
if [[ "$BUILD" = "Release" ]]; then
# Use Mono AOT for output binaries if needed
if [[ "$AOT" -eq 1 && "$BUILD" = "Release" ]]; then
for BINARY in "${BINARIES[@]}"; do
if [[ ! -f "$BINARY" ]]; then
continue

16
run.sh
View File

@@ -2,11 +2,12 @@
set -eu
BUILD="Release"
UNTIL_CLEAN_EXIT=0
MONO_ARGS=("--llvm" "--server" "-O=all")
PRINT_USAGE() {
echo "Usage: $0 [debug/release]"
echo "Usage: $0 [--until-clean-exit] [debug/release]"
exit 1
}
@@ -14,6 +15,7 @@ for ARG in "$@"; do
case "$ARG" in
release|Release) BUILD="Release" ;;
debug|Debug) BUILD="Debug" ;;
--until-clean-exit) UNTIL_CLEAN_EXIT=1 ;;
*) PRINT_USAGE
esac
done
@@ -31,4 +33,14 @@ if [[ ! -f "$BINARY" ]]; then
exit 1
fi
mono "${MONO_ARGS[@]}" "$BINARY"
if [[ "$UNTIL_CLEAN_EXIT" -eq 0 ]]; then
mono "${MONO_ARGS[@]}" "$BINARY"
exit $?
fi
while [[ -f "$BINARY" ]]; do
if mono "${MONO_ARGS[@]}" "$BINARY"; then
break
fi
sleep 1
done