Oops, needs FullName, not Name
This commit is contained in:
parent
25c90418b7
commit
8e6956034f
|
@ -1,4 +1,14 @@
|
|||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": []
|
||||
"tasks": [
|
||||
{
|
||||
"type": "PlatformIO",
|
||||
"task": "Build",
|
||||
"problemMatcher": [
|
||||
"$platformio"
|
||||
],
|
||||
"group": "build",
|
||||
"label": "PlatformIO: Build"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
using System.IO.Ports;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Ports;
|
||||
using System.CommandLine;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SendEPROM
|
||||
{
|
||||
|
@ -7,20 +10,22 @@ namespace SendEPROM
|
|||
{
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
var rootCmd = new RootCommand("Send a binary image to the EPROM emulator");
|
||||
|
||||
var portOption = new Option<string> (new string[] {"--port", "-p" }, description: "COM port on which to send the file", getDefaultValue: () => "COM3");
|
||||
var portOption = new Option<string>(new string[] {"--port", "-p" }, description: "COM port on which to send the file", getDefaultValue: () => "COM3");
|
||||
var baudOption = new Option<int> (new string[] {"--baud", "-b" }, description: "Baud rate at which to send", getDefaultValue: () => 115200);
|
||||
var modeOption = new Option<byte> (new string[] {"--mode", "-m" }, description: "EPROM mode (1 = 27C256, 2 = 27C020)", getDefaultValue: () => 2);
|
||||
|
||||
var fileArgument = new Argument<FileInfo>("file", description: "File to send");
|
||||
|
||||
rootCmd.AddOption(portOption);
|
||||
rootCmd.AddOption(baudOption);
|
||||
rootCmd.AddOption(modeOption);
|
||||
rootCmd.AddArgument(fileArgument);
|
||||
var rootCmd = new RootCommand("Send a binary image to the EPROM emulator")
|
||||
{
|
||||
portOption,
|
||||
baudOption,
|
||||
modeOption,
|
||||
fileArgument
|
||||
};
|
||||
|
||||
rootCmd.SetHandler((port, baud, mode, file) =>
|
||||
rootCmd.SetHandler(
|
||||
(port, baud, mode, file) =>
|
||||
{
|
||||
SendData(port, baud, mode, file);
|
||||
},
|
||||
|
@ -32,8 +37,8 @@ namespace SendEPROM
|
|||
static void SendData(string port, int baud, byte mode, FileInfo file)
|
||||
{
|
||||
|
||||
Console.WriteLine($"Reading {file.Name}");
|
||||
byte[] buff = File.ReadAllBytes(file.Name);
|
||||
Console.WriteLine($"Reading {file.FullName}");
|
||||
byte[] buff = File.ReadAllBytes(file.FullName);
|
||||
|
||||
Console.WriteLine($"Opening {port} at {baud}");
|
||||
var sp = new SerialPort(port)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
Loading…
Reference in New Issue