|
CsoundUnity 4.0.0-alpha.3
|
Reads the <Cabbage> JSON section of a Cabbage 3 csd into CsoundChannelController entries, the shape the Cabbage 2 line parser also produces, so presets, the inspector and the UI components see one model.
More...
Static Package Functions | |
| static bool | TryGetCabbageBlock (string csdContent, out string json) |
Lifts the text between <Cabbage> and </Cabbage>. | |
| static bool | IsCabbage3 (string csdContent) |
| Whether this csd carries a Cabbage 3 section, so the JSON reader applies. | |
| static Cabbage3Reading | Read (string csdContent) |
Reads a Cabbage 3 section, or returns null when the csd carries none. | |
| static List< string > | CollectUnknownKeys (string json) |
| The JSON keys this reader does not declare, so a misspelling or a key Cabbage adds later can be reported instead of silently leaving a field at its default. | |
Reads the <Cabbage> JSON section of a Cabbage 3 csd into CsoundChannelController entries, the shape the Cabbage 2 line parser also produces, so presets, the inspector and the UI components see one model.
The JSON model lives in Cabbage3Document. What is here is the conversion, and the conversion is where the two formats genuinely differ.
|
inlinestaticpackage |
The JSON keys this reader does not declare, so a misspelling or a key Cabbage adds later can be reported instead of silently leaving a field at its default.
A text scan, not a parse: a string literal followed by a colon is a key, wherever it sits. It does not check that a key appears somewhere it would be read, so it catches a name that exists nowhere and misses one in the wrong place. It is a hint about spelling, and it is the one thing UnityEngine.JsonUtility cannot give, since it drops what it does not recognise without saying so.
|
inlinestaticpackage |
Whether this csd carries a Cabbage 3 section, so the JSON reader applies.
The tags are not the test: a Cabbage 2 csd wraps its widget lines in the same <Cabbage> … </Cabbage>. What tells them apart is what is inside, a JSON object against a first widget line.
|
inlinestaticpackage |
Reads a Cabbage 3 section, or returns null when the csd carries none.
Each call returns controllers of its own, so two components reading the same csd do not share them.
|
inlinestaticpackage |
Lifts the text between <Cabbage> and </Cabbage>.
Character based, not line based: a Cabbage 3 section is free to hold the whole JSON object on one line, and often does.