本文整理汇总了C#中Struct.FindVars方法的典型用法代码示例。如果您正苦于以下问题:C# Struct.FindVars方法的具体用法?C# Struct.FindVars怎么用?C# Struct.FindVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Struct
的用法示例。
在下文中一共展示了Struct.FindVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindUserFunctions
public static void FindUserFunctions(string[] text)
{
Struct tempS;
string name = "", type = "";
for (int i = 0; i < text.Length; i++)
{
string temp = text[i].Replace("private ", "").Replace("static ", "").Replace("public ", "").Replace("operator ", "").Trim();
if (temp.Length >= 9 && temp.Substring(0, 9) == "function " && temp.IndexOf("takes") != -1 && temp.IndexOf("returns") != -1)
{
temp = temp.Substring(9, temp.Length - 9);
type = temp.Substring(temp.IndexOf("returns") + 8, temp.Length - temp.IndexOf("returns") - 8);
if (type != "nothing" && type != "void")
{
name = temp.Substring(0, temp.IndexOf(' '));
JData.Add(name, type);
//Types.AddFunc(name, type);
}
}
else if (temp.Length >= 7 && temp.Substring(0, 7) == "method " && temp.IndexOf("takes") != -1 && temp.IndexOf("returns") != -1)
{
temp = temp.Substring(7, temp.Length - 7);
type = temp.Substring(temp.IndexOf("returns") + 8, temp.Length - temp.IndexOf("returns") - 8);
if (type != "nothing" && type != "void")
{
name = temp.Substring(0, temp.IndexOf(' ')).Trim();
JData.Add(name, type);
//Types.AddFunc(name, type);
}
}
else if (temp.Length >= 7 && temp.Substring(0, 7) == "struct ")
{
int close = i + 1;
if (temp[temp.Length - 1] == '{' || text[i + 1].Trim() == "{")
close = Analyzer.FindBraces(text, i);
else
for (int j = i; j < text.Length; j++)
if (text[j].Trim() == "endstruct")
{
close = j - 1;
break;
}
tempS = new Struct();
tempS.FindVars(text, i, close);
tempS.FindMethods(text, i, close);
Structs.Add(tempS);
}
else
{
int index = temp.IndexOf(' ');
int bIndex = temp.IndexOf('(');
if (index != -1 && index < bIndex && temp.Substring(0, index) != "define" &&
temp.Substring(0, index) != "callback" && temp.Substring(0, index) != "lambda" &&
temp.Substring(0, index) != "library" && temp.Substring(0, index) != "scope" &&
temp.Substring(0, index) != "enum" && temp.Substring(0, index) != "struct" &&
temp.Substring(0, index) != "loop" && temp.Substring(0, index) != "for" &&
temp.Substring(0, index) != "while" && temp.Substring(0, index) != "whilenot" &&
temp.Substring(0, index) != "until" && temp.Substring(0, 2) != "if" &&
temp.Substring(0, index) != "else" && temp.Substring(0, index) != "elseif" &&
temp.Substring(0, index) != "call" && temp.Substring(0, index) != "set" &&
temp.Substring(0, index) != "return" && temp.Substring(0, index) != "exitwhen" &&
temp.Substring(0, index) != "local" && temp.Substring(0, index) != "void" &&
temp.Substring(0, index) != "nothing" && temp.IndexOf('=') == -1 &&
Analyzer.CountSymbolsInText("(", temp) == 1 && Analyzer.CountSymbolsInText(")", temp) == 1 &&
temp.IndexOf(';') == -1)
{
type = temp.Substring(0, index).Trim();
temp = temp.Replace(type, "");
JData.Add(temp.Substring(0, temp.IndexOf('(')).Trim(), type);
//Types.AddFunc(temp.Substring(0, temp.IndexOf('(')).Trim(), type);
}
}
}
}