-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #207 from yourtablecloth/dev/1.13.0
v1.13.0 PR
- Loading branch information
Showing
104 changed files
with
3,861 additions
and
2,484 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,3 @@ | ||
If you wish to use the source code of this project for commercial purposes, you must consult with the main developer of this project, Jung Hyun, Nam. | ||
|
||
He can be reached at rkttu at rkttu dot com. His time zone is GMT+9 Asia/Seoul. |
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 |
---|---|---|
@@ -1,21 +1 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Jung Hyun, Nam | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
This project consists of multiple licences. Please check each 'LICENSE*' file for the available licence options. |
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
Binary file not shown.
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 |
---|---|---|
@@ -1,9 +1,14 @@ | ||
using TableCloth.Models; | ||
|
||
namespace Spork.Components | ||
{ | ||
public interface ICommandLineArguments | ||
{ | ||
CommandLineArgumentModel Current { get; } | ||
} | ||
using System.Threading.Tasks; | ||
using TableCloth.Models; | ||
|
||
namespace Spork.Components | ||
{ | ||
public interface ICommandLineArguments | ||
{ | ||
Task<string> GetHelpStringAsync(); | ||
|
||
Task<string> GetVersionStringAsync(); | ||
|
||
CommandLineArgumentModel GetCurrent(); | ||
} | ||
} |
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
161 changes: 147 additions & 14 deletions
161
src/Spork/Components/Implementations/CommandLineArguments.cs
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 |
---|---|---|
@@ -1,14 +1,147 @@ | ||
using System; | ||
using TableCloth.Models; | ||
|
||
namespace Spork.Components.Implementations | ||
{ | ||
public sealed class CommandLineArguments : ICommandLineArguments | ||
{ | ||
private readonly Lazy<CommandLineArgumentModel> _argvModelFactory | ||
= new Lazy<CommandLineArgumentModel>(() => CommandLineArgumentModel.ParseFromArgv()); | ||
|
||
public CommandLineArgumentModel Current | ||
=> _argvModelFactory.Value; | ||
} | ||
} | ||
using System; | ||
using System.CommandLine; | ||
using System.CommandLine.Builder; | ||
using System.CommandLine.IO; | ||
using System.CommandLine.Parsing; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using TableCloth; | ||
using TableCloth.Models; | ||
using TableCloth.Resources; | ||
|
||
namespace Spork.Components.Implementations | ||
{ | ||
public sealed class CommandLineArguments : ICommandLineArguments | ||
{ | ||
public CommandLineArguments() | ||
{ | ||
_enableMicrophoneOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_EnableMicrophone) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_enableCameraOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_EnableCamera) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_enablePrinterOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_EnablePrinter) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_certPrivateKeyOption = new Option<string>(ConstantStrings.TableCloth_Switch_CertPrivateKey) | ||
{ IsRequired = false, Arity = ArgumentArity.ExactlyOne, }; | ||
|
||
_certPublicKeyOption = new Option<string>(ConstantStrings.TableCloth_Switch_CertPublicKey) | ||
{ IsRequired = false, Arity = ArgumentArity.ExactlyOne, }; | ||
|
||
_installEveryonesPrinterOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_InstallEveryonesPrinter) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_installAdobeReaderOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_InstallAdobeReader) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_installHancomOfficeViewerOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_InstallHancomOfficeViewer) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_installRaiDriveOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_InstallRaiDrive) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_enableIEModeOption = new Option<bool?>(ConstantStrings.TableCloth_Switch_EnableIEMode) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_dryRunOption = new Option<bool>(ConstantStrings.TableCloth_Switch_DryRun) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_simulateFailureOption = new Option<bool>(ConstantStrings.TableCloth_Switch_SimulateFailure) | ||
{ IsRequired = false, Arity = ArgumentArity.Zero, }; | ||
|
||
_siteIdListArgument = new Argument<string[]>() | ||
{ Arity = ArgumentArity.ZeroOrMore, }; | ||
|
||
_rootCommand = new RootCommand() | ||
{ | ||
_enableMicrophoneOption, | ||
_enableCameraOption, | ||
_enablePrinterOption, | ||
_certPrivateKeyOption, | ||
_certPublicKeyOption, | ||
_installEveryonesPrinterOption, | ||
_installAdobeReaderOption, | ||
_installHancomOfficeViewerOption, | ||
_installRaiDriveOption, | ||
_enableIEModeOption, | ||
_dryRunOption, | ||
_simulateFailureOption, | ||
_siteIdListArgument, | ||
}; | ||
|
||
_commandLineBuilder = new CommandLineBuilder(_rootCommand) | ||
.UseDefaults() | ||
.UseHelp() | ||
.UseVersionOption() | ||
.UseLocalizationResources(LocalizationResources.Instance); | ||
|
||
_helpOption = _rootCommand.Options | ||
.FirstOrDefault(x => x.Aliases.Contains(ConstantStrings.TableCloth_Switch_Help, StringComparer.OrdinalIgnoreCase)) | ||
?? throw new Exception("Unexpected Error: Cannot find help switch from command line parser configuration."); | ||
|
||
_versionOption = _rootCommand.Options | ||
.FirstOrDefault(x => x.Aliases.Contains(ConstantStrings.TableCloth_Switch_Version, StringComparer.OrdinalIgnoreCase)) | ||
?? throw new Exception("Unexpected Error: Cannot find version switch from command line parser configuration."); | ||
} | ||
|
||
private readonly Option<bool?> _enableMicrophoneOption; | ||
private readonly Option<bool?> _enableCameraOption; | ||
private readonly Option<bool?> _enablePrinterOption; | ||
private readonly Option<string> _certPrivateKeyOption; | ||
private readonly Option<string> _certPublicKeyOption; | ||
private readonly Option<bool?> _installEveryonesPrinterOption; | ||
private readonly Option<bool?> _installAdobeReaderOption; | ||
private readonly Option<bool?> _installHancomOfficeViewerOption; | ||
private readonly Option<bool?> _installRaiDriveOption; | ||
private readonly Option<bool?> _enableIEModeOption; | ||
private readonly Option<bool> _dryRunOption; | ||
private readonly Option<bool> _simulateFailureOption; | ||
private readonly Argument<string[]> _siteIdListArgument; | ||
private readonly RootCommand _rootCommand; | ||
private readonly CommandLineBuilder _commandLineBuilder; | ||
private readonly Option _helpOption; | ||
private readonly Option _versionOption; | ||
|
||
private ParseResult ParseCommandLine(string[] args) | ||
=> _commandLineBuilder.Build().Parse(args); | ||
|
||
public async Task<string> GetHelpStringAsync() | ||
{ | ||
var testConsole = new TestConsole(); | ||
await ParseCommandLine(new string[] { ConstantStrings.TableCloth_Switch_Help }).InvokeAsync(testConsole).ConfigureAwait(false); | ||
return testConsole.Out.ToString() ?? string.Empty; | ||
} | ||
|
||
public async Task<string> GetVersionStringAsync() | ||
{ | ||
var testConsole = new TestConsole(); | ||
await ParseCommandLine(new string[] { ConstantStrings.TableCloth_Switch_Version }).InvokeAsync(testConsole).ConfigureAwait(false); | ||
return testConsole.Out.ToString() ?? string.Empty; | ||
} | ||
|
||
public CommandLineArgumentModel GetCurrent() | ||
{ | ||
var args = Helpers.GetCommandLineArguments(); | ||
var parseResult = ParseCommandLine(args); | ||
|
||
return new CommandLineArgumentModel(args, | ||
selectedServices: parseResult.GetValueForArgument(_siteIdListArgument), | ||
enableMicrophone: parseResult.GetValueForOption(_enableMicrophoneOption), | ||
enableWebCam: parseResult.GetValueForOption(_enableCameraOption), | ||
enablePrinters: parseResult.GetValueForOption(_enablePrinterOption), | ||
certPrivateKeyPath: parseResult.GetValueForOption(_certPrivateKeyOption), | ||
certPublicKeyPath: parseResult.GetValueForOption(_certPublicKeyOption), | ||
installEveryonesPrinter: parseResult.GetValueForOption(_installEveryonesPrinterOption), | ||
installAdobeReader: parseResult.GetValueForOption(_installAdobeReaderOption), | ||
installHancomOfficeViewer: parseResult.GetValueForOption(_installHancomOfficeViewerOption), | ||
installRaiDrive: parseResult.GetValueForOption(_installRaiDriveOption), | ||
enableInternetExplorerMode: parseResult.GetValueForOption(_enableIEModeOption), | ||
showCommandLineHelp: parseResult.HasOption(_helpOption), | ||
showVersionHelp: parseResult.HasOption(_versionOption), | ||
dryRun: parseResult.GetValueForOption(_dryRunOption), | ||
simulateFailure: parseResult.GetValueForOption(_simulateFailureOption)); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using Microsoft.Win32; | ||
using System; | ||
using System; | ||
using System.IO; | ||
using TableCloth; | ||
|
||
|
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,16 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace Spork.Converters | ||
{ | ||
public class WidthConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
=> (double)value - SystemParameters.VerticalScrollBarWidth; | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
=> throw new NotImplementedException(); | ||
} | ||
} |
Oops, something went wrong.