Skip to content

Commit

Permalink
source code for H2XC
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmless05 committed Oct 25, 2023
1 parent 6b10443 commit c1eb0c6
Show file tree
Hide file tree
Showing 33 changed files with 1,555 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Application x:Class="H2XC.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:H2XC"
xmlns:view="clr-namespace:H2XC.MVVM.View"
xmlns:viewModel="clr-namespace:H2XC.MVVM.ViewModel"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Purple.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Pink.xaml"/>
</ResourceDictionary.MergedDictionaries>
<DataTemplate DataType="{x:Type viewModel:HomeVM}">
<view:Home/>
</DataTemplate>
<DataTemplate DataType="{x:Type viewModel:IP2ADRSVM}">
<view:IP2ADRS/>
</DataTemplate>
<DataTemplate DataType="{x:Type viewModel:LocInfoVM}">
<view:LocInfo/>
</DataTemplate>
<DataTemplate DataType="{x:Type viewModel:AboutVM}">
<view:About/>
</DataTemplate>
</ResourceDictionary>
</Application.Resources>
</Application>
8 changes: 8 additions & 0 deletions src/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System.Windows;

namespace H2XC
{
public partial class App : Application
{
}
}
14 changes: 14 additions & 0 deletions src/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Reflection;
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyProduct("H2XC")]
[assembly: AssemblyTitle("H2XC")]
16 changes: 16 additions & 0 deletions src/Core/ObservableObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace H2XC.Core
{
class ObservableObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;

protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
}
}
33 changes: 33 additions & 0 deletions src/Core/RelayCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Windows.Input;

namespace H2XC.Core
{
class RelayCommand : ICommand
{
private Action<object> _execute;
private Func<object, bool> _canExecute;

public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}

public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
{
_execute = execute;
_canExecute = canExecute;
}

public bool CanExecute(object parameter)
{
return _canExecute == null || _canExecute(parameter);
}

public void Execute(object parameter)
{
_execute(parameter);
}
}
}
62 changes: 62 additions & 0 deletions src/H2XC.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net7.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\Logo\logo.ico</ApplicationIcon>
<Authors>Harmless</Authors>
<Company></Company>
<RepositoryUrl>https://github.com/Harmless05/H2XC</RepositoryUrl>
<Version></Version>
<Product />
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\BuildDate.txt" />
<None Remove="Resources\Logo\logo-s.png" />
<None Remove="Resources\Logo\logo.png" />
</ItemGroup>

<ItemGroup>
<Content Include="Resources\Logo\logo.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\BuildDate.txt">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</Resource>
<Resource Include="Resources\Logo\logo-s.png" />
</ItemGroup>

<ItemGroup>
<Folder Include="Resources\Fonts\" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="echo %25date%25 %25time%25 &gt; &quot;$(ProjectDir)\\Resources\\BuildDate.txt&quot;" />
</Target>

