public static string HandleExpression(string tcExpression) { tcExpression = ReplaceManager.GetSingledSpacedString(tcExpression); tcExpression = tcExpression.Trim(); int num = tcExpression.IndexOf(" is "); if (num > 0) { tcExpression = "TypeOf " + tcExpression.Substring(0, num) + tcExpression.Substring(num); tcExpression = tcExpression.Replace(" is ", " Is "); } if (tcExpression.EndsWith("null")) { string text = tcExpression.Replace("!=", "!= "); text = text.Replace("==", "== "); if (text.EndsWith(" null")) { tcExpression = text; tcExpression = tcExpression.Replace(" null", " Nothing"); if (tcExpression.IndexOf("!=") > 0) { tcExpression = tcExpression.Replace("!=", " Is "); tcExpression = "Not " + tcExpression; } else { tcExpression = tcExpression.Replace("==", " Is "); } tcExpression = ReplaceManager.GetSingledSpacedString(tcExpression); } } return(tcExpression); }
private void GetCondition(string tcLine) { tcLine = ((CSharpToVBConverter)this.oParent).HandleCasting(tcLine); string text = base.ExtractBlock(tcLine, "(", ")"); text = ReplaceManager.GetSingledSpacedString(text); this.ExpresionToken = ReplaceManager.HandleExpression(text); }
private void GetCatchToken(string tcCatchToken) { string text = base.ExtractBlock(ReplaceManager.GetSingledSpacedString(tcCatchToken).Trim(), "(", ")").Trim(); int num = text.IndexOf(" "); if (num > 0) { FieldManager fieldManager = new FieldManager(); this.CatchToken = fieldManager.GetConvertedExpression(text + ";").Replace("Dim ", "Catch "); return; } this.CatchToken = "Catch"; }
private void GetCatchToken(string tcCatchToken) { string text = ReplaceManager.GetSingledSpacedString(tcCatchToken).Trim(); int num = text.IndexOf(" "); if (num > 0) { FieldManager fieldManager = new FieldManager(); this.CatchToken = "Catch " + fieldManager.GetConvertedExpression(text.Substring(num) + ";"); return; } this.CatchToken = "Catch"; }
private void BuildClassDeclaration(string tcline) { tcline = tcline.Replace(":", " : "); tcline = ReplaceManager.GetSingledSpacedString(tcline); int num = tcline.IndexOf(":"); string text; string text2; if (num > 0) { text = tcline.Substring(0, num - 1); text2 = tcline.Substring(num).Trim(); } else { text = tcline; text2 = ""; } text = ReplaceManager.HandleTypes(text); this.ClassDeclarationToken = text.Trim(); int num2 = this.ClassDeclarationToken.LastIndexOf(" "); this.ClassNameToken = this.ClassDeclarationToken.Substring(num2 + 1); text2 = text2.Replace(":", "").Trim(); if (text2.Length == 0) { return; } string[] array = text2.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string text3 = array[i].Trim(); string text4 = " Inherits "; if (text3[0] == 'i' || text3[0] == 'I') { text4 = " Implements "; } string implementationDeclationToken = this.ImplementationDeclationToken; this.ImplementationDeclationToken = string.Concat(new string[] { implementationDeclationToken, "\n", '\t'.ToString(), text4, text3 }); } }
public string GetBlock(string tcLine) { this.Initialize(); base.GetBlankToken(tcLine); tcLine = ReplaceManager.GetSingledSpacedString(tcLine); int num = tcLine.IndexOf("="); if (num > 0) { string tcLine2 = tcLine.Substring(0, num); FieldManager fieldManager = new FieldManager(); this.DeclarationBlock = fieldManager.GetConvertedExpression(tcLine2).Replace(";", "") + " = "; tcLine = tcLine.Substring(num + 1).Trim(); } int num2 = tcLine.IndexOf("++"); if (num2 < 0) { num2 = tcLine.IndexOf("--"); if (num2 < 0) { return(tcLine); } this.ExpressionBlock = "- 1"; } else { this.ExpressionBlock = "+ 1"; } if (num2 != 0) { this.VariableBlock = tcLine.Substring(0, num2); } else { tcLine = tcLine.Replace(";", "").Trim(); int num3 = tcLine.IndexOf(" "); if (num3 > 0) { this.PaddingBlock = tcLine.Substring(num3); tcLine = tcLine.Substring(0, num3); } this.VariableBlock = tcLine.Replace("++", "").Replace("--", "").Trim(); } if (this.DeclarationBlock.Length == 0) { this.DeclarationBlock = this.VariableBlock + " = "; } return(this.Execute()); }
public string GetBlock(string tcLine, string tcBlock) { base.GetBlankToken(tcLine); string text = ReplaceManager.GetSingledSpacedString(tcLine); int num = text.LastIndexOf(":"); if (num > 0) { this.EnumReturnValue = "As " + text.Substring(num + 1).Trim(); text = text.Substring(0, num).Trim(); } text = ReplaceManager.HandleTypes(text); num = text.IndexOf(" "); this.EnumName = text.Substring(num + 1); this.EnumDeclarationToken = text.Substring(0, num).Trim(); this.EnumBlock = base.ExtractBlock(tcBlock, "{", "}").Replace(",", "\r\n" + this.BlankToken + "\t"); return(this.Execute()); }
private void GetCondition(string tcLine) { string text = base.ExtractBlock(tcLine, "(", ")"); text = ReplaceManager.GetSingledSpacedString(text); string[] array = text.Split(new char[] { ' ' }); if (array.Length > 3) { FieldManager fieldManager = new FieldManager(); this.DeclarationToken = this.BlankToken + fieldManager.GetConvertedExpression(array[0] + " " + array[1] + ";") + "\n"; int startIndex = text.IndexOf(" "); this.ConditionToken = text.Substring(startIndex).Trim(); } else { this.ConditionToken = text.Trim(); } this.ConditionToken = this.ConditionToken.Replace(" in ", " In "); }
public string GetConvertedExpression(string tcLine) { base.GetBlankToken(tcLine); this.ExtractModifiers(ref tcLine); tcLine = this.BlankToken + ReplaceManager.GetSingledSpacedString(tcLine); tcLine = tcLine.Replace("==", "="); tcLine = tcLine.Replace("=", " = "); tcLine = this.CheckTokens(tcLine, '(', ')'); tcLine = this.CheckTokens(tcLine, '[', ']'); if (this.valid(tcLine)) { return(this.PopTokens(tcLine)); } if (tcLine.Trim().IndexOf(' ') < 0) { return(this.PopTokens(tcLine)); } if (this.ModifierToken.Trim().Length == 0) { this.ModifierToken = "Dim "; } this.GetDataType(tcLine); return(this.PopTokens(this.Build())); }
private void BuildPropertyDeclaration(string tcLine) { tcLine = ReplaceManager.GetSingledSpacedString(tcLine).Trim(); if (tcLine.EndsWith(")")) { int length = tcLine.IndexOf("("); this.PropertyParameterToken = base.ExtractBlock(tcLine, "(", ")"); FieldManager fieldManager = new FieldManager(); this.PropertyParameterToken = "(" + fieldManager.GetConvertedExpression(this.PropertyParameterToken) + ") "; this.PropertyParameterToken = this.PropertyParameterToken.Replace("Dim ", ""); tcLine = tcLine.Substring(0, length).Trim(); } int num = tcLine.LastIndexOf(" "); this.PropertyNameToken = tcLine.Substring(num + 1); string text = tcLine.Substring(0, num).Trim(); text = ReplaceManager.HandleModifiers(text); text = text.Trim(); num = text.LastIndexOf(" "); this.ReturnValueToken = "As " + text.Substring(num).Trim(); text = text.Substring(0, num); this.PropertyModifiersToken = text; }
private void BuildMethodDeclaration(string tcLine) { int num = tcLine.IndexOf(":"); if (num > 0) { this.MethodParentToken = tcLine.Substring(num + 1); tcLine = tcLine.Substring(0, num); } tcLine = ReplaceManager.GetSingledSpacedString(tcLine).Trim(); int num2 = 0; int num3 = 0; string tcString = ""; string text = tcLine; int num4 = tcLine.Length; while (0 < num4) { int num5 = num4 - 1; if (tcLine[num5] == ')') { num3++; } if (tcLine[num5] == '(') { num2++; } if (num2 != 0 && num3 != 0 && num2 - num3 == 0) { text = tcLine.Substring(0, num5); tcString = tcLine.Substring(num5).Trim(); break; } num4--; } this.ParameterToken = this.GetParameters(tcString); text = ReplaceManager.GetSingledSpacedString(text); string[] array = text.Split(new char[] { ' ' }); if (array.Length == 2) { text = "private " + text; } if (text.IndexOf("void ") >= 0) { this.MethodType = "Sub"; } text = " " + text.Trim() + " "; text = ReplaceManager.HandleModifiers(text); text = text.Trim(); int num6 = text.LastIndexOf(" "); this.MethodNameToken = text.Substring(num6).Trim(); text = text.Substring(0, num6); if (this.MethodType != "Sub") { num6 = text.LastIndexOf(" "); if (num6 >= 0) { this.ReturnValueToken = " As " + text.Substring(num6).Trim(); text = text.Substring(0, num6); } } if (num6 > 0) { this.MethodModifiersToken = text.Substring(0, num6) + " "; } }