public ArrayValue(TypedDef[] indexTypes, ProjectEntry entry, Node node) : base(entry, entry.Analyzer._arrayPrototype) { _indexTypes = indexTypes; _unionType = new TypedDef(); _node = node; entry.Analyzer.AnalysisValueCreated(GetType()); }
public BuiltinFunctionValue(ProjectEntry projectEntry, string name, string documentation = null, ExpandoValue prototype = null, params ParameterResult[] signature) : this(projectEntry, name, new[] { new SimpleOverloadResult(name, documentation, signature) }, documentation, prototype) { }
public OverviewWalker(ProjectEntry entry, AnalysisUnit topAnalysis) { _entry = entry; _curUnit = topAnalysis; _scope = topAnalysis.Scope; }
public DictionaryInfo(ProjectEntry declaringModule, Node node) : base(declaringModule.ProjectState.ClassInfos[BuiltinTypeId.Dict]) { _keysAndValues = new DependentKeyValue(); _declaringModule = declaringModule; _declVersion = declaringModule.AnalysisVersion; _node = node; }
public ProjectNode(ProjectEntry project, IconProvider iconProvider) : base(project.Project, project.FilePath.ParentDirectory, iconProvider) { ProjectEntry = project; ProjectEntry.LoadComplete += project_LoadComplete; var solution = ProjectEntry.GetRoot() as Solution; if (solution != null) { solution.Settings.StartupProjects.InsertedItem += StartupProjects_InsertedItem; solution.Settings.StartupProjects.RemovedItem += StartupProjects_RemovedItem; } if (project.HasProject) { ImageIndex = SelectedImageIndex = (_iconProvider = iconProvider).GetImageIndex(project); _propertiesNode = new PropertiesNode(iconProvider); if (project.Project is IAssemblyReferenceProvider) _referencesNode = new ReferencesNode(project.Project as IAssemblyReferenceProvider, iconProvider); } if (project.IsLoaded) Populate(); }
internal FunctionInfo(AnalysisUnit unit, ProjectEntry entry) : base(unit) { _entry = entry; _returnValue = new VariableDef(); _declVersion = entry.Version; // TODO: pass NoneInfo if we can't determine the function always returns }
public OverviewWalker(ProjectEntry entry, AnalysisUnit topAnalysis, JsAst tree, bool isNested = false) { _entry = entry; _curUnit = topAnalysis; _isNested = isNested; _tree = tree; _scope = topAnalysis.Environment; }
internal override SequenceInfo MakeFromIndexes(Node node, ProjectEntry entry) { if (_indexTypes.Count > 0) { var vals = new[] { new VariableDef() }; vals[0].AddTypes(entry, _indexTypes, false); return new ListInfo(vals, this, node, entry); } else { return new ListInfo(VariableDef.EmptyArray, this, node, entry); } }
internal ClassInfo(AnalysisUnit unit, ProjectEntry entry) : base(unit) { _instanceInfo = new InstanceInfo(this); _bases = new List<ISet<Namespace>>(); _entry = entry; _scope = new ClassScope(this); _declVersion = entry.Version; }
public ObjectValue(ProjectEntry projectEntry, AnalysisValue prototype = null, string description = null) : base(projectEntry) { if (prototype != null) { Add("__proto__", prototype.SelfSet); } #if DEBUG _description = description; #endif }
public OverviewWalker(ProjectEntry entry, AnalysisUnit topAnalysis, PythonAst tree) { _entry = entry; _curUnit = topAnalysis; _tree = tree; Debug.Assert(_tree != null); _scope = topAnalysis.Scope; }
public ModuleInfo(string moduleName, ProjectEntry projectEntry) { _name = moduleName; _projectEntry = projectEntry; ShowClr = false; _sequences = new Dictionary<Node, ISet<Namespace>>(); _imports = new Dictionary<Node, ImportInfo>(); _scope = new ModuleScope(this); _weakModule = new WeakReference(this); }
public ModuleInfo(string moduleName, ProjectEntry projectEntry, IModuleContext moduleContext) { _name = moduleName; _projectEntry = projectEntry; _sequences = new Dictionary<Node, INamespaceSet>(); _scope = new ModuleScope(this); _weakModule = new WeakReference(this); _context = moduleContext; _scopes = new Dictionary<Node, InterpreterScope>(); }
public ModuleInfo(string moduleName, ProjectEntry projectEntry, IModuleContext moduleContext) { _name = moduleName; _projectEntry = projectEntry; _sequences = new Dictionary<Node, IAnalysisSet>(); _scope = new ModuleScope(this); _weakModule = new WeakReference(this); _context = moduleContext; _scopes = new Dictionary<Node, InterpreterScope>(); _referencedModules = new HashSet<ModuleReference>(); _unresolvedModules = new HashSet<string>(StringComparer.Ordinal); }
public OverviewWalker(ProjectEntry entry, AnalysisUnit topAnalysis) { _entry = entry; _curUnit = topAnalysis; _scopes = new List<InterpreterScope>(); _scopes.Push(entry.MyScope.Scope); _scopeTree = new Stack<ScopePositionInfo>(); _scopeTree.Push(new ScopePositionInfo(1, Int32.MaxValue, null)); }
internal FunctionInfo(FunctionDefinition node, AnalysisUnit declUnit, InterpreterScope declScope) { _projectEntry = declUnit.ProjectEntry; _functionDefinition = node; _declVersion = declUnit.ProjectEntry.AnalysisVersion; if (Name == "__new__") { IsClassMethod = true; } _analysisUnit = new FunctionAnalysisUnit(this, declUnit, declScope); }
public void ParseProjectFolderDataOfSolutionFile() { const string FolderName = "MyFolder"; const string FolderGuid = "{ACE7730E-5F62-48D6-B772-C4B1E8665FA1}"; const string ProjectFolderString = "Project(" + ProjectEntry.ProjectFolderGuid + ") = \"" + FolderName + "\", \"" + FolderName + "\", " + FolderGuid; var projectEntry = new ProjectEntry(ProjectFolderString); Assert.IsTrue(projectEntry.IsSolutionFolder); Assert.IsFalse(projectEntry.IsCSharpProject); Assert.AreEqual(FolderName, projectEntry.Name); Assert.AreEqual(FolderName, projectEntry.FilePath); Assert.AreEqual(FolderGuid, projectEntry.Guid); }
public IAnalysisSet GetValue(Node node, AnalysisUnit unit, ProjectEntry declaringScope, IAnalysisSet @this, bool addRef) { IAnalysisSet res = AnalysisSet.Empty; foreach (var prototype in _instance._prototypes) { if (prototype.Value.Push()) { try { var value = prototype.Value.GetProperty(node, unit, _name); if (value != null) { res = res.Union(value.GetValue(node, unit, declaringScope, @this, addRef)); } } finally { prototype.Value.Pop(); } } } return res; }
public void AddOwnerProject(IProject project, bool isLinkedFile) { Debug.Assert(project != null); lock (this) { if (FindIndexForProject(project) >= 0) throw new InvalidOperationException("The project alreadys owns the file"); ProjectEntry newEntry = new ProjectEntry(project, null, null); if (entries[0].Project == null) { entries[0] = newEntry; } else if (isLinkedFile) { entries.Add(newEntry); } else { entries.Insert(0, newEntry); } } }
public BuiltinFunctionValue(ProjectEntry projectEntry, string name, OverloadResult[] overloads, string documentation = null, ExpandoValue prototype = null) : base(projectEntry, prototype, name) { _name = name; _documentation = documentation; _overloads = overloads; Add("length", projectEntry.Analyzer.GetConstant(1.0).Proxy); Add("name", projectEntry.Analyzer.GetConstant(name).Proxy); Add("arguments", projectEntry.Analyzer._nullInst.Proxy); Add("caller", projectEntry.Analyzer._nullInst.Proxy); projectEntry.Analyzer.AnalysisValueCreated(typeof(BuiltinFunctionValue)); }
public void AddFile(ProjectEntry file) { m_Files.Insert(0, file); for (int i = 1; i < m_Files.Count; ++i) { if (m_Files[i].FilePath == file.FilePath) { m_Files.RemoveAt(i); return; } } const int MAX_FILE_COUNT = 4; if (m_Files.Count > MAX_FILE_COUNT) { m_Files.RemoveRange(MAX_FILE_COUNT, m_Files.Count - MAX_FILE_COUNT); } }
/// <summary> /// This functions returns true if a project with the same properties, toolset version and filename has been previously loaded. It /// will return false for currently loaded projects and projects that have never been loaded. /// </summary> /// <returns>True if exact same instance has been loaded before </returns> internal bool HasProjectBeenLoaded ( string projectFileFullPath, BuildPropertyGroup globalProperties, string toolsVersion ) { ProjectEntry projectEntry = GetProjectEntry(unloadedProjects, projectFileFullPath, globalProperties, toolsVersion); if (projectEntry != null) { return(true); } else { return(false); } }
/// <summary> /// Get a node that the project has been assigned to /// </summary> /// <returns>Index of the node the project is assigned to and 0 otherwise</returns> internal int GetRemoteProject ( string projectFileFullPath, BuildPropertyGroup globalProperties, string toolsVersion ) { ProjectEntry projectEntry = GetProjectEntry(nodeToProjectsMapping, projectFileFullPath, globalProperties, toolsVersion); if (projectEntry != null) { return(projectEntry.nodeIndex); } else { return(EngineCallback.invalidNode); } }
public ReferenceList GetReferences(ProjectEntry projectEntry) { ReferenceList builtinRef; lock (this) { var isReferenced = TryGetValue(projectEntry, out builtinRef); if (!isReferenced || builtinRef.Version != projectEntry.AnalysisVersion) { this[projectEntry] = builtinRef = new ReferenceList(projectEntry); } if (!isReferenced) { projectEntry.AddBackReference(this); } } return(builtinRef); }
public void CreateProjectEntry(string title, string description, List <string> tags) { using (var db = new LiteDatabase(dbPath)) { // Get a collection (or create, if doesn't exist) var coll = db.GetCollection <ProjectEntry>("projectentries"); // Create your new customer instance var entry = new ProjectEntry { Title = title, Description = description, Reputation = 0, Tags = tags }; // Insert new customer document (Id will be auto-incremented) coll.Insert(entry); } }
private void btnResetAll_Click(object sender, EventArgs e) { if (MessageBox.Show(this, "Are you sure you want to reset all timers?", "Confirm timer reset", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.m_stopWatch.Stop(); this.m_stopWatch.Reset(); this.PT_SetActiveButton(null); foreach (Button btn in this.panelButtons.Controls) { ProjectEntry entry = (ProjectEntry)btn.Tag; entry.Elapsed = 0; btn.Text = String.Format("{0}\n{1}", entry.Name, PT_GetElapsedTime(entry.Elapsed)); btn.BackColor = PT_GetStateColor(false, btn == this.m_editButton); } } }
/// <summary> /// Updates SS Project with new Acumatica tasks not yet synced /// </summary> /// <param name="smartsheetClient"></param> /// <param name="columnMap"></param> /// <param name="projectEntryGraph"></param> /// <param name="sheetSelected"></param> /// <param name="smartSheetHelperObject"></param> public void UpdateSSProject(SmartsheetClient smartsheetClient, Dictionary <string, long> columnMap, ProjectEntry projectEntryGraph, long?sheetSelected, SmartsheetHelper smartSheetHelperObject, PXResultset <PMSSMapping> templateMappingSet) { //Add newly created rows to Smartsheet List <Row> newRows = smartSheetHelperObject.InsertAcumaticaTasksInSS(projectEntryGraph, columnMap, null, false, templateMappingSet); IList <Row> ssRows = smartsheetClient.SheetResources.RowResources.AddRows((long)sheetSelected, newRows); int ssTaskIDPosition = 0; if (ssRows.Count > 0 && ssRows[0].Cells != null) { //"TaskCD" is the linking element between the Acumatica Project's Tasks and the cell being used as the "Task" equivalent in the mapping definition PMSSMapping mappingSS = templateMappingSet.Where(t => ((PMSSMapping)t).NameAcu.Trim().ToUpper() == SmartsheetConstants.ColumnMapping.TASKS_CD.Trim().ToUpper()).FirstOrDefault(); ssTaskIDPosition = smartSheetHelperObject.GetSSTaskPosition(ssRows[0].Cells, columnMap[mappingSS.NameSS]); } foreach (Row currentRow in ssRows) { foreach (PMTask acumaticaTask in projectEntryGraph.Tasks.Select()) { PMTaskSSExt pmTaskSSExtRow = PXCache <PMTask> .GetExtension <PMTaskSSExt>(acumaticaTask); if (pmTaskSSExtRow != null && pmTaskSSExtRow.UsrSmartsheetTaskID != null) { continue; } if (currentRow.Cells[ssTaskIDPosition].Value != null && acumaticaTask.TaskCD != null && string.Equals(currentRow.Cells[ssTaskIDPosition].Value.ToString().Trim(), acumaticaTask.TaskCD.Trim(), StringComparison.OrdinalIgnoreCase)) { pmTaskSSExtRow.UsrSmartsheetTaskID = currentRow.Id; projectEntryGraph.Tasks.Update(acumaticaTask); break; } } } return; }
public void ExpireCache() { lock (this) { if (PrimaryProject == null) { parserService.RemoveEntry(this); } else { for (int i = 0; i < entries.Count; i++) { var oldEntry = entries[i]; entries[i] = new ProjectEntry(oldEntry.Project, oldEntry.UnresolvedFile, null); } } // force re-parse on next ParseFile() call even if unchanged this.currentVersion = null; } }
private static IEnumerable <IMemberResult> GetModuleVariables(ProjectEntry entry, GetMemberOptions opts, string prefix, IModuleAnalysis analysis) { var breadthFirst = analysis.Scope.TraverseBreadthFirst(s => s.Children); var all = breadthFirst.SelectMany(c => analysis.GetAllAvailableMembersFromScope(c, opts)); var result = all .Where(m => { if (m.Values.Any(v => v.DeclaringModule == entry || v.Locations.Any(l => l.DocumentUri == entry.DocumentUri))) { if (string.IsNullOrEmpty(prefix) || m.Name.StartsWithOrdinal(prefix, ignoreCase: true)) { return(true); } } return(false); }) .Take(_symbolHierarchyMaxSymbols); return(result); }
private ProjectEntry CreateProjectEntry(DateTime day, CreateProjectEntryModel newEntry) { var newDbEntry = new ProjectEntry(); newDbEntry.ProjectEntryID = Guid.NewGuid(); newDbEntry.CreatedBy = newEntry.CreatedBy; newDbEntry.DateCreated = day; newDbEntry.ProjectID = Guid.Parse(newEntry.SelectProject); newDbEntry.ChangeListNo = newEntry.ChangeListNo ?? newDbEntry.ProjectEntryID.ToString().Substring(0, _maxCharacters); newDbEntry.Hours = newEntry.EntryHours; newDbEntry.Description = newEntry.Description ?? string.Empty; newDbEntry.ModifiedBy = newEntry.CreatedBy; newDbEntry.ModifiedDate = day; newDbEntry.SREDCategoryID = newEntry.SelectCategory == null ? null : (Guid?)Guid.Parse(newEntry.SelectCategory); return(newDbEntry); }
private void PT_SetEditButton(Button btn) { ProjectEntry entry = null; if (btn == this.btnPending) { return; } if (null != this.m_editButton) { if (btn == this.m_editButton) { btn = null; } this.m_editButton.BackColor = PT_GetStateColor(m_activeButton == this.m_editButton, false); } this.m_editButton = btn; if (this.m_editButton != null) { this.m_editButton.BackColor = PT_GetStateColor(m_activeButton == this.m_editButton, true); entry = (ProjectEntry)this.m_editButton.Tag; this.btnColor.BackColor = Color.FromArgb(entry.Color); this.txtName.Text = entry.Name; this.cbInclude.Checked = !entry.Ignore; this.cbIdle.Checked = entry.Idle; this.pnlEdit.Visible = true; this.txtName.Select(); this.txtName.SelectAll(); } else { this.txtName.Text = ""; this.btnColor.BackColor = Color.Gray; this.pnlEdit.Visible = false; } }
private void btnDelete_Click(object sender, EventArgs e) { if (null == this.m_editButton) { return; } ProjectEntry entry = (ProjectEntry)this.m_editButton.Tag; if (entry.Elapsed > 0 && MessageBox.Show(this, "This button has elapsed time.\n\nAre you sure you want to delete it?", "Comfirm button delete", MessageBoxButtons.YesNo) == DialogResult.No) { return; } this.panelButtons.Controls.Remove(this.m_editButton); this.m_projectList.Remove(entry); this.PT_SetEditButton(null); }
public void ParseCSharpProjectDataOfSolutionFile() { const string ProjectName = "MyCSharpProject"; const string ProjectFilePath = @"Basics\Coding.MyCSharpProject.csproj"; const string ProjectGuid = "{AAE7730E-5F62-48D6-B772-C4B1E8665FE1}"; const string ProjectEntryString = "Project(" + ProjectEntry.CSharpProjectTypeGuid + ") = \"" + ProjectName + "\", \"" + ProjectFilePath + "\", " + ProjectGuid; var projectEntry = new ProjectEntry(ProjectEntryString); Assert.IsTrue(projectEntry.IsCSharpProject); Assert.IsFalse(projectEntry.IsSolutionFolder); Assert.AreEqual(ProjectName, projectEntry.Name); Assert.AreEqual(ProjectFilePath, projectEntry.FilePath); Assert.AreEqual(ProjectGuid, projectEntry.Guid); Assert.AreEqual(-1260520527, projectEntry.GetHashCode()); Assert.IsFalse(projectEntry.Equals(new object())); Assert.IsTrue(projectEntry.Equals(new ProjectEntry(ProjectEntryString))); }
private void btnColor_Click(object sender, EventArgs e) { if (null == this.m_editButton) { return; } if (this.colorPicker.ShowDialog() == DialogResult.OK) { ProjectEntry entry = (ProjectEntry)this.m_editButton.Tag; entry.Color = this.colorPicker.Color.ToArgb(); this.btnColor.BackColor = this.colorPicker.Color; if (this.m_editButton != this.m_activeButton) { this.m_editButton.ForeColor = this.colorPicker.Color; } } }
internal override Dictionary <string, IAnalysisSet> GetAllMembers(ProjectEntry accessor) { var res = base.GetAllMembers(accessor); foreach (var value in _prototypes) { if (value.Value.Push()) { try { foreach (var keyValue in value.Value.GetAllMembers(accessor)) { MergeTypes(res, keyValue.Key, keyValue.Value); } } finally { value.Value.Pop(); } } } return(res); }
public Week Get(int year, int week, string user) { if (user.ToUpper().Equals("ALL")) { var weeks = Storage.GetWeekAll(new YearWeek { Year = year, Week = week }); var entries = weeks.SelectMany(w => w.Entries); var projects = entries.Select(e => e.ProjectName).Distinct(); var summaryWeek = new Week(year, week, user); var summaryEntries = new List <ProjectEntry>(); foreach (string project in projects) { ProjectEntry newEntry = new ProjectEntry { ProjectName = project, TimeAllocation = (entries.Where(e => e.ProjectName.Equals(project)).Sum(e => e.TimeAllocation)) / weeks.Count(), }; summaryEntries.Add(newEntry); } summaryWeek.Entries = summaryEntries; return(summaryWeek); } else { var retrieved = Storage.GetWeek(new YearWeek { Year = year, Week = week }, user); if (retrieved != null) { return(retrieved); } return(new Week(year, week, user)); } }
/// <summary> /// Updates SS Project with new Acumatica tasks not yet synced /// </summary> /// <param name="smartsheetClient"></param> /// <param name="columnMap"></param> /// <param name="projectEntryGraph"></param> /// <param name="sheetSelected"></param> /// <param name="smartSheetHelperObject"></param> public void UpdateSSProject(SmartsheetClient smartsheetClient, Dictionary <string, long> columnMap, ProjectEntry projectEntryGraph, long?sheetSelected, SmartsheetHelper smartSheetHelperObject) { //Add newly created rows to Smartsheet List <Row> newRows = smartSheetHelperObject.InsertAcumaticaTasksInSS(projectEntryGraph, null, columnMap, false); IList <Row> ssRows = smartsheetClient.SheetResources.RowResources.AddRows((long)sheetSelected, newRows); int ssTaskIDPosition = 0; if (ssRows.Count > 0 && ssRows[0].Cells != null) { ssTaskIDPosition = smartSheetHelperObject.GetSSTaskPosition(ssRows[0].Cells, columnMap[SmartsheetConstants.ColumnMapping.TASK_ID]); } foreach (Row currentRow in ssRows) { foreach (PMTask acumaticaTask in projectEntryGraph.Tasks.Select()) { PMTaskSSExt pmTaskSSExtRow = PXCache <PMTask> .GetExtension <PMTaskSSExt>(acumaticaTask); if (pmTaskSSExtRow != null && pmTaskSSExtRow.UsrSmartsheetTaskID != null) { continue; } if (currentRow.Cells[ssTaskIDPosition].Value != null && acumaticaTask.TaskCD != null && string.Equals(currentRow.Cells[ssTaskIDPosition].Value.ToString().Trim(), acumaticaTask.TaskCD.Trim(), StringComparison.OrdinalIgnoreCase)) { pmTaskSSExtRow.UsrSmartsheetTaskID = currentRow.Id; projectEntryGraph.Tasks.Update(acumaticaTask); break; } } } return; }
internal FunctionInfo(FunctionDefinition node, AnalysisUnit declUnit, InterpreterScope declScope) { _projectEntry = declUnit.ProjectEntry; _functionDefinition = node; _declVersion = declUnit.ProjectEntry.AnalysisVersion; if (_functionDefinition.Name == "__new__") { IsClassMethod = true; } object value; if (!ProjectEntry.Properties.TryGetValue(AnalysisLimits.CallDepthKey, out value) || (_callDepthLimit = (value as int?) ?? -1) < 0) { _callDepthLimit = declUnit.ProjectState.Limits.CallDepth; } _analysisUnit = new FunctionAnalysisUnit(this, declUnit, declScope, _projectEntry); }
public VariableDef AddLocatedVariable(string name, Node location, ProjectEntry projectEntry) { VariableDef value; if (!TryGetVariable(name, out value)) { VariableDef def = new LocatedVariableDef(projectEntry, location); return(AddVariable(name, def)); } else if (!(value is LocatedVariableDef)) { VariableDef def = new LocatedVariableDef(projectEntry, location, value); return(AddVariable(name, def)); } else { ((LocatedVariableDef)value).Node = location; ((LocatedVariableDef)value).DeclaringVersion = projectEntry.AnalysisVersion; } return(value); }
public IAnalysisSet GetValue(Node node, AnalysisUnit unit, ProjectEntry declaringScope, IAnalysisSet @this, bool addRef) { IAnalysisSet res = AnalysisSet.Empty; foreach (var prototype in _instance._prototypes) { if (prototype.Value.Push()) { try { var value = prototype.Value.GetProperty(node, unit, _name); if (value != null) { res = res.Union(value.GetValue(node, unit, declaringScope, @this, addRef)); } } finally { prototype.Value.Pop(); } } } return(res); }
internal override Dictionary<string, IAnalysisSet> GetAllMembers(ProjectEntry accessor) { var res = base.GetAllMembers(accessor); var prototypes = GetPrototype(accessor); if (prototypes != null) { try { foreach (var value in prototypes) { if (PushProtoLookup(value.Value)) { foreach (var kvp in value.Value.GetAllMembers(accessor)) { MergeTypes(res, kvp.Key, kvp.Value); } } } } finally { foreach(var value in prototypes) { PopProtoLookup(value.Value); } } } return res; }
public ProjectEntry CreateRandomProjectEntry(string description) { var projectEntry = new ProjectEntry(); projectEntry.ProjectEntryID = Guid.NewGuid(); projectEntry.CreatedBy = Guid.NewGuid(); projectEntry.DateCreated = _random.RandomDate(); projectEntry.ProjectID = Guid.NewGuid(); projectEntry.Project = new Project(); projectEntry.Project.ProjectName = _random.RandomString(_stringLength); projectEntry.ChangeListNo = Guid.NewGuid().ToString(); projectEntry.SREDCategoryID = Guid.NewGuid(); projectEntry.SREDCategory = new SREDCategory(); projectEntry.SREDCategory.CategoryName = _random.RandomString(_stringLength); projectEntry.Hours = _random.RandomNumber(_minHours, _maxHours); projectEntry.Description = description; projectEntry.ModifiedBy = Guid.NewGuid(); projectEntry.ModifiedDate = _random.RandomDate(); return(projectEntry); }
internal override SequenceInfo MakeFromIndexes(Node node, ProjectEntry entry) { if (_tupleTypes != null) { return(new SequenceInfo(_tupleTypes.Select(t => { var v = new VariableDef(); v.AddTypes(entry, t); return v; }).ToArray(), this, node, entry)); } if (_indexTypes.Length > 0) { var vals = _indexTypes.Zip(VariableDef.Generator, (t, v) => { v.AddTypes(entry, t, false, entry); return(v); }).ToArray(); return(new SequenceInfo(vals, this, node, entry)); } else { return(new SequenceInfo(VariableDef.EmptyArray, this, node, entry)); } }
private void updateTimer_Tick(object sender, EventArgs e) { if (m_stopWatch.IsRunning) { if (m_activeButton != btnPending) { // check if the entry allows idling ProjectEntry entry = (ProjectEntry)m_activeButton.Tag; if (!entry.Idle) { // check how long the computer has been idle var userIdleSeconds = User32.GetLastInputTime(); if (userIdleSeconds >= MaxIdleTimeInSeconds) { m_stopWatch.Stop(); // transfer (elapsed time - idle time) to active button m_stopWatch.Reset(m_stopWatch.ElapsedMilliseconds - userIdleSeconds * 1000); // switch to pending button this.PT_SetActiveButton(btnPending); // reset stopwatch to idle time m_stopWatch.Reset(userIdleSeconds * 1000); m_stopWatch.Start(); } } } if (m_activeButton == btnPending) { m_activeButton.Text = PT_GetElapsedTime(m_stopWatch.ElapsedMilliseconds); } else { ProjectEntry entry = (ProjectEntry)m_activeButton.Tag; m_activeButton.Text = GetActiveButtonText(entry); } } }
internal override Dictionary <string, IAnalysisSet> GetAllMembers(ProjectEntry accessor) { var res = base.GetAllMembers(accessor); if (this != ProjectState._functionPrototype) { foreach (var keyValue in ProjectState._functionPrototype.GetAllMembers(accessor)) { IAnalysisSet existing; if (!res.TryGetValue(keyValue.Key, out existing)) { res[keyValue.Key] = keyValue.Value; } else { res[keyValue.Key] = existing.Union(keyValue.Value); } } } return(res); }
private void txtName_TextChanged(object sender, EventArgs e) { if (null == this.m_editButton) { return; } if (!this.pnlEdit.Enabled) { return; } ProjectEntry entry = (ProjectEntry)this.m_editButton.Tag; entry.Name = this.txtName.Text; if (this.m_editButton != this.m_activeButton) { this.m_editButton.Text = String.Format("{0}\n{1}", entry.Name, PT_GetElapsedTime(entry.Elapsed)); } entry.Name = txtName.Text; }
public string GetDesignTimeHtml(DocumentProjectItem projectItem, bool forceRegenerate) { ProjectEntry entry = null; if (this._projectTable != null) { entry = (ProjectEntry) this._projectTable[projectItem.Project]; if (forceRegenerate && (entry != null)) { entry.RemoveDesignTimeHtml(projectItem); } } else { this._projectTable = new HybridDictionary(); } if (entry == null) { entry = new ProjectEntry(); this._projectTable[projectItem.Project] = entry; } return entry.GetDesignTimeHtml(projectItem); }
public IAnalysisSet GetValue(Node node, AnalysisUnit unit, ProjectEntry declaringScope, IAnalysisSet @this, bool addRef) { if (Values == null) { Values = new EphemeralVariableDef(); } var res = Values.GetTypes(unit, declaringScope); if (res.Count > 0) { // Don't add references to ephemeral values... If they // gain types we'll re-enqueue and the reference will be // added then. if (addRef && !Values.IsEphemeral) { Values.AddReference(node, unit); } } if (Getter != null) { res = res.Union(Getter.GetTypesNoCopy(unit, declaringScope).Call(node, unit, @this, ExpressionEvaluator.EmptySets)); } return res; }
internal void Convert() { var dir = Path.GetDirectoryName(SolutionFilePath); var lines = File.ReadAllLines(SolutionFilePath); using (var file = File.Open(SolutionFilePath, FileMode.Create, FileAccess.Write)) using (var writer = new StreamWriter(file)) { foreach (var line in lines) { if (!SolutionUtil.IsProjectLine(line)) { writer.WriteLine(line); continue; } var entry = SolutionUtil.ParseProjectLine(line); if (entry.ProjectType != ProjectFileType.CSharp && entry.ProjectType != ProjectFileType.Basic) { writer.WriteLine(line); continue; } var projectFilePath = Path.Combine(dir, entry.RelativeFilePath); var projectUtil = new ProjectUtil(projectFilePath); var guid = GetProjectSystemGuid(projectUtil, entry.ProjectType == ProjectFileType.CSharp); if (guid == entry.TypeGuid) { writer.WriteLine(line); continue; } entry = new ProjectEntry(entry.RelativeFilePath, entry.Name, entry.Guid, guid); writer.WriteLine(SolutionUtil.CreateProjectLine(entry)); } } }
private void btnEndDay_Click(object sender, EventArgs e) { if (this.m_stopWatch.IsRunning) { ProjectEntry entry = (ProjectEntry)m_activeButton.Tag; if (entry != null) { entry.Elapsed += m_stopWatch.ElapsedMilliseconds; } this.m_stopWatch.Stop(); this.m_stopWatch.Reset(); this.m_activeButton.BackColor = PT_GetStateColor(false, m_activeButton == this.m_editButton); this.m_activeButton = null; } String report = ""; String date = DateTime.Now.ToString("dd.MM.yyyy"); foreach (ProjectEntry entry in this.m_projectList) { if (!entry.Ignore) { TimeSpan span = TimeSpan.FromMilliseconds(entry.Elapsed); double time = span.Hours + (span.Minutes >= 5 ? 0.5 : 0.0) + (span.Minutes >= 35 ? 0.5 : 0.0); if (time > 0.0) { report += $"{entry.Name}\t{date}\t{time:#.0}\n"; } } } if (!String.IsNullOrEmpty(report)) { Clipboard.SetText(report); } }
internal override IAnalysisSet GetPrototype(ProjectEntry accessor) { IAnalysisSet protoTypes; PropertyDescriptorValue protoDesc; if (Descriptors != null && Descriptors.TryGetValue("__proto__", out protoDesc) && protoDesc.Values != null && (protoTypes = protoDesc.Values.GetTypesNoCopy(accessor, ProjectEntry)).Count > 0) { // someone has assigned to __proto__, so that's our [[Prototype]] // property now. return(protoTypes); } else if (this != ProjectState._objectPrototype) { // [[Prototype]] hasn't been assigned any other way, we have // object's prototype. return(ProjectState._objectPrototype.SelfSet); } return(base.GetPrototype(accessor)); }
public void GetEntry(TextDocumentIdentifier document, int?expectedVersion, out ProjectEntry entry, out PythonAst tree) { ThrowIfDisposed(); entry = GetEntry(document.uri) as ProjectEntry; if (entry == null) { throw new LanguageServerException(LanguageServerException.UnsupportedDocumentType, "unsupported document"); } var parse = entry.GetCurrentParse(); tree = parse?.Tree; if (expectedVersion.HasValue && parse?.Cookie is VersionCookie vc) { if (vc.Versions.TryGetValue(GetPart(document.uri), out var bv)) { if (bv.Version == expectedVersion.Value) { tree = bv.Ast; } } } }
internal FunctionValue(ProjectEntry projectEntry, ExpandoValue prototype = null, string name = null) : base(projectEntry, projectEntry.Analyzer._functionPrototype) { if (prototype == null) { string description = null; #if DEBUG if (String.IsNullOrWhiteSpace(Name ?? name)) { if (AnalysisUnit != null) { var loc = Locations.First(); description = "prototype object of " + AnalysisUnit.FullName + " " + loc.FilePath + "(" + loc.Column + ")"; } else { description = "prototype object of <unknown objects>"; } } else { description = "prototype object of " + (Name ?? name); } #endif prototype = new PrototypeValue(ProjectEntry, this, description: description); } Add("prototype", prototype.Proxy); prototype.Add("constructor", this.Proxy); _instance = new InstanceValue(ProjectEntry, prototype, name); }
public void RegisterUnresolvedFile(IProject project, IUnresolvedFile unresolvedFile) { if (project == null) throw new ArgumentNullException("project"); if (unresolvedFile == null) throw new ArgumentNullException("unresolvedFile"); FreezableHelper.Freeze(unresolvedFile); var newParseInfo = new ParseInformation(unresolvedFile, null, false); lock (this) { int index = FindIndexForProject(project); if (index >= 0) { currentVersion = null; var args = new ParseInformationEventArgs(project, entries[index].UnresolvedFile, newParseInfo); entries[index] = new ProjectEntry(project, unresolvedFile, null); project.OnParseInformationUpdated(args); parserService.RaiseParseInformationUpdated(args); } } }
ProjectEntry DoParse(ITextSource fileContent, IProject parentProject, bool fullParseInformationRequested, CancellationToken cancellationToken) { if (parser == null) return default(ProjectEntry); if (fileContent == null) { // No file content was specified. Because the callers of this method already check for currently open files, // we can assume that the file isn't open and simply read it from disk. try { fileContent = SD.FileService.GetFileContentFromDisk(fileName, cancellationToken); } catch (IOException) { // It is possible that the file gets deleted/becomes inaccessible while a background parse // operation is enqueued, so we have to handle IO exceptions. return default(ProjectEntry); } catch (UnauthorizedAccessException) { return default(ProjectEntry); } } ProjectEntry result; lock (this) { int index = FindIndexForProject(parentProject); int versionComparison = CompareVersions(fileContent.Version); if (versionComparison > 0 || index < 0) { // We're going backwards in time, or are requesting a project that is not an owner // for this entry. var parseInfo = ParseWithExceptionHandling(fileContent, fullParseInformationRequested, parentProject, cancellationToken); FreezableHelper.Freeze(parseInfo.UnresolvedFile); return new ProjectEntry(parentProject, parseInfo.UnresolvedFile, parseInfo); } else { if (versionComparison == 0 && index >= 0) { // Ensure we have parse info for the specified project (entry.UnresolvedFile is null for newly registered projects) // If full parse info is requested, ensure we have full parse info. if (entries[index].UnresolvedFile != null && !(fullParseInformationRequested && entries[index].CachedParseInformation == null)) { // We already have the requested version parsed, just return it: return entries[index]; } } } ParseInformationEventArgs[] results = new ParseInformationEventArgs[entries.Count]; for (int i = 0; i < entries.Count; i++) { var parseInfo = ParseWithExceptionHandling(fileContent, fullParseInformationRequested, entries[i].Project, cancellationToken); if (parseInfo == null) throw new NullReferenceException(parser.GetType().Name + ".Parse() returned null"); if (fullParseInformationRequested && !parseInfo.IsFullParseInformation) throw new InvalidOperationException(parser.GetType().Name + ".Parse() did not return full parse info as requested."); OnDiskTextSourceVersion onDiskVersion = fileContent.Version as OnDiskTextSourceVersion; if (onDiskVersion != null) parseInfo.UnresolvedFile.LastWriteTime = onDiskVersion.LastWriteTime; FreezableHelper.Freeze(parseInfo.UnresolvedFile); results[i] = new ParseInformationEventArgs(entries[i].Project, entries[i].UnresolvedFile, parseInfo); } // Only if all parse runs succeeded, register the parse information. currentVersion = fileContent.Version; for (int i = 0; i < entries.Count; i++) { if (fullParseInformationRequested || (entries[i].CachedParseInformation != null && results[i].NewParseInformation.IsFullParseInformation)) entries[i] = new ProjectEntry(entries[i].Project, results[i].NewUnresolvedFile, results[i].NewParseInformation); else entries[i] = new ProjectEntry(entries[i].Project, results[i].NewUnresolvedFile, null); if (entries[i].Project != null) entries[i].Project.OnParseInformationUpdated(results[i]); parserService.RaiseParseInformationUpdated(results[i]); } result = entries[index]; } // exit lock parserService.RegisterForCacheExpiry(this); return result; }
public PartialFunctionInfo(ProjectEntry declProjEntry, IAnalysisSet function, IAnalysisSet[] args, NameExpression[] keywordArgNames) { _declProjEntry = declProjEntry; _function = function; _args = args; _keywordArgNames = keywordArgNames; }
public StarArgsDictionaryInfo(ProjectEntry declaringModule, Node node) : base(declaringModule, node) { }