Csharpier format
This commit is contained in:
@@ -8,8 +8,7 @@ class Program
|
|||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
// yet and stuff might break.
|
// yet and stuff might break.
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args) =>
|
public static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
public static AppBuilder BuildAvaloniaApp() =>
|
public static AppBuilder BuildAvaloniaApp() =>
|
||||||
|
|||||||
@@ -6,14 +6,8 @@ namespace DotNetSolutionTools.App.Services;
|
|||||||
|
|
||||||
public class FileService
|
public class FileService
|
||||||
{
|
{
|
||||||
private readonly FilePickerFileType _csprojFileType = new("C# Project File")
|
private readonly FilePickerFileType _csprojFileType = new("C# Project File") { Patterns = new[] { "*.csproj" } };
|
||||||
{
|
private readonly FilePickerFileType _slnFileType = new("C# Solution File") { Patterns = new[] { "*.sln" } };
|
||||||
Patterns = new[] { "*.csproj" }
|
|
||||||
};
|
|
||||||
private readonly FilePickerFileType _slnFileType = new("C# Solution File")
|
|
||||||
{
|
|
||||||
Patterns = new[] { "*.sln" }
|
|
||||||
};
|
|
||||||
|
|
||||||
public async Task<IStorageFile?> DoOpenFilePickerCsprojAsync()
|
public async Task<IStorageFile?> DoOpenFilePickerCsprojAsync()
|
||||||
{
|
{
|
||||||
@@ -28,14 +22,18 @@ public class FileService
|
|||||||
public async Task<IStorageFile?> DoOpenFilePickerAsync(FilePickerFileType fileType)
|
public async Task<IStorageFile?> DoOpenFilePickerAsync(FilePickerFileType fileType)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
Application.Current?.ApplicationLifetime
|
Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop
|
||||||
is not IClassicDesktopStyleApplicationLifetime desktop
|
|
||||||
|| desktop.MainWindow?.StorageProvider is not { } provider
|
|| desktop.MainWindow?.StorageProvider is not { } provider
|
||||||
)
|
)
|
||||||
throw new NullReferenceException("Missing StorageProvider instance.");
|
throw new NullReferenceException("Missing StorageProvider instance.");
|
||||||
|
|
||||||
var files = await provider.OpenFilePickerAsync(
|
var files = await provider.OpenFilePickerAsync(
|
||||||
new FilePickerOpenOptions() { Title = "Open File", AllowMultiple = false, FileTypeFilter = [fileType] }
|
new FilePickerOpenOptions()
|
||||||
|
{
|
||||||
|
Title = "Open File",
|
||||||
|
AllowMultiple = false,
|
||||||
|
FileTypeFilter = [fileType]
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return files?.Count >= 1 ? files[0] : null;
|
return files?.Count >= 1 ? files[0] : null;
|
||||||
@@ -44,8 +42,7 @@ public class FileService
|
|||||||
public async Task<IStorageFolder?> DoOpenFolderPickerAsync()
|
public async Task<IStorageFolder?> DoOpenFolderPickerAsync()
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
Application.Current?.ApplicationLifetime
|
Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop
|
||||||
is not IClassicDesktopStyleApplicationLifetime desktop
|
|
||||||
|| desktop.MainWindow?.StorageProvider is not { } provider
|
|| desktop.MainWindow?.StorageProvider is not { } provider
|
||||||
)
|
)
|
||||||
throw new NullReferenceException("Missing StorageProvider instance.");
|
throw new NullReferenceException("Missing StorageProvider instance.");
|
||||||
|
|||||||
@@ -4,8 +4,5 @@ namespace DotNetSolutionTools.App.ViewModels;
|
|||||||
|
|
||||||
public partial class ViewModelBase : ObservableObject
|
public partial class ViewModelBase : ObservableObject
|
||||||
{
|
{
|
||||||
protected ViewModelBase()
|
protected ViewModelBase() { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
|
namespace DotNetSolutionTools.Core;
|
||||||
namespace DotNetSolutionTools.Core;
|
|
||||||
|
|
||||||
public static class CleanFolder
|
public static class CleanFolder
|
||||||
{
|
{
|
||||||
public static void DeleteBinObjAndNodeModulesFoldersInFolder(string folderPath)
|
public static void DeleteBinObjAndNodeModulesFoldersInFolder(string folderPath)
|
||||||
{
|
{
|
||||||
var nodeModulesFolders = Directory.GetDirectories(folderPath, "*", SearchOption.AllDirectories)
|
var nodeModulesFolders = Directory
|
||||||
|
.GetDirectories(folderPath, "*", SearchOption.AllDirectories)
|
||||||
.Where(x => x.EndsWith(Path.DirectorySeparatorChar + "node_modules"))
|
.Where(x => x.EndsWith(Path.DirectorySeparatorChar + "node_modules"))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@@ -14,8 +14,11 @@ public static class CleanFolder
|
|||||||
Directory.Delete(folder, true);
|
Directory.Delete(folder, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var binAndObjFolders = Directory.GetDirectories(folderPath, "*", SearchOption.AllDirectories)
|
var binAndObjFolders = Directory
|
||||||
.Where(x => x.EndsWith(Path.DirectorySeparatorChar + "bin") || x.EndsWith(Path.DirectorySeparatorChar + "obj"))
|
.GetDirectories(folderPath, "*", SearchOption.AllDirectories)
|
||||||
|
.Where(x =>
|
||||||
|
x.EndsWith(Path.DirectorySeparatorChar + "bin") || x.EndsWith(Path.DirectorySeparatorChar + "obj")
|
||||||
|
)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
foreach (var folder in binAndObjFolders)
|
foreach (var folder in binAndObjFolders)
|
||||||
|
|||||||
Reference in New Issue
Block a user