bug ffpm-745.txt U dans I n'est pas correctement exclu
This commit is contained in:
parent
99314a1b4d
commit
f3206c1554
1 changed files with 14 additions and 6 deletions
|
|
@ -21,7 +21,6 @@ import mg.dot.feufaro.midi.MidiWriterKotlin
|
||||||
//@todo: ews-80.txt ${m:12/4}
|
//@todo: ews-80.txt ${m:12/4}
|
||||||
//@todo: ews-81.txt ${R=}${D:....}
|
//@todo: ews-81.txt ${R=}${D:....}
|
||||||
//@todo: bug ffpm-629.txt sssszd au lieu de ssss-d(-rrrrtdr)
|
//@todo: bug ffpm-629.txt sssszd au lieu de ssss-d(-rrrrtdr)
|
||||||
//@todo: bug ffpm-745.txt U dans I n'est pas correctement exclu
|
|
||||||
|
|
||||||
class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository: FileRepository) {
|
class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository: FileRepository) {
|
||||||
private val T: MutableList<PTemplate> = mutableListOf()
|
private val T: MutableList<PTemplate> = mutableListOf()
|
||||||
|
|
@ -340,7 +339,7 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
loadN(voiceNumber, result, templateComments)
|
loadN(voiceNumber, result, templateComments)
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun parseOneLine(line: String) {
|
private suspend fun parseOneLine(line: String, regexIgnoreString: String = "") {
|
||||||
val index: Int
|
val index: Int
|
||||||
val value: String
|
val value: String
|
||||||
val lineLength = line.trim().length
|
val lineLength = line.trim().length
|
||||||
|
|
@ -385,12 +384,12 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
loadO(index, value)
|
loadO(index, value)
|
||||||
|
|
||||||
"I" ->
|
"I" ->
|
||||||
loadI(value)
|
loadI(value, regexIgnoreString)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun loadI(line: String) {
|
suspend fun loadI(line: String, regexIgnoreString: String = "") {
|
||||||
val lineSplit = line.split(":")
|
val lineSplit = line.split(":")
|
||||||
val lastSlashInFilename = currentFile.lastIndexOf('/')
|
val lastSlashInFilename = currentFile.lastIndexOf('/')
|
||||||
val fileNamePrefix = if (lastSlashInFilename != -1) {
|
val fileNamePrefix = if (lastSlashInFilename != -1) {
|
||||||
|
|
@ -398,6 +397,15 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
val regexIgnoreString = try {
|
||||||
|
if (regexIgnoreString != "") {
|
||||||
|
regexIgnoreString + "|" + lineSplit[1]
|
||||||
|
} else {
|
||||||
|
lineSplit[1]
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
"^:"
|
||||||
|
}
|
||||||
val filePath = fileNamePrefix + lineSplit[0]
|
val filePath = fileNamePrefix + lineSplit[0]
|
||||||
val lines = try {
|
val lines = try {
|
||||||
fileRepository.readFileLines(filePath)
|
fileRepository.readFileLines(filePath)
|
||||||
|
|
@ -406,11 +414,11 @@ class Solfa(val sharedScreenModel: SharedScreenModel, private val fileRepository
|
||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
val ignoredLines = Regex(lineSplit[1])
|
val ignoredLines = Regex(regexIgnoreString)
|
||||||
lines.forEach {
|
lines.forEach {
|
||||||
val match = ignoredLines.find(it)
|
val match = ignoredLines.find(it)
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
parseOneLine(it)
|
parseOneLine(it, regexIgnoreString)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue