public string[] GetKeywords(string name, NameOptions type) { var tmp_name = pm.ActiveProject.VECTORS.FirstOrDefault(c => c.Name == name && c.Type == type); var tmp_data = tmp_name.Data.Select(c => c.keyword); return(tmp_data.ToArray()); }
public string[] GetNamesByType(NameOptions type) { return ((from item in pm.ActiveProject.VECTORS where item.Type == type select item.Name).ToArray()); }
public static string ChangeClrName(string clrName, NameOptions options) { switch(options) { case NameOptions.MakeCollection: if (clrName[0] == '@') { clrName = clrName.Remove(0,1); } return clrName + "Collection"; case NameOptions.MakeList: return clrName + "List"; case NameOptions.MakePlural: return clrName + "s"; case NameOptions.MakeField: return clrName + "Field"; case NameOptions.MakeLocal: return clrName + "LocalType"; case NameOptions.MakeUnion: return clrName + "UnionValue"; case NameOptions.MakeFixedValueField: return clrName + "FixedValue"; case NameOptions.MakeParam: return clrName + "Param"; case NameOptions.MakeDefaultValueField: return clrName + "DefaultValue"; } return clrName; }
public PlayerConfiguration(AbstractNameOptions AbstractName, ModeOptions Mode, NameOptions Name, PresetCardsOptions PresetCards) { this.AbstractName = AbstractName; this.Mode = Mode; this.Name = Name; this.PresetCards = PresetCards; }
public override string GetDisplayName(NameOptions opts) { if (opts == (NameOptions.ForAddressBar | NameOptions.ForParsing)) { return(string.Format("{0}{1}{2}{3}{4}", root, "\\", path, "\\", name)); } return(name); }
public static NameVisitorCreator GetVB(NameOptions option) { if (option < NameOptions.None || option > NameOptions.All) { throw new ArgumentOutOfRangeException("option"); } return _vbCreators[(int)option]; }
public static NameVisitorCreator GetVB(NameOptions option) { if (option < NameOptions.None || option > NameOptions.All) { throw new ArgumentOutOfRangeException("option"); } return(_vbCreators[(int)option]); }
public override string GetDisplayName(NameOptions opts) { if (opts == (NameOptions.ForAddressBar | NameOptions.ForParsing)) { return(string.Format("{0}\\{1}\\{2}", root.Name, path, valueName)); } return(valueName); }
public override string GetDisplayName(NameOptions opts) { if (opts == (NameOptions.ForAddressBar | NameOptions.ForParsing)) { return(string.Format("{0}\\{1}", root.Name, path)); } return(path == null ? root.Name : path.Substring(path.LastIndexOf('\\') + 1)); }
public override void SetName(IWin32Window owner, string name, NameOptions opts) { this.name = name; string sNewFile = name; if (!string.IsNullOrEmpty(path)) { sNewFile = string.Format("{0}{1}{2}", path, FD, name); } SetFileName(this, sNewFile); }
public static Func <NameVisitor> GetNameVisitor(NameOptions option) { if (option < NameOptions.None || option > NameOptions.All) { throw new ArgumentOutOfRangeException(nameof(option)); } if (!NameVisitors.ContainsKey(option)) { NameVisitors[option] = () => new NameVisitor(option); } return(NameVisitors[option]); }
public override string GetDisplayName(NameOptions opts) { if (opts == (NameOptions.ForAddressBar | NameOptions.ForParsing)) { if (string.IsNullOrEmpty(root)) { return(string.Format("{0}", path.Replace(FD, "\\"))); } else { return(string.Format("{0}{1}{2}", root, "\\", path)); } } return(path == null ? root : path.Substring(path.LastIndexOf(FD[0]) + 1)); }
private NameSyntax ParseQualifiedNameRight( NameOptions options, NameSyntax left, SyntaxToken separator) { var right = this.ParseSimpleName(options); if (separator.Kind == SyntaxKind.DotToken) { return(_syntaxFactory.QualifiedName(left, separator, right)); } else { return(left); } }
public void UpdateListNames(NameOptions options) { if (ECL.VECTORS == null) { return; } ShowNameOptions = options; ListNames = ( from item in ECL.VECTORS where item.Type == options select item.Name).ToList(); OnPropertyChanged("ListNames"); }
public void UpdateNames(List <string> names, NameOptions type) { if (names.Count == 0) { return; } suspendEvents = true; selectedNames = names; selectedKeywords = new List <string>(); var tmp_names = new List <string>(); foreach (string item in listKeywords.SelectedItems) { tmp_names.Add(item); } listKeywords.SuspendLayout(); listKeywords.Items.Clear(); listKeywords.Items.AddRange(model.GetKeywords(names[0], type)); // Востановим выделенные слова foreach (string item in tmp_names) { int index = listKeywords.Items.IndexOf(item); if (index != -1) { listKeywords.SetSelected(index, true); selectedKeywords.Add(item); } } listKeywords.ResumeLayout(); suspendEvents = false; // Индексы выбранных проектов //selectedProjects = model.GetSelectedProjectIndex(); UpdateChartAndTable(); }
public static string ChangeClrName(string clrName, NameOptions options) { switch (options) { case NameOptions.MakeCollection: if (clrName[0] == '@') { clrName = clrName.Remove(0, 1); } return(clrName + "Collection"); case NameOptions.MakeList: return(clrName + "List"); case NameOptions.MakePlural: return(clrName + "s"); case NameOptions.MakeField: return(clrName + "Field"); case NameOptions.MakeLocal: return(clrName + "LocalType"); case NameOptions.MakeUnion: return(clrName + "UnionValue"); case NameOptions.MakeFixedValueField: return(clrName + "FixedValue"); case NameOptions.MakeParam: return(clrName + "Param"); case NameOptions.MakeDefaultValueField: return(clrName + "DefaultValue"); case NameOptions.MakeXName: return(clrName + "XName"); } return(clrName); }
private void boxNamesType_SelectedIndexChanged(object sender, EventArgs e) { switch (boxNamesType.SelectedIndex) { case 0: namesType = NameOptions.Field; break; case 1: namesType = NameOptions.Group; break; case 2: namesType = NameOptions.Well; break; case 3: namesType = NameOptions.Completion; break; case 4: namesType = NameOptions.Aquifer; break; case 5: namesType = NameOptions.Region; break; case 6: namesType = NameOptions.Other; break; } if (model.GetActiveProject() == null) { return; } Names = model.GetNamesByType(namesType); }
private NameSyntax ParseQualifiedName(NameOptions options = NameOptions.None) { NameSyntax name = this.ParseSimpleName(options); while (this.IsDot()) { //stop parse name with list: //.this //.super //.class //.* if (this.PeekToken(1).Kind != SyntaxKind.IdentifierToken) { break; } var separator = this.EatToken(); name = ParseQualifiedNameRight(options, name, separator); } return(name); }
public override void SetName(IWin32Window owner, string name, NameOptions opts) { if (path == null) { root = name; } else { int nLastPos = path.LastIndexOf(FD[0]); if (nLastPos < 0) { path = name; } else { string sP = path.Substring(0, nLastPos); path = string.Format("{0}{1}{2}", sP, FD, name); } } SetFolderName(this, path); }
public void UpdateSelectedNames(string[] names, NameOptions type) { // Сохраним текущие выделенные слова selected_names = names; var tmp_keywords = new List <string>(); foreach (string item in listKeywords.SelectedItems) { tmp_keywords.Add(item); } edit_mode_keywords = true; listKeywords.BeginUpdate(); listKeywords.Items.Clear(); listKeywords.Items.AddRange(model.GetKeywords(names[0], type)); // Восстановим выделенные слова int index = -1; foreach (string item in tmp_keywords) { index = listKeywords.Items.IndexOf(item); if (index != -1) { listKeywords.SetSelected(index, true); } } edit_mode_keywords = false; listKeywords.EndUpdate(); InitChart(); listKeywords_SelectedIndexChanged(null, null); }
// Parses the parts of the names between Dots and ColonColons. private SimpleNameSyntax ParseSimpleName(NameOptions options = NameOptions.None) { var id = this.ParseIdentifierName(); if (id.Identifier.IsMissing) { return(id); } // You can pass ignore generics if you don't even want the parser to consider generics at all. // The name parsing will then stop at the first "<". It doesn't make sense to pass both Generic and IgnoreGeneric. SimpleNameSyntax name = id; if (this.CurrentToken.Kind == SyntaxKind.LessThanToken) { var pt = this.GetResetPoint(); var kind = this.ScanTypeArgumentList((options & NameOptions.InExpression) != 0); this.Reset(ref pt); this.Release(ref pt); if (kind == ScanTypeArgumentListKind.DefiniteTypeArgumentList || (kind == ScanTypeArgumentListKind.PossibleTypeArgumentList && (options & NameOptions.InTypeList) != 0)) { Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); SyntaxToken open; var types = this._pool.AllocateSeparated <TypeSyntax>(); SyntaxToken close; this.ParseTypeArgumentList(out open, types, out close); name = _syntaxFactory.GenericName(id.Identifier, _syntaxFactory.TypeArgumentList(open, types, close)); this._pool.Free(types); } } return(name); }
public VBNameVisitor(NameOptions options) { Options = options; }
public CSharpNameVisitorCreator(NameOptions options) { _options = options; }
public CSharpNameVisitor(NameOptions options) { Options = options; }
public VBNameVisitorCreator(NameOptions options) { _options = options; }
public abstract string GetDisplayName(NameOptions opts);
public virtual void SetName(IWin32Window owner, string name, NameOptions opts) { throw new NotSupportedException(); }
public override string GetDisplayName(NameOptions opts) { return(n.ToString()); }
public static Dictionary <string, string> GetNameToNamespaceMap(string sourceDirectory, NameOptions nameOptions) { IEnumerable <string> sourceFiles = Directory.GetFiles(sourceDirectory, "*.cs", SearchOption.AllDirectories).Where(f => IsValidCsSourceFile(f)); return(GetNameToNamespaceMap(sourceFiles, nameOptions)); }
public static Dictionary <string, string> GetNameToNamespaceMap(IEnumerable <string> sourceFiles, NameOptions nameOptions) { var maps = new List <Dictionary <string, string> >(); System.Threading.Tasks.ParallelOptions opt = new System.Threading.Tasks.ParallelOptions() { MaxDegreeOfParallelism = Environment.ProcessorCount * 2 }; #if MakeSingleThreaded opt.MaxDegreeOfParallelism = 1; #endif System.Threading.Tasks.Parallel.ForEach(sourceFiles, opt, (sourceFile) => { string fileToRead = Path.GetFullPath(sourceFile); SyntaxTree tree = CSharpSyntaxTree.ParseText(File.ReadAllText(fileToRead), null, fileToRead); Dictionary <string, string> map = NameToNamespaceFinder.GetNamesToNamespaces(tree, nameOptions); lock (maps) { maps.Add(map); } }); Dictionary <string, string> ret = new Dictionary <string, string>(); foreach (Dictionary <string, string> map in maps) { foreach (KeyValuePair <string, string> pair in map) { if (ret.TryGetValue(pair.Key, out var currentValue)) { if (!currentValue.Contains(pair.Value)) { currentValue += $";{pair.Value}"; } } else { currentValue = pair.Value; } ret[pair.Key] = currentValue; } } return(ret); }
public TreeWalker(SyntaxTree tree, Dictionary <string, string> namesToNamespaces, NameOptions nameOptions) { this.nameOptions = nameOptions; this.namesToNamespaces = namesToNamespaces; this.Visit(tree.GetRoot()); }
public static Dictionary <string, string> GetNamesToNamespaces(SyntaxTree tree, NameOptions nameOptions) { Dictionary <string, string> namesToNamespaces = new Dictionary <string, string>(); new TreeWalker(tree, namesToNamespaces, nameOptions); return(namesToNamespaces); }