private int SerializeLoop(int index) { int i = index; Script.Add(ParseCMD(Lines[i])); decimal len = 0; while (ParseCMD(Lines[++i]).CRC != 0x38A3EC78) { ACMDCommand tmp = ParseCMD(Lines[i]); len += (tmp.CalcSize() / 4); i += SerializeCommands(i, tmp.CRC); Script.Add(tmp); } ACMDCommand endLoop = ParseCMD(Lines[i]); endLoop.Parameters[0] = len / -1; Script.Add(endLoop); // Next line should be closing bracket, ignore and skip it return(++i - index); }
private int ParseLoop(int index) { int i = index; CommandList.Add(Lines[i].Parse()); decimal len = 0; while (Lines[++i].Parse()._commandInfo.Identifier != 0x38A3EC78) { ACMDCommand tmp = Lines[i].Parse(); len += (tmp.CalcSize() / 4); i += ParseCommands(i, tmp._commandInfo.Identifier); CommandList.Add(tmp); } ACMDCommand endLoop = Lines[i].Parse(); endLoop.parameters[0] = len / -1; CommandList.Add(endLoop); // Next line should be closing bracket, ignore and skip it return(++i - index); }
private int SerializeConditional(int startIndex) { ACMDCommand cmd = ParseCMD(Lines[startIndex]); int i = startIndex; int len = 2; Script.Add(cmd); while (Lines[++i].Trim() != "}") { ACMDCommand tmp = ParseCMD(Lines[i]); len += tmp.CalcSize() / 4; if (IsCmdHandled(tmp.CRC)) { i += SerializeCommands(i, tmp.CRC); } else { Script.Add(tmp); } } Script[Script.IndexOf(cmd)].Parameters[0] = len; // Next line should be closing bracket, ignore and skip it return(i - startIndex); }
private int ParseConditional(int startIndex) { ACMDCommand cmd = Lines[startIndex].Parse(); int i = startIndex; int len = 2; CommandList.Add(cmd); while (Lines[++i].TrimText != "}") { ACMDCommand tmp = Lines[i].Parse(); len += tmp.CalcSize() / 4; if (IsCmdHandled(tmp._commandInfo.Identifier)) { i += ParseCommands(i, tmp._commandInfo.Identifier); } else { CommandList.Add(tmp); } } CommandList[CommandList.IndexOf(cmd)].parameters[0] = len; // Next line should be closing bracket, ignore and skip it return(i - startIndex); }