-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit contains some new changes and additions. ## Additions - LocalAdmin now starts by merging command-line args and args contained in `laargs.txt`. This can help with providing a quick & easy way to launch LocalAdmin without having to type arguments each time. ## Changes - `LocalAdmin V2.csproj` now includes `laargs.txt`. That's all. --- ALEXWARELLC
- Loading branch information
1 parent
26b22b7
commit 9dc59c8
Showing
4 changed files
with
47 additions
and
1 deletion.
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
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,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
|
||
namespace LocalAdmin.V2.Core | ||
{ | ||
public sealed class StartupArgManager | ||
{ | ||
/// <summary> | ||
/// Path to startup arguments file. | ||
/// </summary> | ||
private const string StartupArgsPath = "laargs.txt"; | ||
|
||
/// <summary> | ||
/// Merges Command-line arguments and arguments in <paramref name="StartupArgsPath"/> | ||
/// </summary> | ||
/// <param name="CMDArgs">Runtime Command-Line Arguments</param> | ||
/// <returns>Merged Arguments</returns> | ||
public static string[] MergeStartupArgs(string[] CMDArgs) | ||
{ | ||
List<string> StartupArgs = new List<string>(); | ||
foreach (string arg in CMDArgs) | ||
{ | ||
if (!StartupArgs.Contains(arg)) | ||
StartupArgs.Add(arg); | ||
} | ||
|
||
foreach (string farg in File.ReadAllLines(Path.GetFullPath(StartupArgsPath))) | ||
{ | ||
if (!farg.StartsWith("#") && !farg.StartsWith(" ")) | ||
{ | ||
if (!StartupArgs.Contains(farg)) | ||
StartupArgs.Add(farg); | ||
} | ||
} | ||
|
||
return StartupArgs.ToArray(); | ||
} | ||
} | ||
} |
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,2 @@ | ||
# Place any arguments you want to use automatically here. | ||
# Any line that starts with '#' or ' ' will be avoided. |