style: add .editorconfig for code formatting. see issu #25

This commit is contained in:
leo 2024-03-18 09:37:06 +08:00
parent a8eeea4f78
commit 18aaa0a143
225 changed files with 7781 additions and 3911 deletions

View file

@ -1,20 +1,28 @@
using Avalonia.Threading;
using System.IO;
using System.IO;
namespace SourceGit.Commands {
public static class MergeTool {
public static bool OpenForMerge(string repo, string tool, string mergeCmd, string file) {
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(mergeCmd)) {
Dispatcher.UIThread.Invoke(() => {
using Avalonia.Threading;
namespace SourceGit.Commands
{
public static class MergeTool
{
public static bool OpenForMerge(string repo, string tool, string mergeCmd, string file)
{
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(mergeCmd))
{
Dispatcher.UIThread.Invoke(() =>
{
App.RaiseException(repo, "Invalid external merge tool settings!");
});
return false;
}
if (!File.Exists(tool)) {
Dispatcher.UIThread.Invoke(() => {
if (!File.Exists(tool))
{
Dispatcher.UIThread.Invoke(() =>
{
App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!");
});
});
return false;
}
@ -25,16 +33,21 @@ namespace SourceGit.Commands {
return cmd.Exec();
}
public static bool OpenForDiff(string repo, string tool, string diffCmd, Models.DiffOption option) {
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(diffCmd)) {
Dispatcher.UIThread.Invoke(() => {
public static bool OpenForDiff(string repo, string tool, string diffCmd, Models.DiffOption option)
{
if (string.IsNullOrWhiteSpace(tool) || string.IsNullOrWhiteSpace(diffCmd))
{
Dispatcher.UIThread.Invoke(() =>
{
App.RaiseException(repo, "Invalid external merge tool settings!");
});
});
return false;
}
if (!File.Exists(tool)) {
Dispatcher.UIThread.Invoke(() => {
if (!File.Exists(tool))
{
Dispatcher.UIThread.Invoke(() =>
{
App.RaiseException(repo, $"Can NOT found external merge tool in '{tool}'!");
});
return false;
@ -42,9 +55,9 @@ namespace SourceGit.Commands {
var cmd = new Command();
cmd.WorkingDirectory = repo;
cmd.RaiseError = false;
cmd.RaiseError = false;
cmd.Args = $"-c difftool.sourcegit.cmd=\"\\\"{tool}\\\" {diffCmd}\" difftool --tool=sourcegit --no-prompt {option}";
return cmd.Exec();
}
}
}
}