-
Notifications
You must be signed in to change notification settings - Fork 3
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 #109 from XanatosX/develop
Prepare release 1.2.0
- Loading branch information
Showing
92 changed files
with
1,493 additions
and
543 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
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 |
---|---|---|
|
@@ -452,3 +452,5 @@ $RECYCLE.BIN/ | |
.vscode/tasks.json | ||
.vscode/launch.json | ||
.vscode/extensions.json | ||
|
||
**/result/*.exe |
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,64 @@ | ||
; Script generated by the Inno Setup Script Wizard. | ||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! | ||
|
||
#define MyAppName "Modular Tool Manager" | ||
#ifndef MyAppVersion | ||
#define MyAppVersion "0.0.0" | ||
#endif | ||
#define MyAppPublisher "Xanatos" | ||
#define MyAppURL "https://github.com/XanatosX/ModularToolManager/" | ||
#define MyAppSupportUrl MyAppURL + "issues" | ||
#define MyAppUpdateUrl MyAppURL + "releases" | ||
#define MyAppExeName "ModularToolManager.exe" | ||
|
||
#define InstalltionDocumentFolder ".\documents" | ||
#define ApplicationMainFolder "..\.." | ||
#ifndef BuildFolder | ||
#define BuildFolder ApplicationMainFolder + "\src\ModularToolManager\bin\Release\net7.0\win-x64\publish" | ||
#endif | ||
|
||
[Setup] | ||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. | ||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) | ||
AppId={{5B1778A7-E56A-4DA9-B4F0-0569EB9738E7} | ||
AppName={#MyAppName} | ||
AppVersion={#MyAppVersion} | ||
;AppVerName={#MyAppName} {#MyAppVersion} | ||
AppPublisher={#MyAppPublisher} | ||
AppPublisherURL={#MyAppURL} | ||
AppSupportURL={#MyAppSupportUrl} | ||
AppUpdatesURL={#MyAppUpdateUrl} | ||
DefaultDirName={autopf}\{#MyAppName} | ||
DisableProgramGroupPage=yes | ||
LicenseFile={#ApplicationMainFolder}\LICENSE | ||
; Enable the following lines if there is some information on the before or after install file | ||
; InfoBeforeFile={#InstalltionDocumentFolder}\beforeInstall.txt | ||
; InfoAfterFile={#InstalltionDocumentFolder}\afterInstall.txt | ||
; Uncomment the following line to run in non administrative install mode (install for current user only.) | ||
;PrivilegesRequired=lowest | ||
PrivilegesRequiredOverridesAllowed=dialog | ||
OutputBaseFilename=ModularToolManager_WindowsInstaller_{#MyAppVersion}_x64 | ||
SetupIconFile={#InstalltionDocumentFolder}\installer-logo.ico | ||
Compression=lzma | ||
SolidCompression=yes | ||
WizardStyle=modern | ||
|
||
[Languages] | ||
Name: "english"; MessagesFile: "compiler:Default.isl" | ||
Name: "german"; MessagesFile: "compiler:Languages\German.isl" | ||
|
||
[Tasks] | ||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked | ||
|
||
[Files] | ||
Source: "{#BuildFolder}\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion | ||
Source: "{#BuildFolder}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs | ||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files | ||
|
||
[Icons] | ||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" | ||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon | ||
|
||
[Run] | ||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent | ||
|
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 @@ | ||
after install text |
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 @@ | ||
before install text |
Git LFS 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
param( | ||
[String][Parameter(Mandatory, HelpMessage="Enter the version of the installation")]$version, | ||
[String][Parameter(HelpMessage="The directory to put the resulting setup file in")]$output = "output", | ||
[String][Parameter(HelpMessage="The folder containing the build")]$buildfolder = "" | ||
) | ||
|
||
# Switch to setup location | ||
$dir = split-path $MyInvocation.MyCommand.Path -Parent | ||
Push-Location $dir | ||
|
||
# Write information and create setup | ||
Write-Output "Output directory was set to $output" | ||
Write-Output "Install version in $version" | ||
|
||
if ([string]::IsNullOrEmpty($buildfolder)) | ||
{ | ||
Write-Output "Use default build folder" | ||
iscc /DMyAppVersion=$version /O$output .\ModularToolManagersSetup.iss | ||
} else | ||
{ | ||
Write-Output "Use $buildfolder as build folder" | ||
iscc /DMyAppVersion=$version /DBuildFolder=$buildfolder /O$output .\ModularToolManagersSetup.iss | ||
} | ||
|
||
# Switch back to original location | ||
Pop-Location |
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
104 changes: 104 additions & 0 deletions
104
src/DefaultPlugins/ProcessStartStrategies/DefaultScriptStarterFactory.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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
using ModularToolManagerPlugin.Enums; | ||
|
||
namespace DefaultPlugins.ProcessStartStrategies; | ||
|
||
/// <summary> | ||
/// Factory to create the correct process start strategy for the current OS | ||
/// </summary> | ||
internal sealed class DefaultScriptStarterFactory | ||
{ | ||
/// <summary> | ||
/// Strategy cache | ||
/// </summary> | ||
private readonly List<IProcessStartStrategy> strategies; | ||
|
||
/// <summary> | ||
/// The action used for logging | ||
/// </summary> | ||
private readonly Action<LogSeverity, string>? loggingAction; | ||
|
||
/// <summary> | ||
/// Create a new instance of this class | ||
/// <paramref name="loggingAction">The action used for logging messages</paramref>> | ||
/// </summary> | ||
public DefaultScriptStarterFactory(Action<LogSeverity, string>? loggingAction) | ||
{ | ||
strategies = new(); | ||
this.loggingAction = loggingAction; | ||
} | ||
|
||
/// <summary> | ||
/// Create a new instance of this class | ||
/// Logging is disabled with this constructor | ||
/// </summary> | ||
public DefaultScriptStarterFactory() : this(null) { } | ||
|
||
/// <summary> | ||
/// Create the correct start info for the current operation system | ||
/// </summary> | ||
/// <param name="parameters">The parameters to use</param> | ||
/// <param name="path">The path of the file to execute</param> | ||
/// <returns>The process start info</returns> | ||
public IProcessStartStrategy? CreateStartInfo(string path) | ||
{ | ||
IProcessStartStrategy? info = null; | ||
if (OperatingSystem.IsWindows()) | ||
{ | ||
info = GetStrategy<WindowsStarterStrategy>(() => new WindowsStarterStrategy()); | ||
} | ||
if (OperatingSystem.IsLinux()) | ||
{ | ||
string? terminalApp = null; | ||
try | ||
{ | ||
using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read)) | ||
{ | ||
using (StreamReader reader = new StreamReader(stream)) | ||
{ | ||
string? line; | ||
while ((line = reader.ReadLine()) is not null) | ||
{ | ||
if (line.StartsWith("#!")) | ||
{ | ||
terminalApp = line.Replace("#!", string.Empty); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
if (loggingAction is not null) | ||
{ | ||
loggingAction(LogSeverity.Warning, e.Message); | ||
} | ||
} | ||
info = terminalApp switch | ||
{ | ||
"/bin/bash" => GetStrategy<LinuxBashStarterStrategy>(() => new LinuxBashStarterStrategy()), | ||
_ => null | ||
}; | ||
} | ||
|
||
return info; | ||
} | ||
|
||
/// <summary> | ||
/// Get the given strategy from cache or create a new one and cache it | ||
/// </summary> | ||
/// <param name="creationMethod">The method used to create the strategy</param> | ||
/// <typeparam name="T">The type of strategy to create</typeparam> | ||
/// <returns>A useable strategy or null</returns> | ||
public IProcessStartStrategy? GetStrategy<T>(Func<T> creationMethod) where T : IProcessStartStrategy | ||
{ | ||
T? returnStrategy = strategies.OfType<T>().FirstOrDefault(); | ||
if (returnStrategy is null) | ||
{ | ||
returnStrategy = creationMethod(); | ||
strategies.Add(returnStrategy); | ||
} | ||
|
||
return returnStrategy; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/DefaultPlugins/ProcessStartStrategies/IProcessStartStrategy.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.Diagnostics; | ||
|
||
namespace DefaultPlugins.ProcessStartStrategies; | ||
|
||
/// <summary> | ||
/// Interface to define a single strategy for running tasks on an os | ||
/// </summary> | ||
internal interface IProcessStartStrategy | ||
{ | ||
/// <summary> | ||
/// Create the start information to run the process for a given os. | ||
/// </summary> | ||
/// <param name="parameters">The parameters to use</param> | ||
/// <param name="path">The path to the file to run</param> | ||
/// <returns>A useable start info, if possible</returns> | ||
ProcessStartInfo? GetStartInfo(string parameters, string path); | ||
} |
Oops, something went wrong.