Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/NesTiler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2022-10-28 19:27:19 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2022-10-28 19:27:19 +0300
commit1e19ceb97bc616e7311c5836613ed45576411578 (patch)
tree48843c117ebc6e02401756b195b77814f6100144
parente657a3b476b096250a473b3b684abf328b7f0cbe (diff)
Error checks.
-rw-r--r--NesTiler/Config.cs12
-rw-r--r--NesTiler/Program.cs4
2 files changed, 10 insertions, 6 deletions
diff --git a/NesTiler/Config.cs b/NesTiler/Config.cs
index d039e68..927bf76 100644
--- a/NesTiler/Config.cs
+++ b/NesTiler/Config.cs
@@ -34,7 +34,7 @@ namespace com.clusterrr.Famicom.NesTiler
public int PatternTableStartOffsetShared { get; private set; } = 0;
public Dictionary<int, int> PatternTableStartOffsets { get; private set; } = new Dictionary<int, int>();
public Dictionary<int, int> PattributeTableYOffsets { get; private set; } = new Dictionary<int, int>();
- public bool quiet { get; private set; } = false;
+ public bool Quiet { get; private set; } = false;
// Filenames
public Dictionary<int, string> OutPreview { get; private set; } = new Dictionary<int, string>();
@@ -250,7 +250,7 @@ namespace com.clusterrr.Famicom.NesTiler
break;
case ArgQuiet.S:
case ArgQuiet.L:
- config.quiet = true;
+ config.Quiet = true;
break;
default:
throw new ArgumentException($"Unknown argument.", args[i]);
@@ -262,10 +262,14 @@ namespace com.clusterrr.Famicom.NesTiler
{
case TilesMode.Sprites8x8:
case TilesMode.Sprites8x16:
- if (!config.BgColor.HasValue) throw new InvalidDataException("You must specify background color for sprites.");
+ if (!config.BgColor.HasValue) throw new InvalidDataException("You must specify background color for sprites mode.");
break;
}
- // TODO: more input checks
+ // Check output files
+ foreach (var c in new Dictionary<int, string>[] { config.OutPreview, config.OutPatternTable, config.OutNameTable, config.OutAttributeTable })
+ foreach (var f in c)
+ if (!config.ImageFiles.ContainsKey(f.Key))
+ throw new ArgumentException($"Can't write {f.Value} - there is no input image with index {f.Key}.");
return config;
}
diff --git a/NesTiler/Program.cs b/NesTiler/Program.cs
index c23d5ab..90c729f 100644
--- a/NesTiler/Program.cs
+++ b/NesTiler/Program.cs
@@ -56,7 +56,7 @@ namespace com.clusterrr.Famicom.NesTiler
var c = Config.Parse(args);
Trace.Listeners.Clear();
- if (!c.quiet)
+ if (!c.Quiet)
{
PrintAppInfo();
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
@@ -227,7 +227,7 @@ namespace com.clusterrr.Famicom.NesTiler
candidates[i]);
}
// Select background color which uses minimum palettes
- // TODO: less palettes != best solution? Take in account tile count.
+ // TODO: less palettes != best solution? Take tile count into account.
var kvAllLossless = calcResults.Where(kv => kv.Value.LossyInfo == null).OrderBy(kv => kv.Value.Palettes.Length);
if (kvAllLossless.Any())
{