~ruther/NosTale-PacketLogger

4d6087e1bd00b4880cd83790ca7fc71f34986bfe — František Boháček 2 years ago 2b123e8
chore: add packetlogger folder structure
M NosTale-PacketLogger.sln => NosTale-PacketLogger.sln +14 -0
@@ 1,8 1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PacketLogger.PacketAnalyzer", "src\PacketLogger.PacketAnalyzer\PacketLogger.PacketAnalyzer.csproj", "{4DDFB174-CF6F-41D1-8E94-8D54F10F7177}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PacketLogger", "src\PacketLogger\PacketLogger.csproj", "{ED52AE11-3808-4D50-93DA-888F231F5207}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{4DDFB174-CF6F-41D1-8E94-8D54F10F7177}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{4DDFB174-CF6F-41D1-8E94-8D54F10F7177}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{4DDFB174-CF6F-41D1-8E94-8D54F10F7177}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{4DDFB174-CF6F-41D1-8E94-8D54F10F7177}.Release|Any CPU.Build.0 = Release|Any CPU
		{ED52AE11-3808-4D50-93DA-888F231F5207}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{ED52AE11-3808-4D50-93DA-888F231F5207}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{ED52AE11-3808-4D50-93DA-888F231F5207}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{ED52AE11-3808-4D50-93DA-888F231F5207}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
EndGlobal

M NosTale-PacketLogger.sln.DotSettings.user => NosTale-PacketLogger.sln.DotSettings.user +7 -7
@@ 4,14 4,14 @@
&lt;/AssemblyExplorer&gt;</s:String>
	<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files\dotnet\sdk\7.0.101\MSBuild.dll</s:String>
	<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1114112</s:Int64>
	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=2e7fd038_002Db931_002D47b3_002D8d51_002D789fad0fbf90/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="PacketFcTestSubpackets" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
  &lt;TestAncestor&gt;&#xD;
    &lt;TestId&gt;xUnit::9BC56B40-64E3-4A8F-AD49-C52857A35026::net6.0::NosSmooth.Packets.Tests.Converters.Packets.InPacketConverterTests.DeserializesPlayerInCorrectly&lt;/TestId&gt;&#xD;
    &lt;TestId&gt;xUnit::9BC56B40-64E3-4A8F-AD49-C52857A35026::net6.0::NosSmooth.Packets.Tests.Converters.Packets.InPacketConverterTests.SerializesPlayerInCorrectly&lt;/TestId&gt;&#xD;
  &lt;/TestAncestor&gt;&#xD;
	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=2e7fd038_002Db931_002D47b3_002D8d51_002D789fad0fbf90/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" Name="PacketFcTestSubpackets" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
  &lt;TestAncestor&gt;
    &lt;TestId&gt;xUnit::9BC56B40-64E3-4A8F-AD49-C52857A35026::net6.0::NosSmooth.Packets.Tests.Converters.Packets.InPacketConverterTests.DeserializesPlayerInCorrectly&lt;/TestId&gt;
    &lt;TestId&gt;xUnit::9BC56B40-64E3-4A8F-AD49-C52857A35026::net6.0::NosSmooth.Packets.Tests.Converters.Packets.InPacketConverterTests.SerializesPlayerInCorrectly&lt;/TestId&gt;
  &lt;/TestAncestor&gt;
&lt;/SessionState&gt;</s:String>
	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=7c63d857_002Da6c6_002D4af8_002Daddc_002D708763c73754/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="PacketFcTestSubpackets #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
  &lt;Project Location="D:\Shared\Documents\my_projects\NosSmooth" Presentation="&amp;lt;Tests&amp;gt;" /&gt;&#xD;
	<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=7c63d857_002Da6c6_002D4af8_002Daddc_002D708763c73754/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="PacketFcTestSubpackets #2" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
  &lt;Project Location="D:\Shared\Documents\my_projects\NosSmooth" Presentation="&amp;lt;Tests&amp;gt;" /&gt;
&lt;/SessionState&gt;</s:String>
	
	<s:Boolean x:Key="/Default/UnloadedProject/UnloadedProjects/=19666500_002D4636_002D4400_002D8855_002D496317f4a7f7_0023NosSmooth_002EGame/@EntryIndexedValue">True</s:Boolean>

A src/PacketLogger/App.axaml => src/PacketLogger/App.axaml +13 -0
@@ 0,0 1,13 @@
<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="using:PacketLogger"
             x:Class="PacketLogger.App">
    <Application.DataTemplates>
        <local:ViewLocator />
    </Application.DataTemplates>

    <Application.Styles>
        <FluentTheme Mode="Dark" />
        <StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
    </Application.Styles>
</Application>
\ No newline at end of file

A src/PacketLogger/App.axaml.cs => src/PacketLogger/App.axaml.cs +38 -0
@@ 0,0 1,38 @@
//
//  App.axaml.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using PacketLogger.ViewModels;
using PacketLogger.Views;
using PropertyChanged;

namespace PacketLogger;

[DoNotNotify]
public partial class App : Application
{
    /// <inheritdoc />
    public override void Initialize()
    {
        AvaloniaXamlLoader.Load(this);
    }

