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 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 string Write(object One, ref LswCSharp.CSharpPositions CSharpPosition) { string Return = ""; LsBracket Two = (LsBracket)One; Return += Two.BracketTypesPears[Two.BracketType][0]; int Point = 0; while (Two.BaseProperties.Count + Two.StringProperties.Count > Point) { object ToAdd; LsName ToAdd2; if (Two.BaseProperties.TryGetValue(Point, out ToAdd)) { if (ToAdd.GetType() == typeof(string)) { Return += (ToAdd.ToString().Contains("\"")) ? "@" + '"' + DoubleSpeatch(ToAdd.ToString()) + '"' : '"' + ToAdd.ToString() + @""""; } else if (ToAdd.GetType() == typeof(char)) { Return += (ToAdd.ToString().Contains("'")) ? "'\\''" : "'" + ToAdd.ToString() + @"''"; } else if (ToAdd.GetType() == typeof(int)) { Return += ToAdd.ToString() + "{int}"; } else if (ToAdd.GetType() == typeof(bool)) { Return += ToAdd.ToString().ToLower(); } else if (ToAdd.GetType() == typeof(LsBracket)) { Return += Write(ToAdd, ref CSharpPosition); } Return += Seperater(Two.BracketType) + " "; } else if (Two.StringProperties.TryGetValue(Point, out ToAdd2)) { Return += ToAdd2.Name + Seperater(Two.BracketType) + " "; } Point++; } Return = Return.TrimEnd(); Return = Return.Substring(0, Return.Length - 1); Return += ")"; return(Return); }
public static string Write(object One, ref LswCSharp.CSharpPositions CSharpPosition) { string Return = "else "; LsElse Two = (LsElse)One; Return += "\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 LsElse Read(string One, ref LswCSharp.CSharpPositions CSharpPosition) { LsElse Two = new LsElse(); Two.Tabindex = CountTabs(One); bool Continu = true; do { CSharpPosition.Position++; try { string Four = CSharpPosition.InLine[CSharpPosition.Position]; if (Four.Trim() == "}") { Continu = false; CSharpPosition.Position++; 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 LsBracket Read(string One, ref LswCSharp.CSharpPositions CSharpPosition) { LsBracket Two = new LsBracket(); string Three = One[0].ToString(); switch (Three) { case "<": Three = Three + "|>"; break; case "(": Three = Three + "|)"; break; case "[": Three = Three + "|]"; break; case "{": Three = Three + "|}"; break; default: Three = "(|)"; break; } if (Two.BracketTypesPears.ContainsValue(Three)) { Two.BracketType = Dic.KeyByValue(Three); // // } else { Two.BracketType = LsBracket.BracketTypes.Round; } //do //{ string[] Parts; Parts = One.Trim().Substring(1, One.Length - 2).Split(Seperater(Two.BracketType).ToCharArray()); foreach (var item in Parts) { string itemT = item.Trim(); var Four = new CSharpControler().PartInRef(itemT, ref CSharpPosition); if (Four is string && (itemT[0] != '"' && itemT[0] != "'"[0])) { Two.AddString(new LsName() { Name = Four.ToString() }); } else { Two.AddBase(Four); } } CSharpPosition.Position++; try { One = CSharpPosition.InLine[CSharpPosition.Position]; } catch { } //} while(CheckRepeate(One, Two)); CSharpPosition.Position = CSharpPosition.Position - 1; return(Two); }