public TextMetalToolContext(ITextMetalToolHost toolHost, IDataTypeFascade dataTypeFascade, IReflectionFascade reflectionFascade, Tokenizer tokenizer) : base(dataTypeFascade, reflectionFascade, tokenizer) { if ((object)toolHost == null) throw new ArgumentNullException(nameof(toolHost)); this.toolHost = toolHost; }
protected override int OnStartup(string[] args, IDictionary <string, IList <object> > arguments) { Dictionary <string, object> argz; string templateFilePath; string sourceFilePath; string baseDirectoryPath; string sourceStrategyAqtn; bool strictMatching; bool debuggerLaunch = false; IDictionary <string, IList <string> > properties; IList <object> argumentValues; IList <string> propertyValues; bool hasProperties; if ((object)args == null) { throw new ArgumentNullException(nameof(args)); } if ((object)arguments == null) { throw new ArgumentNullException(nameof(arguments)); } if (arguments.ContainsKey(CMDLN_DEBUGGER_LAUNCH)) { debuggerLaunch = (bool)arguments[CMDLN_DEBUGGER_LAUNCH].Single(); } if (debuggerLaunch) { Console.WriteLine("Debugger launch result: '{0}'", System.Diagnostics.Debugger.Launch() && System.Diagnostics.Debugger.IsAttached); } // required properties = new Dictionary <string, IList <string> >(); templateFilePath = (string)arguments[CMDLN_TOKEN_TEMPLATEFILE].Single(); sourceFilePath = (string)arguments[CMDLN_TOKEN_SOURCEFILE].Single(); baseDirectoryPath = (string)arguments[CMDLN_TOKEN_BASEDIR].Single(); sourceStrategyAqtn = (string)arguments[CMDLN_TOKEN_SOURCESTRATEGY_AQTN].Single(); strictMatching = (bool)arguments[CMDLN_TOKEN_STRICT].Single(); hasProperties = arguments.TryGetValue(CMDLN_TOKEN_PROPERTY, out argumentValues); argz = new Dictionary <string, object>(); argz.Add(CMDLN_TOKEN_TEMPLATEFILE, templateFilePath); argz.Add(CMDLN_TOKEN_SOURCEFILE, sourceFilePath); argz.Add(CMDLN_TOKEN_BASEDIR, baseDirectoryPath); argz.Add(CMDLN_TOKEN_SOURCESTRATEGY_AQTN, sourceStrategyAqtn); argz.Add(CMDLN_TOKEN_STRICT, strictMatching); argz.Add(CMDLN_DEBUGGER_LAUNCH, arguments.ContainsKey(CMDLN_DEBUGGER_LAUNCH) ? (object)debuggerLaunch : null); argz.Add(CMDLN_TOKEN_PROPERTY, hasProperties ? (object)argumentValues : null); if (hasProperties) { if ((object)argumentValues != null) { foreach (string argumentValue in argumentValues) { string key, value; if (!this.TryParseCommandLineArgumentProperty(argumentValue, out key, out value)) { continue; } if (!properties.ContainsKey(key)) { properties.Add(key, propertyValues = new List <string>()); } else { propertyValues = properties[key]; } // duplicate values are ignored if (propertyValues.Contains(value)) { continue; } propertyValues.Add(value); } } } using (ITextMetalToolHost textMetalToolHost = AssemblyDomain.Default.DependencyManager.ResolveDependency <ITextMetalToolHost>(string.Empty, true)) textMetalToolHost.Host((object)args != null ? args.Length : -1, args, argz, templateFilePath, sourceFilePath, baseDirectoryPath, sourceStrategyAqtn, strictMatching, properties); return(0); }