public static string Write(object One, ref LswVB.VBPositions VBPosition) { string Return = "if "; LsIf Two = (LsIf)One; Return += "(" + new VBControler().Out(new LsBaseList() { Bases = new List <lsBase>() { Two.Bracket } }).TrimEnd(")\r\n".ToCharArray()).TrimStart('(') + ")\r\n{\r\n"; foreach (var item in Two.InerLines) { Return += "\t" + new VBControler().Out(new LsBaseList() { Bases = new List <lsBase>() { item } }); } Return += "}"; return(Return); }
public static string Write(object One, ref LswMySql.MySqlPositions MySqlPosition) { string Return = "IF "; LsIf Two = (LsIf)One; Return += new MySqlControler().Out(new LsBaseList() { Bases = new List <lsBase>() { Two.Bracket } }).TrimEnd("\r\n".ToCharArray()) + " THEN\r\n"; Return = Return.Replace("((", "("); foreach (var item in Two.InerLines) { Return += "\t" + new MySqlControler().Out(new LsBaseList() { Bases = new List <lsBase>() { item } }); } Return.Trim("\r\n".ToCharArray()); if (Two.EndIf) { Return += "END IF;\r\n"; } return(Return); }
//"The name 'CountTabs' does not exist in the current context" public static LsIf Read(string One, ref LswMySql.MySqlPositions MySqlPosition) { LsIf Two = new LsIf(); string Three = One.Trim().Substring(2, One.Length - 6).Trim(); //string Three = One.Trim().Substring(2,One.Length - 3).Split("THEN".ToCharArray())[0].Trim() + ")"; Two.Bracket = (LsBracket) new MySqlControler().PartInRef(Three, ref MySqlPosition); bool Continu = true; do { MySqlPosition.Position++; try { string Four = MySqlPosition.InLine[MySqlPosition.Position]; if (Four.Trim().ToLower() == "end if;") { Continu = false; MySqlPosition.Position++; MySqlPosition.Position++; Two.EndIf = true; } else if (CheckRepeate(Four, Two)) { LsBaseList list = (LsBaseList)(new MySqlControler().In(new string[] { Four.Trim() })); Two.InerLines.Add(list.Bases[0]); } else if (Four.Trim().ToLower().Substring(0, 4) == "else") { Continu = false; MySqlPosition.Position++; MySqlPosition.Position++; Two.EndIf = false; } else { Two.EndIf = true; Continu = false; } } catch { Continu = false; Two.EndIf = true; } } while (Continu); MySqlPosition.Position = MySqlPosition.Position - 1; return(Two); }
public static LsIf Read(string One, ref LswVB.VBPositions VBPosition) { LsIf Two = new LsIf(); Two.Tabindex = CountTabs(One); string Three = "(" + One.Trim().Substring(3, One.Length - 4).Trim() + ")"; Two.Bracket = (LsBracket) new VBControler().PartInRef(Three, ref VBPosition); bool Continu = true; do { VBPosition.Position++; try { string Four = VBPosition.InLine[VBPosition.Position]; if (Four.Trim() == "}") { Continu = false; VBPosition.Position++; if (VBPosition.InLine[VBPosition.Position + 1].Trim().ToLower().Substring(0, 4) == "else") { Two.EndIf = true; } } else if (Four.Trim() == "{") { Continu = true; } else if (CheckRepeate(Four, Two)) { LsBaseList list = (LsBaseList)(new VBControler().In(new string[] { Four.Trim() })); Two.InerLines.Add(list.Bases[0]); } else { Continu = false; } } catch { Continu = false; } } while (Continu); VBPosition.Position = VBPosition.Position - 1; return(Two); }
public static bool CheckRepeate(string One, LsIf Two) { return(CountTabs(One) == Two.Tabindex + 1); }