Skip to content

Commit

Permalink
Merge pull request #207 from yourtablecloth/dev/1.13.0
Browse files Browse the repository at this point in the history
v1.13.0 PR
  • Loading branch information
rkttu authored Apr 5, 2024
2 parents e3ad455 + e95e9d4 commit a1581d3
Show file tree
Hide file tree
Showing 104 changed files with 3,861 additions and 2,484 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,20 @@ FodyWeavers.xsd

# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,visualstudiocode,windows

/src/Hostess/commit.txt
/src/Spork/commit.txt

/src/TableCloth/commit.txt
/src/TableCloth/Hostess.zip
/src/TableCloth/Spork.zip
/src/TableCloth/Images.zip

/src/TableCloth.Test/commit.txt
/src/TableCloth.Test/Hostess.zip
/src/TableCloth.Test/Spork.zip
/src/TableCloth.Test/Images.zip

/src/TableCloth.Resources/commit.txt

/src/commit.iss
/src/Output
661 changes: 661 additions & 0 deletions LICENSE-AGPL-3-OR-LATER

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions LICENSE-COMMERCIAL
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.
22 changes: 1 addition & 21 deletions LICENSE.txt
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.
4 changes: 2 additions & 2 deletions src/Cloth/Cloth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<Title>Cloth</Title>
<AssemblyVersion>1.12.3.0</AssemblyVersion>
<FileVersion>1.12.3.0</FileVersion>
<AssemblyVersion>1.13.0.0</AssemblyVersion>
<FileVersion>1.13.0.0</FileVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Cloth/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.12.3.0" name="Cloth.app" />
<assemblyIdentity version="1.13.0.0" name="Cloth.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down
Binary file modified src/License.rtf
Binary file not shown.
1 change: 1 addition & 0 deletions src/Spork/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<converters:BooleanToGridRowHeightConverter x:Key="BooleanToGridRowHeightConverter" />
<converters:BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
<converters:StateToBrushConverter x:Key="stateToBrushConverter" />
<converters:WidthConverter x:Key="widthConverter" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary x:Uid="Theme" Source="/PresentationFramework.Aero2, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero2.normalcolor.xaml" />
</ResourceDictionary.MergedDictionaries>
Expand Down
13 changes: 9 additions & 4 deletions src/Spork/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using AsyncAwaitBestPractices;
using Spork.Components;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Spork.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using TableCloth;
using TableCloth.Resources;

namespace Spork
{
Expand All @@ -31,11 +30,17 @@ private async Task OnApplicationstartupAsync(object sender, StartupEventArgs e)
{
var appMessageBox = Host.Services.GetRequiredService<IAppMessageBox>();
var commandLineArguments = Host.Services.GetRequiredService<ICommandLineArguments>();
var parsedArgs = commandLineArguments.Current;
var parsedArgs = commandLineArguments.GetCurrent();

if (parsedArgs.ShowCommandLineHelp)
{
appMessageBox.DisplayInfo(StringResources.TableCloth_Spork_Switches_Help, MessageBoxButton.OK);
appMessageBox.DisplayInfo(await commandLineArguments.GetHelpStringAsync(), MessageBoxButton.OK);
return;
}

if (parsedArgs.ShowVersionHelp)
{
appMessageBox.DisplayInfo(await commandLineArguments.GetVersionStringAsync(), MessageBoxButton.OK);
return;
}

Expand Down
5 changes: 1 addition & 4 deletions src/Spork/Browsers/IWebBrowserService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System.Diagnostics;
using System.Windows;

namespace Spork.Browsers
namespace Spork.Browsers
{
public interface IWebBrowserService
{
Expand Down
2 changes: 1 addition & 1 deletion src/Spork/Commands/MainWindow/MainWindowLoadedCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task ExecuteAsync(MainWindowViewModel viewModel)
{
_visualThemeManager.ApplyAutoThemeChange(_application.MainWindow);

var parsedArgs = _commandLineArguments.Current;
var parsedArgs = _commandLineArguments.GetCurrent();
var catalog = _resourceCacheManager.CatalogDocument;
var targets = parsedArgs.SelectedServices;

Expand Down
4 changes: 2 additions & 2 deletions src/Spork/Commands/MainWindow/ShowDebugInfoCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ public override void Execute(object parameter)
{
_appMessageBox.DisplayInfo(StringResources.TableCloth_DebugInformation(
Process.GetCurrentProcess().ProcessName,
string.Join(" ", _commandLineArguments.Current.RawArguments),
_commandLineArguments.Current.ToString())
string.Join(" ", _commandLineArguments.GetCurrent().RawArguments),
_commandLineArguments.GetCurrent().ToString())
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public PrecautionsWindowLoadedCommand(
public override void Execute(PrecautionsWindowViewModel viewModel)
{
var catalog = _resourceCacheManager.CatalogDocument;
var parsedArgs = _commandLineArguments.Current;
var parsedArgs = _commandLineArguments.GetCurrent();
var targets = parsedArgs.SelectedServices;

var buffer = new StringBuilder();
Expand Down
21 changes: 13 additions & 8 deletions src/Spork/Components/ICommandLineArguments.cs
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();
}
}
2 changes: 1 addition & 1 deletion src/Spork/Components/Implementations/AppStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public async Task<ApplicationStartupResultModel> InitializeAsync(
CancellationToken cancellationToken = default)
{
var result = default(ApplicationStartupResultModel);
var parsedArgs = _commandLineArguments.Current;
var parsedArgs = _commandLineArguments.GetCurrent();
ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificate;

const int retryCount = 3;
Expand Down
4 changes: 2 additions & 2 deletions src/Spork/Components/Implementations/AppUserInterface.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Spork.Dialogs;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Spork.Dialogs;
using System;

namespace Spork.Components.Implementations
Expand Down
161 changes: 147 additions & 14 deletions src/Spork/Components/Implementations/CommandLineArguments.cs
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));
}
}
}
3 changes: 1 addition & 2 deletions src/Spork/Components/Implementations/SharedLocations.cs
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;

Expand Down
4 changes: 2 additions & 2 deletions src/Spork/Components/Implementations/VisualThemeManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Spork.Themes;
using Microsoft.Win32;
using Microsoft.Win32;
using Spork.Themes;
using System;
using System.Runtime.InteropServices;
using System.Windows;
Expand Down
4 changes: 2 additions & 2 deletions src/Spork/Controls/RichTextBoxHelper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Spork.Browsers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Spork.Browsers;
using System;
using System.Diagnostics;
using System.IO;
Expand Down
16 changes: 16 additions & 0 deletions src/Spork/Converters/WidthConverter.cs
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();
}
}
Loading

0 comments on commit a1581d3

Please sign in to comment.