mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
Merge pull request #28 from ennerperez/feature/solution_structure
Solution structure (Update)
This commit is contained in:
commit
2782ef4cc1
307 changed files with 9865 additions and 9823 deletions
110
.gitattributes
vendored
110
.gitattributes
vendored
|
@ -1,44 +1,78 @@
|
||||||
###############################
|
# Auto detect text files and perform LF normalization
|
||||||
# Git Line Endings #
|
# https://www.davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
|
||||||
###############################
|
* text=auto
|
||||||
|
|
||||||
# Set default behaviour to automatically normalize line endings.
|
#
|
||||||
* text=auto
|
# The above will handle all files NOT found below
|
||||||
|
#
|
||||||
# Force batch scripts to always use CRLF line endings so that if a repo is accessed
|
|
||||||
# in Windows via a file share from Linux, the scripts will work.
|
|
||||||
*.{cmd,[cC][mM][dD]} text eol=crlf
|
|
||||||
*.{bat,[bB][aA][tT]} text eol=crlf
|
|
||||||
|
|
||||||
# Force bash scripts to always use LF line endings so that if a repo is accessed
|
|
||||||
# in Unix via a file share from Windows, the scripts will work.
|
|
||||||
*.sh text eol=lf
|
|
||||||
|
|
||||||
###############################
|
|
||||||
# Git Large File System (LFS) #
|
|
||||||
###############################
|
|
||||||
|
|
||||||
# Archives
|
|
||||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.br filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
||||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
|
||||||
|
|
||||||
# Documents
|
# Documents
|
||||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
*.bibtex text diff=bibtex
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
||||||
|
*.md text
|
||||||
|
*.tex text diff=tex
|
||||||
|
*.adoc text
|
||||||
|
*.textile text
|
||||||
|
*.mustache text
|
||||||
|
*.csv text
|
||||||
|
*.tab text
|
||||||
|
*.tsv text
|
||||||
|
*.txt text
|
||||||
|
*.sql text
|
||||||
|
|
||||||
# Images
|
# Graphics
|
||||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
*.png binary
|
||||||
*.ico filter=lfs diff=lfs merge=lfs -text
|
*.jpg binary
|
||||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
*.jpeg binary
|
||||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
*.gif binary
|
||||||
*.png filter=lfs diff=lfs merge=lfs -text
|
*.tif binary
|
||||||
*.psd filter=lfs diff=lfs merge=lfs -text
|
*.tiff binary
|
||||||
*.webp filter=lfs diff=lfs merge=lfs -text
|
*.ico binary
|
||||||
|
# SVG treated as an asset (binary) by default.
|
||||||
|
*.svg text
|
||||||
|
# If you want to treat it as binary,
|
||||||
|
# use the following line instead.
|
||||||
|
# *.svg binary
|
||||||
|
*.eps binary
|
||||||
|
|
||||||
# Fonts
|
# Scripts
|
||||||
*.woff2 filter=lfs diff=lfs merge=lfs -text
|
*.bash text eol=lf
|
||||||
|
*.fish text eol=lf
|
||||||
|
*.sh text eol=lf
|
||||||
|
# These are explicitly windows files and should use crlf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
||||||
|
*.ps1 text eol=crlf
|
||||||
|
|
||||||
# Other
|
# Serialisation
|
||||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
*.json text
|
||||||
|
*.toml text
|
||||||
|
*.xml text
|
||||||
|
*.yaml text
|
||||||
|
*.yml text
|
||||||
|
|
||||||
|
# Archives
|
||||||
|
*.7z binary
|
||||||
|
*.gz binary
|
||||||
|
*.tar binary
|
||||||
|
*.tgz binary
|
||||||
|
*.zip binary
|
||||||
|
|
||||||
|
# Text files where line endings should be preserved
|
||||||
|
*.patch -text
|
||||||
|
|
||||||
|
#
|
||||||
|
# Exclude files from exporting
|
||||||
|
#
|
||||||
|
|
||||||
|
.gitattributes export-ignore
|
||||||
|
.gitignore export-ignore
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -34,7 +34,7 @@ jobs:
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build -c Release
|
run: dotnet build -c Release
|
||||||
- name: Publish
|
- name: Publish
|
||||||
run: dotnet publish src/SourceGit.csproj -c Release -o publish -r ${{ matrix.platform }} -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
run: dotnet publish src/SourceGit/SourceGit.csproj -c Release -o publish -r ${{ matrix.platform }} -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.0.31903.59
|
VisualStudioVersion = 17.0.31903.59
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceGit", "src\SourceGit.csproj", "{CD98D9AA-079A-4A79-9212-850EB97CF2ED}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceGit", "src\SourceGit\SourceGit.csproj", "{CD98D9AA-079A-4A79-9212-850EB97CF2ED}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C2487DDC-93D3-485F-943D-5DDF23B92A57}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C2487DDC-93D3-485F-943D-5DDF23B92A57}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -39,6 +39,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "resources", "resources", "{
|
||||||
build\resources\SourceGit.desktop.template = build\resources\SourceGit.desktop.template
|
build\resources\SourceGit.desktop.template = build\resources\SourceGit.desktop.template
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{8E67D51A-1C97-4B57-A0C4-C7916A6E983D}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{8F83FE02-B6BB-4F96-8532-ACC5B8E3C33F}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
.github\workflows\ci.yml = .github\workflows\ci.yml
|
||||||
|
EndProjectSection
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -56,5 +63,6 @@ Global
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{CD98D9AA-079A-4A79-9212-850EB97CF2ED} = {C2487DDC-93D3-485F-943D-5DDF23B92A57}
|
{CD98D9AA-079A-4A79-9212-850EB97CF2ED} = {C2487DDC-93D3-485F-943D-5DDF23B92A57}
|
||||||
{EAB376FC-F69F-4EDB-8E04-D3F326A9F015} = {E6B9E250-EA2D-4665-831D-A547F707718D}
|
{EAB376FC-F69F-4EDB-8E04-D3F326A9F015} = {E6B9E250-EA2D-4665-831D-A547F707718D}
|
||||||
|
{8F83FE02-B6BB-4F96-8532-ACC5B8E3C33F} = {8E67D51A-1C97-4B57-A0C4-C7916A6E983D}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
rm -rf SourceGit
|
rm -rf SourceGit
|
||||||
dotnet publish ../src/SourceGit.csproj -c Release -r linux-x64 -o SourceGit -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
dotnet publish ../src/SourceGit/SourceGit.csproj -c Release -r linux-x64 -o SourceGit -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
||||||
cp resources/SourceGit.desktop.template SourceGit/SourceGit.desktop.template
|
cp resources/SourceGit.desktop.template SourceGit/SourceGit.desktop.template
|
||||||
cp resources/App.icns SourceGit/SourceGit.icns
|
cp resources/App.icns SourceGit/SourceGit.icns
|
||||||
tar -zcvf SourceGit.linux-x64.tar.gz --exclude="*/en" --exclude="*/zh" --exclude="*/*.dbg" SourceGit
|
tar -zcvf SourceGit.linux-x64.tar.gz --exclude="*/en" --exclude="*/zh" --exclude="*/*.dbg" SourceGit
|
||||||
|
|
|
@ -7,11 +7,11 @@ cp resources/App.plist SourceGit.app/Contents/Info.plist
|
||||||
cp resources/App.icns SourceGit.app/Contents/Resources/App.icns
|
cp resources/App.icns SourceGit.app/Contents/Resources/App.icns
|
||||||
|
|
||||||
mkdir -p SourceGit.app/Contents/MacOS
|
mkdir -p SourceGit.app/Contents/MacOS
|
||||||
dotnet publish ../src/SourceGit.csproj -c Release -r osx-arm64 -o SourceGit.app/Contents/MacOS -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
dotnet publish ../src/SourceGit/SourceGit.csproj -c Release -r osx-arm64 -o SourceGit.app/Contents/MacOS -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
||||||
zip SourceGit.osx-arm64.zip -r SourceGit.app -x "*/en/*" -x "*/zh/*" -x "*/*\.dsym/*"
|
zip SourceGit.osx-arm64.zip -r SourceGit.app -x "*/en/*" -x "*/zh/*" -x "*/*\.dsym/*"
|
||||||
|
|
||||||
rm -rf SourceGit.app/Contents/MacOS
|
rm -rf SourceGit.app/Contents/MacOS
|
||||||
|
|
||||||
mkdir -p SourceGit.app/Contents/MacOS
|
mkdir -p SourceGit.app/Contents/MacOS
|
||||||
dotnet publish ../src/SourceGit.csproj -c Release -r osx-x64 -o SourceGit.app/Contents/MacOS -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
dotnet publish ../src/SourceGit/SourceGit.csproj -c Release -r osx-x64 -o SourceGit.app/Contents/MacOS -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
||||||
zip SourceGit.osx-x64.zip -r SourceGit.app -x "*/en/*" -x "*/zh/*" -x "*/*\.dsym/*"
|
zip SourceGit.osx-x64.zip -r SourceGit.app -x "*/en/*" -x "*/zh/*" -x "*/*\.dsym/*"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
rmdir /S /Q SourceGit
|
rmdir /S /Q SourceGit
|
||||||
dotnet publish ..\src\SourceGit.csproj -c Release -r win-x64 -o SourceGit -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
dotnet publish ..\src\SourceGit\SourceGit.csproj -c Release -r win-x64 -o SourceGit -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link --self-contained
|
||||||
resources\7z.exe a SourceGit.win-x64.zip SourceGit "-xr!en/" "-xr!zh/" "-xr!*.pdb"
|
resources\7z.exe a SourceGit.win-x64.zip SourceGit "-xr!en/" "-xr!zh/" "-xr!*.pdb"
|
||||||
rmdir /S /Q SourceGit
|
rmdir /S /Q SourceGit
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
|
@ -1,180 +1,180 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
|
||||||
namespace SourceGit.Commands
|
namespace SourceGit.Commands
|
||||||
{
|
{
|
||||||
public partial class Command
|
public partial class Command
|
||||||
{
|
{
|
||||||
public class CancelToken
|
public class CancelToken
|
||||||
{
|
{
|
||||||
public bool Requested { get; set; } = false;
|
public bool Requested { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReadToEndResult
|
public class ReadToEndResult
|
||||||
{
|
{
|
||||||
public bool IsSuccess { get; set; }
|
public bool IsSuccess { get; set; }
|
||||||
public string StdOut { get; set; }
|
public string StdOut { get; set; }
|
||||||
public string StdErr { get; set; }
|
public string StdErr { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Context { get; set; } = string.Empty;
|
public string Context { get; set; } = string.Empty;
|
||||||
public CancelToken Cancel { get; set; } = null;
|
public CancelToken Cancel { get; set; } = null;
|
||||||
public string WorkingDirectory { get; set; } = null;
|
public string WorkingDirectory { get; set; } = null;
|
||||||
public string Args { get; set; } = string.Empty;
|
public string Args { get; set; } = string.Empty;
|
||||||
public bool RaiseError { get; set; } = true;
|
public bool RaiseError { get; set; } = true;
|
||||||
public bool TraitErrorAsOutput { get; set; } = false;
|
public bool TraitErrorAsOutput { get; set; } = false;
|
||||||
|
|
||||||
public bool Exec()
|
public bool Exec()
|
||||||
{
|
{
|
||||||
var start = new ProcessStartInfo();
|
var start = new ProcessStartInfo();
|
||||||
start.FileName = Native.OS.GitInstallPath;
|
start.FileName = Native.OS.GitInstallPath;
|
||||||
start.Arguments = "--no-pager -c core.quotepath=off " + Args;
|
start.Arguments = "--no-pager -c core.quotepath=off " + Args;
|
||||||
start.UseShellExecute = false;
|
start.UseShellExecute = false;
|
||||||
start.CreateNoWindow = true;
|
start.CreateNoWindow = true;
|
||||||
start.RedirectStandardOutput = true;
|
start.RedirectStandardOutput = true;
|
||||||
start.RedirectStandardError = true;
|
start.RedirectStandardError = true;
|
||||||
start.StandardOutputEncoding = Encoding.UTF8;
|
start.StandardOutputEncoding = Encoding.UTF8;
|
||||||
start.StandardErrorEncoding = Encoding.UTF8;
|
start.StandardErrorEncoding = Encoding.UTF8;
|
||||||
|
|
||||||
// Force using en_US.UTF-8 locale to avoid GCM crash
|
// Force using en_US.UTF-8 locale to avoid GCM crash
|
||||||
if (OperatingSystem.IsLinux())
|
if (OperatingSystem.IsLinux())
|
||||||
{
|
{
|
||||||
start.Environment.Add("LANG", "en_US.UTF-8");
|
start.Environment.Add("LANG", "en_US.UTF-8");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(WorkingDirectory)) start.WorkingDirectory = WorkingDirectory;
|
if (!string.IsNullOrEmpty(WorkingDirectory)) start.WorkingDirectory = WorkingDirectory;
|
||||||
|
|
||||||
var errs = new List<string>();
|
var errs = new List<string>();
|
||||||
var proc = new Process() { StartInfo = start };
|
var proc = new Process() { StartInfo = start };
|
||||||
var isCancelled = false;
|
var isCancelled = false;
|
||||||
|
|
||||||
proc.OutputDataReceived += (_, e) =>
|
proc.OutputDataReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
if (Cancel != null && Cancel.Requested)
|
if (Cancel != null && Cancel.Requested)
|
||||||
{
|
{
|
||||||
isCancelled = true;
|
isCancelled = true;
|
||||||
proc.CancelErrorRead();
|
proc.CancelErrorRead();
|
||||||
proc.CancelOutputRead();
|
proc.CancelOutputRead();
|
||||||
if (!proc.HasExited) proc.Kill(true);
|
if (!proc.HasExited) proc.Kill(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Data != null) OnReadline(e.Data);
|
if (e.Data != null) OnReadline(e.Data);
|
||||||
};
|
};
|
||||||
|
|
||||||
proc.ErrorDataReceived += (_, e) =>
|
proc.ErrorDataReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
if (Cancel != null && Cancel.Requested)
|
if (Cancel != null && Cancel.Requested)
|
||||||
{
|
{
|
||||||
isCancelled = true;
|
isCancelled = true;
|
||||||
proc.CancelErrorRead();
|
proc.CancelErrorRead();
|
||||||
proc.CancelOutputRead();
|
proc.CancelOutputRead();
|
||||||
if (!proc.HasExited) proc.Kill(true);
|
if (!proc.HasExited) proc.Kill(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(e.Data)) return;
|
if (string.IsNullOrEmpty(e.Data)) return;
|
||||||
if (TraitErrorAsOutput) OnReadline(e.Data);
|
if (TraitErrorAsOutput) OnReadline(e.Data);
|
||||||
|
|
||||||
// Ignore progress messages
|
// Ignore progress messages
|
||||||
if (e.Data.StartsWith("remote: Enumerating objects:", StringComparison.Ordinal)) return;
|
if (e.Data.StartsWith("remote: Enumerating objects:", StringComparison.Ordinal)) return;
|
||||||
if (e.Data.StartsWith("remote: Counting objects:", StringComparison.Ordinal)) return;
|
if (e.Data.StartsWith("remote: Counting objects:", StringComparison.Ordinal)) return;
|
||||||
if (e.Data.StartsWith("remote: Compressing objects:", StringComparison.Ordinal)) return;
|
if (e.Data.StartsWith("remote: Compressing objects:", StringComparison.Ordinal)) return;
|
||||||
if (e.Data.StartsWith("Filtering content:", StringComparison.Ordinal)) return;
|
if (e.Data.StartsWith("Filtering content:", StringComparison.Ordinal)) return;
|
||||||
if (_progressRegex().IsMatch(e.Data)) return;
|
if (_progressRegex().IsMatch(e.Data)) return;
|
||||||
errs.Add(e.Data);
|
errs.Add(e.Data);
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
proc.Start();
|
proc.Start();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (RaiseError)
|
if (RaiseError)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Invoke(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
App.RaiseException(Context, e.Message);
|
App.RaiseException(Context, e.Message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
proc.BeginOutputReadLine();
|
proc.BeginOutputReadLine();
|
||||||
proc.BeginErrorReadLine();
|
proc.BeginErrorReadLine();
|
||||||
proc.WaitForExit();
|
proc.WaitForExit();
|
||||||
|
|
||||||
int exitCode = proc.ExitCode;
|
int exitCode = proc.ExitCode;
|
||||||
proc.Close();
|
proc.Close();
|
||||||
|
|
||||||
if (!isCancelled && exitCode != 0 && errs.Count > 0)
|
if (!isCancelled && exitCode != 0 && errs.Count > 0)
|
||||||
{
|
{
|
||||||
if (RaiseError)
|
if (RaiseError)
|
||||||
{
|
{
|
||||||
Dispatcher.UIThread.Invoke(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
App.RaiseException(Context, string.Join("\n", errs));
|
App.RaiseException(Context, string.Join("\n", errs));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ReadToEndResult ReadToEnd()
|
public ReadToEndResult ReadToEnd()
|
||||||
{
|
{
|
||||||
var start = new ProcessStartInfo();
|
var start = new ProcessStartInfo();
|
||||||
start.FileName = Native.OS.GitInstallPath;
|
start.FileName = Native.OS.GitInstallPath;
|
||||||
start.Arguments = "--no-pager -c core.quotepath=off " + Args;
|
start.Arguments = "--no-pager -c core.quotepath=off " + Args;
|
||||||
start.UseShellExecute = false;
|
start.UseShellExecute = false;
|
||||||
start.CreateNoWindow = true;
|
start.CreateNoWindow = true;
|
||||||
start.RedirectStandardOutput = true;
|
start.RedirectStandardOutput = true;
|
||||||
start.RedirectStandardError = true;
|
start.RedirectStandardError = true;
|
||||||
start.StandardOutputEncoding = Encoding.UTF8;
|
start.StandardOutputEncoding = Encoding.UTF8;
|
||||||
start.StandardErrorEncoding = Encoding.UTF8;
|
start.StandardErrorEncoding = Encoding.UTF8;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(WorkingDirectory)) start.WorkingDirectory = WorkingDirectory;
|
if (!string.IsNullOrEmpty(WorkingDirectory)) start.WorkingDirectory = WorkingDirectory;
|
||||||
|
|
||||||
var proc = new Process() { StartInfo = start };
|
var proc = new Process() { StartInfo = start };
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
proc.Start();
|
proc.Start();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return new ReadToEndResult()
|
return new ReadToEndResult()
|
||||||
{
|
{
|
||||||
IsSuccess = false,
|
IsSuccess = false,
|
||||||
StdOut = string.Empty,
|
StdOut = string.Empty,
|
||||||
StdErr = e.Message,
|
StdErr = e.Message,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var rs = new ReadToEndResult()
|
var rs = new ReadToEndResult()
|
||||||
{
|
{
|
||||||
StdOut = proc.StandardOutput.ReadToEnd(),
|
StdOut = proc.StandardOutput.ReadToEnd(),
|
||||||
StdErr = proc.StandardError.ReadToEnd(),
|
StdErr = proc.StandardError.ReadToEnd(),
|
||||||
};
|
};
|
||||||
|
|
||||||
proc.WaitForExit();
|
proc.WaitForExit();
|
||||||
rs.IsSuccess = proc.ExitCode == 0;
|
rs.IsSuccess = proc.ExitCode == 0;
|
||||||
proc.Close();
|
proc.Close();
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnReadline(string line) { }
|
protected virtual void OnReadline(string line) { }
|
||||||
|
|
||||||
[GeneratedRegex(@"\d+%")]
|
[GeneratedRegex(@"\d+%")]
|
||||||
private static partial Regex _progressRegex();
|
private static partial Regex _progressRegex();
|
||||||
}
|
}
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue