initial commit. V0.0.1 release

This commit is contained in:
Adam Bissen 2022-12-17 09:45:05 -06:00
parent a4b7b4d6c8
commit d43a4f818b
5 changed files with 105 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
bin/*
obj/*

26
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/net7.0/GCodeRename.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}

41
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,41 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/GCodeRename.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/GCodeRename.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/GCodeRename.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

12
GCodeRename.csproj Normal file
View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>0.0.1</Version>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PublishSingleFile>true</PublishSingleFile>
</PropertyGroup>
</Project>

24
Program.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
using System.IO;
using System.Text.RegularExpressions;
Console.WriteLine("GCode for Drawbot Conversion Tool\n* * * * * * * * * * * * * * * * *");
string currentPath = Directory.GetCurrentDirectory();
string[] curFiles = Directory.GetFiles(currentPath, "*.ngc?");
foreach (string filename in curFiles) {
Console.WriteLine("Modifying: " + filename);
using (var reader = new StreamReader(filename)) {
string fileText = reader.ReadToEnd();
fileText = Regex.Replace(fileText, "([ ][Z]([^ |\n])*)", "");
fileText = Regex.Replace(fileText, "(\n[G][0][0]\n)", "\n");
//Console.Write(fileText + "\n");
string newFile = Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + ".gcode";
Console.WriteLine("Saving to: " + newFile);
File.WriteAllText(newFile, fileText);
}
}
foreach (string v in curFiles) {
Console.WriteLine("Deleting File: " + v);
File.Delete(v);
}