public void AddRef(Referee r) { if (!Refs.Contains(r)) { Refs.Add(r); } }
public ToolTemplateGenerator() { Refs.Add(typeof(CompilerErrorCollection).Assembly.Location); Refs.Add(typeof(DescriptionAttribute).Assembly.Location); Refs.Add(typeof(List <>).Assembly.Location); Refs.Add(typeof(HashSet <>).Assembly.Location); }
public TemplateGenerator() { Refs.Add(typeof(TextTransformation).Assembly.Location); Refs.Add(typeof(Uri).Assembly.Location); Refs.Add(typeof(File).Assembly.Location); Refs.Add(typeof(StringReader).Assembly.Location); Imports.Add("System"); }
public void AddAssembly(Assembly asm) { if (ExistsRef(asm)) { return; } Refs.Add(asm); }
/// <summary> /// Adds a ref, only if it won't cause any issues to the template generator /// </summary> /// <param name="re">ref to add</param> private void SafeAddRef(string re) { if (string.IsNullOrWhiteSpace(re)) { return; } Refs.Add(re); }
public TemplateGenerator() { ReferencePaths.Add(Path.GetDirectoryName(typeof(int).Assembly.Location).Replace("Microsoft.NETCore.App", "Microsoft.AspNetCore.App")); Refs.Add(typeof(TextTransformation).Assembly.Location); Refs.Add(typeof(Uri).Assembly.Location); Refs.Add(typeof(File).Assembly.Location); Refs.Add(typeof(StringReader).Assembly.Location); Imports.Add("System"); }
// set reference to object // inherit parent lookup, but can only add to lookup in this node internal void SetRef(int index, IList <int> value) { Logger.WriteLine(4, "Setref node {0} {1} = {{{2}}}", Location, index, value.Join()); if (Refs == null) { var refs = FindRefs(); Refs = (refs == null) ? new Dictionary <int, IList <int> >() : new Dictionary <int, IList <int> >(refs); } Refs.Add(index, value); }
public void SetModel(ModelRef modelRef) { if (modelRef.Model is not Entity entity) { throw new InvalidOperationException("ModelRef must be an entity"); } var keyProperty = entity.AllProperties.Single(p => p.IsKey); FinalType = keyProperty.Type; Refs.Add(ParameterEntityRef.Create(entity.Name + GitLabClientGenerator.ToPropertyName(keyProperty.Name), keyProperty.Type)); Refs.Add(ParameterEntityRef.Create(entity.Name, modelRef, keyProperty.Name)); }
public void SetRefs(params ParameterEntityRef[] refs) { var finalType = ModelRef.Object; var types = refs.Select(r => r.FinalPropertyModelRef).Distinct().ToList(); if (types.Count == 1) { finalType = types[0]; } FinalType = finalType; foreach (var entityRef in refs) { Refs.Add(entityRef); } }
void AddAssemblyReferenceForMvcHost() { Refs.Add(GetType().Assembly.Location); Refs.Add(typeof(TextTemplatingHost).Assembly.Location); }
public TemplateGenerator() { Refs.Add(typeof(TextTransformation).Assembly.Location); Refs.Add(typeof(Uri).Assembly.FullName); Imports.Add("System"); }
public void AddMonoDevelopHostImport() { Imports.Add("MonoDevelop.TextTemplating"); Refs.Add(typeof(MonoDevelopTemplatingHost).Assembly.Location); }
public MvcTextTemplateHost() { Imports.Add("MonoDevelop.AspNet.Mvc.TextTemplating"); Refs.Add(typeof(MvcTextTemplateHost).Assembly.Location); }
public ToolTemplateGenerator() { Refs.Add(typeof(CompilerErrorCollection).Assembly.Location); }
public MvcTextTemplateHost() { AddMonoDevelopHostImport(); Imports.Add(typeof(MvcTextTemplateHost).Namespace); Refs.Add(typeof(MvcTextTemplateHost).Assembly.Location); }
public virtual void GatherRefs() { Workspaces.Document item = Item; string ffn = item.FullPath; IGrammarDescription gd = GrammarDescriptionFactory.Create(ffn); if (gd == null) { throw new Exception(); } for (int classification = 0; classification < gd.Identify.Count; ++classification) { Func <IGrammarDescription, Dictionary <IParseTree, IList <CombinedScopeSymbol> >, IParseTree, bool> fun = gd.Identify[classification]; if (fun == null) { continue; } IEnumerable <IParseTree> it = AllNodes.Where(t => fun(gd, Attributes, t)); foreach (IParseTree t in it) { TerminalNodeImpl x = (t as TerminalNodeImpl); if (x == null) { continue; } if (x.Symbol == null) { continue; } try { Attributes.TryGetValue(x, out IList <CombinedScopeSymbol> attr_list); if (attr_list == null) { continue; } foreach (CombinedScopeSymbol attr in attr_list) { Tags.Add(x, classification); if (attr == null) { continue; } ISymbol sym = attr as Symtab.ISymbol; if (sym == null) { continue; } ISymbol def = sym.resolve(); if (def != null && def.file != null && def.file != "" && def.file != ffn) { Workspaces.Document def_item = Workspaces.Workspace.Instance.FindDocument(def.file); ParserDetails def_pd = ParserDetailsFactory.Create(def_item); def_pd.PropagateChangesTo.Add(ffn); } Refs.Add(x, classification); } } catch (ArgumentException) { // Duplicate } } } }
public FileTemplateHost(IStringTagModel tags) { this.tags = tags; Refs.Add(typeof(FileTemplateHost).Assembly.Location); }
// called whenever a cell changes so that we can dispatch another event as well as // check to see if we need to look up the value in another cell private void CellChanged(object sender, PropertyChangedEventArgs e) { var cell = sender as SheetCell; if (e.PropertyName == "Color") { CellPropertyChanged(cell, new PropertyChangedEventArgs("Color")); return; } // reset expression validity when it changes // if its still invalid it will get set back // to true cell.InvalidExp = false; // handle raw numbers double val; if (double.TryParse(cell.Text, out val)) { foreach (var old in cell.Deps) { Refs[Name2Cell(old)].Remove(cell); } cell.Deps.Clear(); Vars[cell.Name] = val; cell.SetValue(val.ToString()); } else if (cell.Text != null && cell.Text.Length > 0 && cell.Text[0] == '=') { cell.ETree = new ExpTree(cell.Text.Substring(1), Vars); double res = cell.ETree.Eval(); var newDeps = cell.ETree.GetExpLocals(); // cell expression variables contain reference to the cell itself if (newDeps.FirstOrDefault(dep => dep == cell.Name) != null) { cell.SetValue("!(self reference)"); cell.InvalidExp = true; } // one of the cell expression variables is invalid else if (newDeps.FirstOrDefault(dep => Name2Cell(dep) == null) != null) { cell.SetValue("!(bad reference)"); cell.InvalidExp = true; } // chain of cell exp vars contains a circular reference else if (newDeps.ToList().FirstOrDefault(p => ContainsCircularRef(cell, Name2Cell(p))) != null) { cell.SetValue("!(circ reference)"); cell.InvalidExp = true; } else { Vars[cell.Name] = res; // remove dependencies that arent needed anymore foreach (var old in cell.Deps.Except(newDeps)) { Refs[Name2Cell(old)].Remove(cell); } cell.Deps = newDeps; // add current cell to each set corresponding to one of the current cell's // dependencies foreach (var dep in cell.Deps) { var rcell = Name2Cell(dep); if (!Refs.ContainsKey(rcell)) { Refs.Add(rcell, new HashSet <SheetCell>()); } Refs[rcell].Add(cell); } cell.SetValue(res.ToString()); } } else { // remove previous dependencies when directly setting text foreach (var old in cell.Deps) { Refs[Name2Cell(old)].Remove(cell); } // changing cells that have dependencies from numerical to be strings // defaults the cells value to 0 so that all dependencies get updated with // the 0 value Vars[cell.Name] = 0; cell.SetValue(cell.Text); } // now update all dependencies UpdateRefs(cell); CellPropertyChanged((sender as SheetCell), new PropertyChangedEventArgs("Value")); }
public TemplateGenerator() { Refs.Add(typeof(TextTransformation).Assembly.Location); }
public override void Initialize() { checkpointRefs.Add(this); }
public override void Initialize() { base.Initialize(); levelObjectRefs.Add(this); }