public override void Process(FileParser fileParser) { // if param "@local" found if (ParamsList != null && ParamsList.Count > 0) { for (int i = 0; i < ParamsList.Count; i++) { if (ParamsList[i] is LocalParam) { Local = true; ParamsList.RemoveAt(i); break; } } } Line = fileParser.Lines[fileParser.CurrentLineCount]; if (!Local) { Match match = new Regex(@"^\s*local\s*").Match(Line); Local = match.Success; } if (Local) { Ignore = true; } FunctionData = GetRegex().Match(Line).Value.TrimStart('@'); Name = FunctionData.Replace("function ", "").Split('(')[0].Trim(); }
public override DataStructure CheckDataStructureTransformation() { // check whether it's a hook // if param "@hook" found if (ParamsList != null && ParamsList.Count > 0) { for (int i = 0; i < ParamsList.Count; i++) { if (ParamsList[i] is HookParam) { ParamsList.RemoveAt(i); if (ParamsList.Count == 0) { ParamsList = null; } return(new Hook { HookName = FunctionData.Replace("function ", "").Split('(')[0].Trim().Replace("GAMEMODE", "GM"), HookData = FunctionData.Replace("GAMEMODE", "GM"), GlobalWrapper = FunctionData.Replace("function ", "").Split(':')[0].Trim().Replace("GAMEMODE", "GM"), Line = Line, ParamsList = ParamsList, Realm = Realm, Ignore = Ignore, FoundLine = FoundLine, FoundPath = FoundPath, IsMain = true }); } } } // if "GM" or "GAMEMODE" found Regex regex = new Regex(@"\s*function\s*(GAMEMODE|GM)\:\w+\s*\("); if (regex.Match(Line).Success) { return(new Hook { HookName = FunctionData.Replace("function ", "").Split('(')[0].Trim().Replace("GAMEMODE", "GM"), HookData = FunctionData.Replace("GAMEMODE", "GM"), Line = Line, ParamsList = ParamsList, Realm = Realm, Ignore = Ignore, FoundLine = FoundLine, FoundPath = FoundPath, IsMain = true }); } return(base.CheckDataStructureTransformation()); }