private static bool IsArgumentCountValid(TextDocument document, int lineOffset) { string lineText = CommandHelper.GetWholeCommandLineText(document, lineOffset); if (lineText == null) { return(false); } if (lineText.StartsWith("#")) { return(true); } lineText = LineHelper.EscapeComments(lineText); if (!lineText.Contains("=")) { return(false); } string command = CommandHelper.GetCommandKey(document, lineOffset); if (string.IsNullOrEmpty(command)) { return(false); } int argumentCount = LineHelper.EscapeComments(lineText).Split('=')[1].Split(',').Length; if (argumentCount == 1 && string.IsNullOrWhiteSpace(lineText.Split('=')[1])) { argumentCount = 0; } foreach (DictionaryEntry entry in CommandHelper.GetCommandSyntaxResources()) { if (command.Equals(entry.Key.ToString(), StringComparison.OrdinalIgnoreCase)) { int correctArgumentCount = entry.Value.ToString().Split(']')[1].Split(',').Length; if (entry.Value.ToString().ToUpper().Contains("ARRAY")) { return(true); // Whatever. } else { return(argumentCount == correctArgumentCount); } } } return(false); }
private static bool ContainsEmptyArguments(TextDocument document, int lineOffset) { string lineText = CommandHelper.GetWholeCommandLineText(document, lineOffset); if (string.IsNullOrEmpty(lineText)) { return(true); } string[] arguments = LineHelper.EscapeComments(lineText).Split(','); foreach (string argument in arguments) { if (string.IsNullOrWhiteSpace(argument.Replace('>', ' '))) { return(true); } } return(false); }