    /// <inheritdoc />
    public override void OnFrameworkInitializationCompleted()
    {
        if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
        {
            desktop.MainWindow = new MainWindow
            {
                DataContext = new MainWindowViewModel(),
            };
        }

        base.OnFrameworkInitializationCompleted();
    }
}
\ No newline at end of file

A src/PacketLogger/PacketLogger.csproj => src/PacketLogger/PacketLogger.csproj +37 -0
@@ 0,0 1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net7.0</TargetFramework>
    <Nullable>enable</Nullable>
    <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
    <ApplicationManifest>app.manifest</ApplicationManifest>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="Assets" />
    <Folder Include="Models\" />
    <AvaloniaResource Include="Assets\**" />
    <None Remove=".gitignore" />
  </ItemGroup>

  <ItemGroup>
    <TrimmerRootDescriptor Include="Roots.xml" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Avalonia" Version="0.10.18" />
    <PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
    <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />
    <PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
    <PackageReference Include="DataBox" Version="0.10.13" />
    <PackageReference Include="Dock.Avalonia" Version="0.10.18" />
    <PackageReference Include="Dock.Model.Mvvm" Version="0.10.18" />
    <PackageReference Include="NosSmooth.PacketSerializer.Abstractions" Version="1.3.1" />
    <PackageReference Include="Projektanker.Icons.Avalonia" Version="5.8.0" />
    <PackageReference Include="Projektanker.Icons.Avalonia.MaterialDesign" Version="5.8.0" />
    <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
    <PackageReference Include="Remora.Results" Version="7.2.3" />
    <PackageReference Include="XamlNameReferenceGenerator" Version="1.5.1" />
  </ItemGroup>
</Project>

A src/PacketLogger/Program.cs => src/PacketLogger/Program.cs +41 -0
@@ 0,0 1,41 @@
//
//  Program.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Avalonia;
using Avalonia.Media;
using Avalonia.ReactiveUI;
using Projektanker.Icons.Avalonia;
using Projektanker.Icons.Avalonia.MaterialDesign;

namespace PacketLogger;

/// <summary>
/// Application entrypoint class.
/// </summary>
public class Program
{
    /// <summary>
    /// Application entrypoint.
    /// </summary>
    /// <param name="args">The CLI arguments.</param>
    [STAThread]
    public static void Main(string[] args)
        => BuildAvaloniaApp()
            .StartWithClassicDesktopLifetime(args);

    /// <summary>
    /// Build the Avalonia app.
    /// </summary>
    /// <returns>The app builder.</returns>
    public static AppBuilder BuildAvaloniaApp()
        => AppBuilder.Configure<App>()
            .UsePlatformDetect()
            .LogToTrace()
            .UseReactiveUI()
            .WithIcons(c => c.Register<MaterialDesignIconProvider>())
            .With(new FontManagerOptions() { DefaultFamilyName = "Arial" });
}
\ No newline at end of file

A src/PacketLogger/Roots.xml => src/PacketLogger/Roots.xml +5 -0
@@ 0,0 1,5 @@
<linker>
  <!-- Can be removed if CompiledBinding and no reflection are used -->
  <assembly fullname="PacketLogger" preserve="All" />
  <assembly fullname="Avalonia.Themes.Fluent" preserve="All" />
</linker>

A src/PacketLogger/ViewLocator.cs => src/PacketLogger/ViewLocator.cs +41 -0
@@ 0,0 1,41 @@
//
//  ViewLocator.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using PacketLogger.ViewModels;

namespace PacketLogger;

/// <inheritdoc />
public class ViewLocator : IDataTemplate
{
    /// <inheritdoc />
    public IControl Build(object? data)
    {
        if (data is null)
        {
            return new TextBlock { Text = "View not selected." };
        }

        var name = data.GetType().FullName!.Replace("ViewModel", "View");
        var type = Type.GetType(name);

        if (type != null)
        {
            return (Control)Activator.CreateInstance(type)!;
        }

        return new TextBlock { Text = "Not Found: " + name };
    }

    /// <inheritdoc />
    public bool Match(object? data)
    {
        return data is ViewModelBase;
    }
}
\ No newline at end of file

A src/PacketLogger/ViewModels/ViewModelBase.cs => src/PacketLogger/ViewModels/ViewModelBase.cs +15 -0
@@ 0,0 1,15 @@
//
//  ViewModelBase.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.ComponentModel;
using ReactiveUI;

namespace PacketLogger.ViewModels;

/// <inheritdoc />
public class ViewModelBase : ReactiveObject, INotifyPropertyChanged
{
}

A src/PacketLogger/app.manifest => src/PacketLogger/app.manifest +18 -0
@@ 0,0 1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <!-- This manifest is used on Windows only.
       Don't remove it as it might cause problems with window transparency and embeded controls.
       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
  <assemblyIdentity version="1.0.0.0" name="AvaloniaTest.Desktop"/>

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- A list of the Windows versions that this application has been tested on
           and is designed to work with. Uncomment the appropriate elements
           and Windows will automatically select the most compatible environment. -->

      <!-- Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
    </application>
  </compatibility>
</assembly>

Do not follow this link