</Project>
51 changes: 51 additions & 0 deletions src/H2XC.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>D:\Microsoft Visual Studio\H2XC\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Compile Update="MVVM\View\About.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="MVVM\View\Home.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="MVVM\View\IP2ADRS.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="MVVM\View\LocInfo.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Page Update="MVVM\View\About.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="MVVM\View\LocInfo.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Resources\Custom Style\btns-home.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Resources\Custom Style\textblock-sb.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Resources\Custom Style\datagrid-sb.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="MVVM\View\Home.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="MVVM\View\IP2ADRS.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions src/H2XC.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33815.320
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "H2XC", "H2XC.csproj", "{74D2CC41-7A21-4E5E-B5A6-0AF53A43AF2D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{74D2CC41-7A21-4E5E-B5A6-0AF53A43AF2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74D2CC41-7A21-4E5E-B5A6-0AF53A43AF2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74D2CC41-7A21-4E5E-B5A6-0AF53A43AF2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74D2CC41-7A21-4E5E-B5A6-0AF53A43AF2D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {09A08BFE-E4CF-4125-93BD-44D4BC95C939}
EndGlobalSection
EndGlobal
50 changes: 50 additions & 0 deletions src/MVVM/View/About.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<UserControl x:Class="H2XC.MVVM.View.About"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:H2XC.MVVM.View"
xmlns:viewModel="clr-namespace:H2XC.MVVM.ViewModel"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="565" d:DesignWidth="700">
<Grid>
<Label Content="Created By Harmless" FontFamily="{StaticResource MaterialDesignFont}" FontSize="16" HorizontalAlignment="Left" Margin="42,35,0,0" VerticalAlignment="Top"/>
<Button x:Name="btnLicense" Margin="531,79,29,451"
Height="35"
materialDesign:ButtonAssist.CornerRadius="3"
BorderBrush="{x:Null}" Background="{x:Null}" Foreground="#FFE1E1E1"
Style="{StaticResource MaterialDesignFlatButton}" Click="btnLicense_Click">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120">
<materialDesign:PackIcon Width="30" Height="30" Kind="web" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,10,0" />
<TextBlock Margin="5,0,0,0" TextAlignment="Center" VerticalAlignment="Center" Text="License"/>
</StackPanel>
</Button>
<Button x:Name="btnGitHub" Margin="531,39,29,491"
Height="35"
materialDesign:ButtonAssist.CornerRadius="3"
BorderBrush="{x:Null}" Background="{x:Null}" Foreground="#FFE1E1E1"
Style="{StaticResource MaterialDesignFlatButton}" Click="BtnGitHub_Click">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120">
<materialDesign:PackIcon Width="30" Height="30" Kind="Github" Margin="5,0,10,0" />
<TextBlock Margin="5,0,0,0" TextAlignment="Center" VerticalAlignment="Center" Text="GitHub"/>
</StackPanel>
</Button>
<Button x:Name="btnDiscord" Margin="531,119,29,411"
Height="35"
materialDesign:ButtonAssist.CornerRadius="3"
BorderBrush="{x:Null}" Background="{x:Null}" Foreground="#FFE1E1E1"
Style="{StaticResource MaterialDesignFlatButton}" Click="btnDiscord_Click">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120">
<materialDesign:PackIcon Width="30" Height="30" Kind="Web" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5,0,10,0" />
<TextBlock Text="Discord" Margin="5,0,0,0" TextAlignment="Center" VerticalAlignment="Center" />
</StackPanel>
</Button>
<Button x:Name="lel" Margin="636,502,54,53" Height="10" BorderBrush="{x:Null}" Background="{x:Null}" Foreground="{x:Null}" Click="lel_Click"/>
<Label x:Name="VersionLbl" Content="Version: " FontFamily="{StaticResource MaterialDesignFont}" FontSize="14" IsEnabled="False" HorizontalAlignment="Left" Margin="42,74,0,0" VerticalAlignment="Top" Width="250"/>
<Label x:Name="BDateLbl" Content="Build Date: " FontFamily="{StaticResource MaterialDesignFont}" FontSize="14" IsEnabled="False" HorizontalAlignment="Left" Margin="42,134,0,0" VerticalAlignment="Top" Width="250"/>
<Label x:Name="BranchLbl" Content="Branch: " FontFamily="{StaticResource MaterialDesignFont}" FontSize="14" IsEnabled="False" HorizontalAlignment="Left" Margin="42,104,0,0" VerticalAlignment="Top" Width="250"/>
<TextBlock FontFamily="{StaticResource MaterialDesignFont}" TextWrapping="Wrap" Foreground="#7FDCDCDC" FontSize="14" Padding="2,0,0,15" ScrollViewer.VerticalScrollBarVisibility="Auto" LineHeight="22" Text="H2XC is a freely available network utility tool designed to provide insights into the local network." Margin="42,192,328,323"/>
<TextBlock FontFamily="{StaticResource MaterialDesignFont}" TextWrapping="Wrap" Foreground="#7FDCDCDC" FontSize="14" Padding="2,0,0,15" ScrollViewer.VerticalScrollBarVisibility="Auto" LineHeight="22" Text="Please feel free to submit new feature requests or report any bugs to the GitHub repository." Margin="42,256,328,259"/>
</Grid>
</UserControl>
75 changes: 75 additions & 0 deletions src/MVVM/View/About.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using MaterialDesignColors;
using MaterialDesignThemes.Wpf;

namespace H2XC.MVVM.View
{
/// <summary>
/// Interaction logic for About.xaml
/// </summary>
public partial class About : UserControl
{
public About()
{
InitializeComponent();

// Set current Build Date (dd/mm/yyyy hh:mm)
string dateTime = Properties.Resources.BuildDate.ToString();
dateTime = dateTime.Remove(dateTime.Length - 9);
BDateLbl.Content += dateTime;

// Set current Version (Major.Minor.Build/Patch)
VersionLbl.Content += Properties.Resources.Version.ToString();

// Set current Branch (Public Release, Beta, Alpha, Tester)
BranchLbl.Content += Properties.Resources.Branch.ToString();
}



private void BtnGitHub_Click(object sender, RoutedEventArgs e)
{
var startInfo = new ProcessStartInfo("cmd", $"/c start https://github.com/Harmless05/H2XC/")
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(startInfo);
}

private void btnLicense_Click(object sender, RoutedEventArgs e)
{
var startInfo = new ProcessStartInfo("cmd", $"/c start https://github.com/Harmless05/H2XC/blob/main/LICENSE")
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(startInfo);
}

private void btnDiscord_Click(object sender, RoutedEventArgs e)
{
var startInfo = new ProcessStartInfo("cmd", $"/c start https://discord.com/invite/a2XevWa4zQ")
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(startInfo);
}

private void lel_Click(object sender, RoutedEventArgs e)
{
// An easter egg. I'm not sure why you're looking at this code. But congrats, you found it! :)
// It was acutally supposed to be found in the About page.
var startInfo = new ProcessStartInfo("cmd", $"/c start https://youtube.com/watch?v=1qN72LEQnaU")
{
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
};
Process.Start(startInfo);
}
}
}
Loading

0 comments on commit c1eb0c6

Please sign in to comment.