-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1712be8
commit ad6adf6
Showing
21 changed files
with
1,275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Exclude Visual Studio solution and project specific user options. | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
.vs/ | ||
*.opendb | ||
*.VC.db | ||
*.VC.VC.opendb | ||
*.sln | ||
|
||
# Exclude StyleCop cache files. | ||
[Ss]tyle[Cc]op.[Cc]ache | ||
|
||
# Exclude build result files. | ||
[Bb]inary/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Dd]ebug/ | ||
[Rr]elease/ | ||
[Tt]estResults/ | ||
|
||
# Exclude NuGet specific folders and files. | ||
*.nupkg | ||
**/[Pp]ackages/* | ||
!**/[Pp]ackages/[Ww]itron* | ||
!**/[Pp]ackages/[Bb]uild/ | ||
!**/[Pp]ackages/[Rr]epositories.config | ||
|
||
# Exclude common temporary/log files. | ||
*~ | ||
*.~* | ||
*.log | ||
|
||
# Exclude backup files created by some editors. | ||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Application xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:MqttDebugger" | ||
x:Class="MqttDebugger.App"> | ||
<Application.DataTemplates> | ||
<local:ViewLocator/> | ||
</Application.DataTemplates> | ||
|
||
<Application.Styles> | ||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/> | ||
<StyleInclude Source="avares://Avalonia.Themes.Fluent/Accents/FluentLight.xaml"/> | ||
</Application.Styles> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.Markup.Xaml; | ||
using MqttDebugger.ViewModels; | ||
using MqttDebugger.Views; | ||
|
||
namespace MqttDebugger | ||
{ | ||
public class App : Application | ||
{ | ||
public override void Initialize() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
|
||
public override void OnFrameworkInitializationCompleted() | ||
{ | ||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) | ||
{ | ||
desktop.MainWindow = new MainWindow(); | ||
} | ||
|
||
base.OnFrameworkInitializationCompleted(); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Security; | ||
using System.Text; | ||
|
||
namespace MqttDebugger.Models | ||
{ | ||
public class Client | ||
{ | ||
public bool IsConnected { get; set; } = false; | ||
public string Host { get; set; } = "localhost"; | ||
public int Port { get; set; } = 1883; | ||
public MqttUser User { get; set; } | ||
public string Topic { get; set; } = "myTopic"; | ||
public bool ConnectToInternalServer { get; set; } = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace MqttDebugger.Models | ||
{ | ||
public class MqttMessageOptions | ||
{ | ||
public bool DisplayTopic { get; set; } = false; | ||
public bool DisplayPayloadAsString { get; set; } = true; | ||
public string FilterByTopic { get; set; } = "#"; | ||
public bool WritePayloadToFile { get; set; } = false; | ||
public string FolderOutPath { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace MqttDebugger.Models | ||
{ | ||
public class MqttUser | ||
{ | ||
public string Username { get; set; } | ||
public string Password { get; set; } | ||
|
||
public MqttUser(string _username, string _password) | ||
{ | ||
Username = _username; | ||
Password = _password; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Security; | ||
using System.Text; | ||
|
||
namespace MqttDebugger.Models | ||
{ | ||
public class Server | ||
{ | ||
public bool IsRunning { get; set; } | ||
public List<MqttUser> Users { get; set; } | ||
public int Port { get; set; } = 1883; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<ApplicationIcon>logo.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<AvaloniaResource Include="Assets\**" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Avalonia" Version="0.10.0-preview1" /> | ||
<PackageReference Include="Avalonia.Desktop" Version="0.10.0-preview1" /> | ||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0-preview1" /> | ||
<PackageReference Include="MQTTnet" Version="3.0.11" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls.ApplicationLifetimes; | ||
using Avalonia.ReactiveUI; | ||
|
||
namespace MqttDebugger | ||
{ | ||
class Program | ||
{ | ||
// Initialization code. Don't use any Avalonia, third-party APIs or any | ||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized | ||
// yet and stuff might break. | ||
public static void Main(string[] args) => BuildAvaloniaApp() | ||
.StartWithClassicDesktopLifetime(args); | ||
|
||
// Avalonia configuration, don't remove; also used by visual designer. | ||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure<App>() | ||
.UsePlatformDetect() | ||
.LogToDebug() | ||
.UseReactiveUI(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>false</SelfContained> | ||
<PublishSingleFile>True</PublishSingleFile> | ||
<PublishReadyToRun>True</PublishReadyToRun> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using Avalonia.Controls; | ||
using Avalonia.Controls.Templates; | ||
using MqttDebugger.ViewModels; | ||
|
||
namespace MqttDebugger | ||
{ | ||
public class ViewLocator : IDataTemplate | ||
{ | ||
public bool SupportsRecycling => false; | ||
|
||
public IControl Build(object data) | ||
{ | ||
var name = data.GetType().FullName.Replace("ViewModel", "View"); | ||
var type = Type.GetType(name); | ||
|
||
if (type != null) | ||
{ | ||
return (Control)Activator.CreateInstance(type); | ||
} | ||
else | ||
{ | ||
return new TextBlock { Text = "Not Found: " + name }; | ||
} | ||
} | ||
|
||
public bool Match(object data) | ||
{ | ||
return data is ViewModelBase; | ||
} | ||
} | ||
} |
Oops, something went wrong.