Skip to content

Commit

Permalink
First version.
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankenApps committed Jul 21, 2020
1 parent 1712be8 commit ad6adf6
Show file tree
Hide file tree
Showing 21 changed files with 1,275 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .gitignore
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
13 changes: 13 additions & 0 deletions App.axaml
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>
26 changes: 26 additions & 0 deletions App.axaml.cs
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 added Assets/Images/logo.afdesign
Binary file not shown.
Binary file added Assets/Images/logo.ico
Binary file not shown.
Binary file added Assets/Images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions Models/Client.cs
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;
}
}
15 changes: 15 additions & 0 deletions Models/MqttMessageOptions.cs
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; }
}
}
18 changes: 18 additions & 0 deletions Models/MqttUser.cs
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;
}
}
}
14 changes: 14 additions & 0 deletions Models/Server.cs
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;
}
}
16 changes: 16 additions & 0 deletions MqttDebugger.csproj
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>
23 changes: 23 additions & 0 deletions Program.cs
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();
}
}
17 changes: 17 additions & 0 deletions Properties/PublishProfiles/FolderProfile.pubxml
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>
32 changes: 32 additions & 0 deletions ViewLocator.cs
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;
}
}
}
Loading

0 comments on commit ad6adf6

Please sign in to comment.