public static string Write(object One, ref LswCSharp.CSharpPositions CSharpPosition) { string Return = "else if "; LsElseIf Two = (LsElseIf)One; Return += "(" + new CSharpControler().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 CSharpControler().Out(new LsBaseList() { Bases = new List <lsBase>() { item } }); } Return += "}"; return(Return); }
public static string Write(object One, ref LswMySql.MySqlPositions MySqlPosition) { string Return = "ELSEIF "; LsElseIf Two = (LsElseIf)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 } }); } if (Two.EndIf) { Return += "END IF;\r\n"; } return(Return); }
public static LsElseIf Read(string One, ref LswCSharp.CSharpPositions CSharpPosition) { LsElseIf Two = new LsElseIf(); Two.Tabindex = CountTabs(One); string Three = "(" + One.Trim().Substring(8, One.Length - 9).Trim() + ")"; Two.Bracket = (LsBracket) new CSharpControler().PartInRef(Three, ref CSharpPosition); bool Continu = true; do { CSharpPosition.Position++; try { string Four = CSharpPosition.InLine[CSharpPosition.Position]; if (Four.Trim() == "}") { Continu = false; CSharpPosition.Position++; if (CSharpPosition.InLine[CSharpPosition.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 CSharpControler().In(new string[] { Four.Trim() })); Two.InerLines.Add(list.Bases[0]); } else { Continu = false; } } catch { Continu = false; } } while (Continu); CSharpPosition.Position = CSharpPosition.Position - 1; return(Two); }
public static LsElseIf Read(string One, ref LswMySql.MySqlPositions MySqlPosition) { LsElseIf Two = new LsElseIf(); string Three = One.Trim().Substring(7, One.Length - 11).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 = true; } else { Continu = false; } } catch { Continu = false; } } while (Continu); MySqlPosition.Position = MySqlPosition.Position - 1; return(Two); }
public static LsElseIf Read(string One, ref LswPython.PythonPositions PythonPosition) { LsElseIf Two = new LsElseIf(); Two.Tabindex = CountTabs(One); string Three = "(" + One.Trim().Substring(5, One.Length - 6).Trim() + ")"; Two.Bracket = (LsBracket) new PythonControler().PartInRef(Three, ref PythonPosition); bool Continu = true; do { PythonPosition.Position++; try { string Four = PythonPosition.InLine[PythonPosition.Position]; if (CheckRepeate(Four, Two)) { LsBaseList list = (LsBaseList)(new PythonControler().In(new string[] { Four.Trim() })); Two.InerLines.Add(list.Bases[0]); } else if (Four.Trim().ToLower().Substring(0, 4) != "elif" || Four.Trim().ToLower().Substring(0, 4) != "else") { Continu = false; Two.EndIf = false; } else { Continu = false; } } catch { Continu = false; } } while (Continu); PythonPosition.Position = PythonPosition.Position - 1; return(Two); }
public static bool CheckRepeate(string One, LsElseIf Two) { return(CountTabs(One) == Two.Tabindex + 1); }