catch filenotfound (or something)

namefix
sidekek 5 years ago
parent 207b28654f
commit 7dbc721120
  1. 2
      .gitignore
  2. 27
      .vscode/launch.json
  3. 42
      .vscode/tasks.json
  4. 14
      Program.cs

2
.gitignore vendored

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

@ -0,0 +1,27 @@
{
// 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
"version": "0.2.0",
"configurations": [
{
"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/netcoreapp3.1/kot.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",
"processId": "${command:pickProcess}"
}
]
}

42
.vscode/tasks.json vendored

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

@ -17,13 +17,23 @@ namespace kot
Console.WriteLine(@"maek ascii !! Console.WriteLine(@"maek ascii !!
kot <input> kot <input>
input argument /must/ be of types: {jpg, jpeg, png, bmp,}"); input argument /must/ be of types: {jpg, jpeg, png, bmp,}");
System.Environment.Exit(0); System.Environment.Exit(-1);
} }
string path = args[0]; string path = args[0];
string final = ""; string final = "";
string[] scale = {".",",",":",";","+","*","?","%","S","#","@"}; string[] scale = {".",",",":",";","+","*","?","%","S","#","@"};
//Array.Reverse(scale); //Array.Reverse(scale);
var f = new Bitmap(path); Bitmap f;
try
{
f = new Bitmap(path);
}
catch
{
Console.WriteLine("bad path");
System.Environment.Exit(-1);
}
f = new Bitmap(path);
for (int i = 0; i < f.Height; i += 30) for (int i = 0; i < f.Height; i += 30)
{ {
for (int z = 0; z < f.Width; z += 30) for (int z = 0; z < f.Width; z += 30)

Loading…
Cancel
Save