Commit fe28007a authored by Iulian Gheorghiu's avatar Iulian Gheorghiu

Fix: When -s param is different from 1 will write the split files infinite times on disk.

parent 40928260
No preview for this file type
......@@ -150,9 +150,9 @@ namespace IntelHexToVerilogMem
{
outRomL.Add(outRom[cntOutRomInt].Substring((outHexGroupLenBytes == "2") ? 2 : 4, (outHexGroupLenBytes == "2") ? 2 : 4));
outRomH.Add(outRom[cntOutRomInt].Substring(0, (outHexGroupLenBytes == "2") ? 2 : 4));
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRomL.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRomH.ToArray());
}
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRomL.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRomH.ToArray());
}
else if (nrOfFilesToSplit == 4)
{
......@@ -166,11 +166,11 @@ namespace IntelHexToVerilogMem
outRom1.Add(outRom[cntOutRomInt].Substring(4, 2));
outRom2.Add(outRom[cntOutRomInt].Substring(2, 2));
outRom3.Add(outRom[cntOutRomInt].Substring(0, 2));
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRom0.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRom1.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_2" + Path.GetExtension(outputPath), outRom2.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_3" + Path.GetExtension(outputPath), outRom3.ToArray());
}
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRom0.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRom1.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_2" + Path.GetExtension(outputPath), outRom2.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_3" + Path.GetExtension(outputPath), outRom3.ToArray());
}
Environment.Exit(0);
}
......@@ -234,9 +234,9 @@ namespace IntelHexToVerilogMem
{
outRomL.Add(outRom[cntOutRomInt].Substring((outHexGroupLenBytes == "2") ? 2 : 4, (outHexGroupLenBytes == "2") ? 2 : 4));
outRomH.Add(outRom[cntOutRomInt].Substring(0, (outHexGroupLenBytes == "2") ? 2 : 4));
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRomL.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRomH.ToArray());
}
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRomL.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRomH.ToArray());
}
else if (nrOfFilesToSplit == 4)
{
......@@ -250,11 +250,11 @@ namespace IntelHexToVerilogMem
outRom1.Add(outRom[cntOutRomInt].Substring(4, 2));
outRom2.Add(outRom[cntOutRomInt].Substring(2, 2));
outRom3.Add(outRom[cntOutRomInt].Substring(0, 2));
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRom0.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRom1.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_2" + Path.GetExtension(outputPath), outRom2.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_3" + Path.GetExtension(outputPath), outRom3.ToArray());
}
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_0" + Path.GetExtension(outputPath), outRom0.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_1" + Path.GetExtension(outputPath), outRom1.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_2" + Path.GetExtension(outputPath), outRom2.ToArray());
File.WriteAllLines(Path.GetDirectoryName(outputPath) + "/" + Path.GetFileNameWithoutExtension(outputPath) + "_3" + Path.GetExtension(outputPath), outRom3.ToArray());
}
Environment.Exit(0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment