diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b82ccd --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vs/ +bin/ +obj/ diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..8fb5f38 --- /dev/null +++ b/App.xaml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..b4d805a --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,15 @@ +namespace MauiApp1 +{ + public partial class App : Application + { + public App() + { + InitializeComponent(); + } + + protected override Window CreateWindow(IActivationState? activationState) + { + return new Window(new AppShell()); + } + } +} \ No newline at end of file diff --git a/AppShell.xaml b/AppShell.xaml new file mode 100644 index 0000000..5fb3b39 --- /dev/null +++ b/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/AppShell.xaml.cs b/AppShell.xaml.cs new file mode 100644 index 0000000..0f7e0cf --- /dev/null +++ b/AppShell.xaml.cs @@ -0,0 +1,10 @@ +namespace MauiApp1 +{ + public partial class AppShell : Shell + { + public AppShell() + { + InitializeComponent(); + } + } +} diff --git a/ComanderApp.csproj b/ComanderApp.csproj new file mode 100644 index 0000000..b8dae84 --- /dev/null +++ b/ComanderApp.csproj @@ -0,0 +1,67 @@ + + + + net9.0-android;net9.0-ios;net9.0-maccatalyst + $(TargetFrameworks);net9.0-windows10.0.19041.0 + + + + + + + Exe + MauiApp1 + true + true + enable + enable + + + MauiApp1 + + + com.companyname.mauiapp1 + + + 1.0 + 1 + + + None + + 15.0 + 15.0 + 21.0 + 10.0.17763.0 + 10.0.17763.0 + 6.5 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ComanderApp.csproj.user b/ComanderApp.csproj.user new file mode 100644 index 0000000..cd723ee --- /dev/null +++ b/ComanderApp.csproj.user @@ -0,0 +1,31 @@ + + + + False + net9.0-windows10.0.19041.0 + Windows Machine + + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + Designer + + + \ No newline at end of file diff --git a/Commander.sln b/Commander.sln new file mode 100644 index 0000000..4d16b0a --- /dev/null +++ b/Commander.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36623.8 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComanderApp", "ComanderApp.csproj", "{7342CF38-EC3F-4640-B541-56B49B4AE2D3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7342CF38-EC3F-4640-B541-56B49B4AE2D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7342CF38-EC3F-4640-B541-56B49B4AE2D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7342CF38-EC3F-4640-B541-56B49B4AE2D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7342CF38-EC3F-4640-B541-56B49B4AE2D3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {84F353D3-F18D-4A2E-BB25-B4EA3F7171B1} + EndGlobalSection +EndGlobal diff --git a/FileSystemItem.cs b/FileSystemItem.cs new file mode 100644 index 0000000..8c1da87 --- /dev/null +++ b/FileSystemItem.cs @@ -0,0 +1,10 @@ +namespace MauiApp1 +{ + public class FileSystemItem + { + public string Name { get; set; } + public string FullName { get; set; } + public bool IsDirectory { get; set; } + public string Icon => IsDirectory ? "folder.png" : "file.png"; + } +} diff --git a/FileSystemService.cs b/FileSystemService.cs new file mode 100644 index 0000000..b5e3584 --- /dev/null +++ b/FileSystemService.cs @@ -0,0 +1,55 @@ +namespace MauiApp1 +{ + public class FileSystemService : IFileSystemService + { + public string GetRootPath() + { +#if ANDROID || IOS || MACCATALYST + return FileSystem.Current.AppDataDirectory; +#else + return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); +#endif + } + + public IEnumerable GetDirectoryContents(string path) + { + if (!Directory.Exists(path)) + return Enumerable.Empty(); + + var items = new List(); + + // Добавляем ".." если не корень + var parent = Directory.GetParent(path); + if (parent != null) + { + items.Add(new FileSystemItem + { + Name = "..", + FullName = parent.FullName, + IsDirectory = true + }); + } + + var dirs = Directory.GetDirectories(path) + .Select(d => new FileSystemItem + { + Name = Path.GetFileName(d), + FullName = d, + IsDirectory = true + }); + + var files = Directory.GetFiles(path) + .Select(f => new FileSystemItem + { + Name = Path.GetFileName(f), + FullName = f, + IsDirectory = false + }); + + items.AddRange(dirs.OrderBy(d => d.Name)); + items.AddRange(files.OrderBy(f => f.Name)); + + return items; + } + } +} diff --git a/GlobalXmlns.cs b/GlobalXmlns.cs new file mode 100644 index 0000000..b7e85bc --- /dev/null +++ b/GlobalXmlns.cs @@ -0,0 +1,2 @@ +[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "MauiApp1")] +[assembly: XmlnsDefinition("http://schemas.microsoft.com/dotnet/maui/global", "MauiApp1.Pages")] diff --git a/IFileSystemService.cs b/IFileSystemService.cs new file mode 100644 index 0000000..a12a594 --- /dev/null +++ b/IFileSystemService.cs @@ -0,0 +1,8 @@ +namespace MauiApp1 +{ + public interface IFileSystemService + { + IEnumerable GetDirectoryContents(string path); + string GetRootPath(); + } +} diff --git a/MainPage.xaml b/MainPage.xaml new file mode 100644 index 0000000..11ac0c9 --- /dev/null +++ b/MainPage.xaml @@ -0,0 +1,94 @@ + + + + + +