diff --git a/.github/workflows/Windows-GUI.yml b/.github/workflows/Windows-GUI.yml index 62923c5..e14075b 100644 --- a/.github/workflows/Windows-GUI.yml +++ b/.github/workflows/Windows-GUI.yml @@ -25,7 +25,7 @@ jobs: uses: microsoft/setup-msbuild@v1.1 - name: Setup NuGet - uses: NuGet/setup-nuget@v1.0.6 + uses: NuGet/setup-nuget@latest - name: Restore dependencies run: nuget restore CheckIP.Windows\CheckIP.sln diff --git a/.gitignore b/.gitignore index bccfd0e..14fbd0e 100644 --- a/.gitignore +++ b/.gitignore @@ -353,6 +353,9 @@ MigrationBackup/ *.keystore *.pw +# Rider +.idea/ + ### macOS ### # General .DS_Store @@ -386,3 +389,59 @@ Temporary Items # iCloud generated files *.icloud CheckIP.Windows/Setup/Output/ + + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### Xcode ### +## User settings +xcuserdata/ + +## Xcode 8 and earlier +*.xcscmblueprint +*.xccheckout + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcodeproj/project.xcworkspace/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno +**/xcshareddata/WorkspaceSettings.xcsettings + +## Avalonia Build Output +CheckIP.Avalonia/Output/* +CheckIP.Avalonia/macOS.Sign/App +*.pkg diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/App.axaml b/CheckIP.Avalonia/CheckIP.Avalonia/App.axaml new file mode 100644 index 0000000..a89b9cd --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/App.axaml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/App.axaml.cs b/CheckIP.Avalonia/CheckIP.Avalonia/App.axaml.cs new file mode 100644 index 0000000..fc43310 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/App.axaml.cs @@ -0,0 +1,42 @@ +using System; +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Markup.Xaml; +using CheckIP.Pages; + +namespace CheckIP +{ + public partial class App : Application + { + public override void Initialize() + { + AvaloniaXamlLoader.Load(this); + } + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + desktop.MainWindow = new Main(); + } + + base.OnFrameworkInitializationCompleted(); + } + + private void NativeMenuItem_OnClick(object? sender, EventArgs e) + { + var window = new Window() + { + Title = "About CheckIP", + Content = new About(), + MaxHeight = 500, + MaxWidth = 400, + MinHeight = 500, + MinWidth = 400, + CanResize = false + }; + window.Show(); + } + } +} \ No newline at end of file diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/Assets/Logo.svg b/CheckIP.Avalonia/CheckIP.Avalonia/Assets/Logo.svg new file mode 100644 index 0000000..edb56a2 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/Assets/Logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.csproj b/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.csproj new file mode 100644 index 0000000..7f2b5e7 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.csproj @@ -0,0 +1,69 @@ + + + WinExe + net6.0 + enable + true + app.manifest + CheckIP.ico + CheckIP + valnoxy + Exploitox + Get more information about an IP address. + Copyright © 2018 - 2023 Exploitox. All rights reserved. + https://github.com/valnoxy/checkip + 1.0.0-preview1 + osx-x64;osx-arm64;linux-x64;linux-arm64 + + CheckIP + CheckIP + dev.valnoxy.checkip + 1.0.0-preview1 + APPL + ???? + CheckIP + CheckIP.icns + NSApplication + true + 1.0.0-preview1 + true + CheckIP + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + Main.axaml + + + About.axaml + + + + \ No newline at end of file diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.icns b/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.icns new file mode 100644 index 0000000..f6c83ac Binary files /dev/null and b/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.icns differ diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.ico b/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.ico new file mode 100644 index 0000000..39c47ab Binary files /dev/null and b/CheckIP.Avalonia/CheckIP.Avalonia/CheckIP.ico differ diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/Main.axaml b/CheckIP.Avalonia/CheckIP.Avalonia/Main.axaml new file mode 100644 index 0000000..e2615bd --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/Main.axaml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/Main.axaml.cs b/CheckIP.Avalonia/CheckIP.Avalonia/Main.axaml.cs new file mode 100644 index 0000000..643ac91 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/Main.axaml.cs @@ -0,0 +1,63 @@ +using Avalonia.Controls; +using FluentAvalonia.Core; +using FluentAvalonia.UI.Controls; +using System; +using System.Collections.Generic; + +namespace CheckIP +{ + public partial class Main : Window + { + public NavigationView? NavView; + public static Main Instance { get; private set; } + + public Main() + { + InitializeComponent(); + Instance = this; +#if DEBUG + DebugLabel.Content = "Avalonia Debug build - This is not a production ready build."; + DebugLabel.IsVisible = true; +#endif + + // Build the navigation menu + NavView = this.FindControl("RootNavigation"); + + var navItems = new List(); + var footerNavItems = new List(); + navItems.Add(new NavigationViewItem + { + Content = "Fetch", + IconSource = new SymbolIconSource { Symbol = Symbol.Globe }, + Tag = "FetchIP" + }); + navItems.Add(new NavigationViewItem + { + Content = "My IP", + IconSource = new SymbolIconSource { Symbol = Symbol.MapPin }, + Tag = "MyIP" + }); + + footerNavItems.Add(new NavigationViewItem + { + Content = "About", + IconSource = new SymbolIconSource { Symbol = Symbol.ContactInfo }, + Tag = "About" + }); + + NavView!.MenuItems = navItems; + NavView!.FooterMenuItems = footerNavItems; + + NavView!.SelectionChanged += NavigationViewChanged!; + NavView.SelectedItem = NavView.MenuItems.ElementAt(0); + } + + private void NavigationViewChanged(object sender, NavigationViewSelectionChangedEventArgs e) + { + if (e.SelectedItem is not NavigationViewItem nvi) return; + var smpPage = $"CheckIP.Pages.{nvi.Tag}"; + var pg = Activator.CreateInstance(Type.GetType(smpPage)!); + (sender as NavigationView)!.Content = pg; + } + } +} \ No newline at end of file diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/Pages/About.axaml b/CheckIP.Avalonia/CheckIP.Avalonia/Pages/About.axaml new file mode 100644 index 0000000..baaba69 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/Pages/About.axaml @@ -0,0 +1,66 @@ + + + + diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/Pages/About.axaml.cs b/CheckIP.Avalonia/CheckIP.Avalonia/Pages/About.axaml.cs new file mode 100644 index 0000000..e4eb748 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/Pages/About.axaml.cs @@ -0,0 +1,74 @@ +using Avalonia.Controls; +using System; +using System.Reflection; +using Avalonia; + +namespace CheckIP.Pages +{ + public partial class About : UserControl + { + public About() + { + InitializeComponent(); + + try + { + var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); + var productName = Assembly.GetExecutingAssembly().GetName().Name; + ValueVersion.Content = $"{productName} V. {version}"; + ValueCopyright.Content = GetCopyright(); + + var avaloniaInformationalVersion = typeof(AvaloniaObject).Assembly + .GetCustomAttribute()!.InformationalVersion; + var avaloniaVersion = + avaloniaInformationalVersion![ + ..avaloniaInformationalVersion.IndexOf("+", StringComparison.Ordinal)]; + + var fluentAvaloniaVersion = typeof(FluentAvalonia.UI.Controls.NavigationView).Assembly + .GetCustomAttribute()!.InformationalVersion; + + var newtonSoftInformationalVersion = typeof(Newtonsoft.Json.JsonConvert).Assembly + .GetCustomAttribute()!.InformationalVersion; + var newtonsoftVersion = + newtonSoftInformationalVersion![ + ..newtonSoftInformationalVersion.IndexOf("+", StringComparison.Ordinal)]; + + AvaloniaVersion.Content = $"Avalonia V. {avaloniaVersion}"; + FluentAvaloniaVersion.Content = $"FluentAvalonia V. {fluentAvaloniaVersion}"; + NewtonsoftVersion.Content = $"Newtonsoft.Json V. {newtonsoftVersion}"; + } + catch (Exception ex) + { + Console.WriteLine(ex); + } + } + + private string GetCopyright() + { + var asm = Assembly.GetExecutingAssembly(); + var obj = asm.GetCustomAttributes(false); + foreach (var o in obj) + { + if (o.GetType() != + typeof(System.Reflection.AssemblyCopyrightAttribute)) continue; + var aca = (AssemblyCopyrightAttribute) o; + return aca.Copyright; + } + return string.Empty; + } + + private string GetVersion() + { + var asm = Assembly.GetExecutingAssembly(); + var obj = asm.GetCustomAttributes(false); + foreach (var o in obj) + { + if (o.GetType() != + typeof(System.Reflection.AssemblyVersionAttribute)) continue; + var aca = (AssemblyVersionAttribute) o; + return aca.Version; + } + return string.Empty; + } + } +} diff --git a/CheckIP.Avalonia/CheckIP.Avalonia/Pages/FetchIP.axaml b/CheckIP.Avalonia/CheckIP.Avalonia/Pages/FetchIP.axaml new file mode 100644 index 0000000..def4430 --- /dev/null +++ b/CheckIP.Avalonia/CheckIP.Avalonia/Pages/FetchIP.axaml @@ -0,0 +1,122 @@ + + + +