Add Software

This commit is contained in:
Persephone Bubblegum-Holiday 2025-03-31 18:26:04 -07:00
parent 4d0b2610d9
commit 284cf95265
22 changed files with 657 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>PinkConnection2_TestApp.Gtk</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PinkConnection2-TestApp\PinkConnection2-TestApp.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.Gtk" Version="2.9.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,14 @@
using System;
using Eto.Forms;
namespace PinkConnection2_TestApp.Gtk
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Gtk).Run(new MainForm());
}
}
}

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>PinkConnection2-TestApp</string>
<key>CFBundleIdentifier</key>
<string>me.kawaiizenbo.PinkConnection2-TestApp</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>CFBundleIconFile</key>
<string>Icon.icns</string>
</dict>
</plist>

View file

@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>PinkConnection2_TestApp.Mac</RootNamespace>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PinkConnection2-TestApp\PinkConnection2-TestApp.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.Mac64" Version="2.9.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,14 @@
using System;
using Eto.Forms;
namespace PinkConnection2_TestApp.Mac
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Mac64).Run(new MainForm());
}
}
}

View file

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>PinkConnection2_TestApp.Wpf</RootNamespace>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PinkConnection2-TestApp\PinkConnection2-TestApp.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.Wpf" Version="2.9.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,14 @@
using System;
using Eto.Forms;
namespace PinkConnection2_TestApp.Wpf
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Wpf).Run(new MainForm());
}
}
}

View file

@ -0,0 +1,105 @@
using System;
using System.IO.Ports;
using Eto.Forms;
using Eto.Drawing;
namespace PinkConnection2_TestApp
{
public class MainForm : Form
{
SerialPort port = null;
byte b = 0;
TextBox CommandTextBox = new TextBox { MaxLength = 2 };
DropDown SerialPortDropDown = new DropDown();
public MainForm()
{
Title = "PinkConnection2 Test App";
Size = new Size(480, 300);
Maximizable = false;
Resizable = false;
foreach (string s in SerialPort.GetPortNames())
{
SerialPortDropDown.Items.Add(s);
}
SerialPortDropDown.SelectedValueChanged += (sender, e) => selectSerialPort();
DynamicLayout layout = new DynamicLayout { DefaultSpacing = new Size(10, 10), DefaultPadding = new Padding(5, 5, 5, 5) };
layout.BeginVertical();
layout.BeginHorizontal();
layout.Add(new Label { Text = "Serial Port" });
layout.EndHorizontal();
layout.BeginHorizontal();
layout.Add(SerialPortDropDown, true);
layout.EndHorizontal();
layout.EndVertical();
layout.BeginVertical();
layout.BeginHorizontal();
layout.Add(new Label { Text = "Channels" });
layout.EndHorizontal();
layout.BeginHorizontal();
layout.Add(new Button { Text = "Channel 1", Command = new Command((sender, e) => { if ((b&1)==1) b-=1; else b+=1; sendFrame(); }) }, true);
layout.Add(new Button { Text = "Channel 2", Command = new Command((sender, e) => { if ((b&2)==2) b-=2; else b+=2; sendFrame(); }) }, true);
layout.Add(new Button { Text = "Channel 3", Command = new Command((sender, e) => { if ((b&4)==4) b-=4; else b+=4; sendFrame(); }) }, true);
layout.Add(new Button { Text = "Channel 4", Command = new Command((sender, e) => { if ((b&8)==8) b-=8; else b+=8; sendFrame(); }) }, true);
layout.EndHorizontal();
layout.BeginHorizontal();
layout.Add(new Button { Text = "Channel 5", Command = new Command((sender, e) => { if ((b&16)==16) b-=16; else b+=16; sendFrame(); }) }, true);
layout.Add(new Button { Text = "Channel 6", Command = new Command((sender, e) => { if ((b&32)==32) b-=32; else b+=32; sendFrame(); }) }, true);
layout.Add(new Button { Text = "Channel 7", Command = new Command((sender, e) => { if ((b&64)==64) b-=64; else b+=64; sendFrame(); }) }, true);
layout.Add(new Button { Text = "Channel 8", Command = new Command((sender, e) => { if ((b&128)==128) b-=128; else b+=128; sendFrame(); }) }, true);
layout.EndHorizontal();
layout.EndVertical();
layout.BeginVertical();
layout.BeginHorizontal();
layout.Add(new Label { Text = "Send Command" });
layout.EndHorizontal();
layout.BeginHorizontal();
layout.Add(CommandTextBox, true);
layout.Add(new Button { Text = "Send", Command = new Command((sender, e) => sendRawSafe()) });
layout.EndHorizontal();
layout.EndVertical();
layout.BeginVertical();
layout.Add(null, true);
layout.EndVertical();
Content = layout;
}
void sendFrame()
{
byte byte1 = (byte)(64 | ((b & 8) | (b & 4) | (b & 2) | (b & 1)));
byte byte2 = (byte)(64 | (((b & 128) | (b & 64) | (b & 32) | (b & 16)) >> 4));
port.Write(((char)byte1).ToString());
port.Write(((char)byte2).ToString());
}
void sendRawSafe()
{
if (CommandTextBox.Text.Length != 2)
{
MessageBox.Show("Command Length must not be less than 2");
return;
}
port.Write(CommandTextBox.Text);
}
void selectSerialPort()
{
if (port != null) port.Close();
port = new SerialPort((string)SerialPortDropDown.SelectedKey, 9600, Parity.None, 8, StopBits.One);
port.Open();
}
}
}

View file

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>PinkConnection2_TestApp</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.9.0" />
<PackageReference Include="System.IO.Ports" Version="10.0.0-preview.2.25163.2" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,2 @@
cd PinkConnection2-TestApp.Gtk
dotnet build

View file

@ -0,0 +1,2 @@
cd PinkConnection2-TestApp.Mac
dotnet build

View file

@ -0,0 +1,3 @@
@ECHO OFF
cd PinkConnection2-TestApp.Wpf
dotnet build