-
-
Notifications
You must be signed in to change notification settings - Fork 416
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
48 changed files
with
2,479 additions
and
224 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 |
---|---|---|
|
@@ -37,6 +37,7 @@ packages/ | |
SyncTrayzorSetup*.exe | ||
SyncTrayzorPortable* | ||
syncthing-*.exe | ||
syncthing.exe | ||
|
||
*.gjq | ||
*.tmp | ||
|
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
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
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
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
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,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ProcessRunner | ||
{ | ||
// Stolen from http://stackoverflow.com/a/298990/1086121 | ||
public static class StringExtensions | ||
{ | ||
public static IEnumerable<string> SplitCommandLine(string commandLine) | ||
{ | ||
bool inQuotes = false; | ||
|
||
return commandLine.Split(c => | ||
{ | ||
if (c == '\"') | ||
inQuotes = !inQuotes; | ||
|
||
return !inQuotes && c == ' '; | ||
}) | ||
.Select(arg => arg.Trim().TrimMatchingQuotes('\"')) | ||
.Where(arg => !string.IsNullOrEmpty(arg)); | ||
} | ||
|
||
public static IEnumerable<string> Split(this string str, Func<char, bool> controller) | ||
{ | ||
int nextPiece = 0; | ||
|
||
for (int c = 0; c < str.Length; c++) | ||
{ | ||
if (controller(str[c])) | ||
{ | ||
yield return str.Substring(nextPiece, c - nextPiece); | ||
nextPiece = c + 1; | ||
} | ||
} | ||
|
||
yield return str.Substring(nextPiece); | ||
} | ||
|
||
public static string TrimMatchingQuotes(this string input, char quote) | ||
{ | ||
if ((input.Length >= 2) && | ||
(input[0] == quote) && (input[input.Length - 1] == quote)) | ||
return input.Substring(1, input.Length - 2); | ||
|
||
return input; | ||
} | ||
|
||
public static string JoinCommandLine(IEnumerable<string> input) | ||
{ | ||
return String.Join(" ", input.Select(x => x.Contains(' ') ? String.Format("\"{0}\"", x.Replace("\"", "\\\"")) : x)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.