/// <summary> /// Checks the availability of insert chartpoint menu item /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CheckAvailability(object sender, EventArgs e) { // get the menu that fired the event var menuCommand = sender as OleMenuCommand; if (menuCommand != null) { menuCommand.Visible = false; menuCommand.Enabled = false; if (extensionServ.GetMode() != EMode.Design) { return; } IProjectChartPoints pPnts = Globals.processor.GetProjectChartPoints(Globals.dte.ActiveDocument.ProjectItem.ContainingProject.Name); if (pPnts == null) { Globals.processor.AddProjectChartPoints(Globals.dte.ActiveDocument.ProjectItem.ContainingProject.Name, out pPnts); } checkPnt = pPnts.CheckCursorPos(); if (checkPnt != null) { if (checkPnt.elems.Count > 0) { menuCommand.Visible = true; menuCommand.Enabled = true; } else { checkPnt = null; } } } }
public bool AddProjectChartPoints(IProjectChartPoints pPnts) { pPnts.addCPFileEvent += AddProjectChartPoints; pPnts.remCPFileEvent += RemoveProjectChartPoints; data.projPoints.Add(pPnts); return(true); }
private void OnProcDebugCreate(CPProcEvArgs args) { IProjectChartPoints pPnts = Globals.processor.GetProjectChartPoints(Path.GetFileNameWithoutExtension(args.Name)); if (pPnts != null && pPnts.Count > 0) { TraceTransport.Open(); traceHandlers.Add(new CPTraceHandler(args.procId, args.Name)); cpTraceFlag = true; } }
private ChartPointsProcessor(SerializationInfo info, StreamingContext context) { //data = info.GetValue(Globals.GetTypeName(data), Globals.GetType(data)) as IChartPointsProcessorData; UInt32 Count = info.GetUInt32("projPoints.Count"); for (uint i = 0; i < Count; ++i) { IProjectChartPoints projCPs = null; projCPs = info.GetValue(Globals.GetTypeName(projCPs), Globals.GetType(projCPs)) as IProjectChartPoints; AddProjectChartPoints(projCPs); } }
protected /*bool */ void AddProjectChartPoints(CPProjEvArgs args)// IProjectChartPoints projPnts) { IProjectChartPoints pPnts = GetProjectChartPoints(/*projPnts*/ args.projCPs.data.projName); if (pPnts == null) { data.projPoints.Add(/*projPnts*/ args.projCPs); //return true; } //return false; }
public CPClassLayout GetInjectionData(string projName) { IProjectChartPoints pPnts = Globals.processor.GetProjectChartPoints(projName); if (pPnts == null) { return(null); } CPClassLayout cpClassLayout = new CPClassLayout(); pPnts.CalcInjectionPoints(cpClassLayout); return(cpClassLayout); }
public void OnBuildProjConfigBegin(string projName, string projConfig , string platform, string solConfig) { if (solConfig.Contains(" [ChartPoints]")) { extensionServ.SetMode(EMode.Build); ServiceHost serviceHost = null; try { EnvDTE.Project proj = Globals.dte.Solution.Projects.Item(projName); //!!! Needed for newly created project to update vcxproj file !!! //Orchestrate(proj.FullName); IProjectChartPoints pPnts = Globals.processor.GetProjectChartPoints(proj.Name); if (pPnts != null) { VCProject vcProj = (VCProject)proj.Object; VCConfiguration vcConfig = vcProj.Configurations.Item(projConfig); IVCCollection tools = vcConfig.Tools as IVCCollection; VCLinkerTool tool = tools.Item("VCLinkerTool") as VCLinkerTool; tool.GenerateDebugInformation = false; pPnts.Validate(); if (!serviceHostsCont.TryGetValue(proj.FullName, out serviceHost)) { serviceHostsCont.Add(proj.FullName, serviceHost); } if (serviceHost == null) { serviceHost = new ServiceHost(typeof(IPCChartPoint)); serviceHostsCont[proj.FullName] = serviceHost; //if (serviceHost.State != CommunicationState.Opening && serviceHost.State != CommunicationState.Opened) //{ NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None); string address = "net.pipe://localhost/IPCChartPoint/" + System.IO.Path.GetFullPath(proj.FullName).ToLower(); serviceHost.AddServiceEndpoint(typeof(IIPCChartPoint), binding, address); serviceHost.Open(); //} } } } catch (Exception /*ex*/) { serviceHost = null; } } }
public bool AddProjectChartPoints(string projName, out IProjectChartPoints pPnts) { pPnts = GetProjectChartPoints(projName); if (pPnts == null) { pPnts = CP.Utils.IClassFactory.GetInstance().CreateProjectCPs(projName); if (!pPnts.Validate()) { pPnts = null; return(false); } AddProjectChartPoints(pPnts); return(true); } return(false); }
public bool RemoveChartPoints(string projName) { IProjectChartPoints pcp = GetProjectChartPoints(projName); if (pcp != null) { IFileChartPoints fCPs = null; while ((fCPs = pcp.filePoints.FirstOrDefault()) != null) { if (fCPs.linePoints.Count == 0) { pcp.filePoints.Remove(fCPs); } else { ILineChartPoints lCPs = null; while ((lCPs = fCPs.linePoints.FirstOrDefault()) != null) { if (lCPs.chartPoints.Count == 0) { fCPs.RemoveLineChartPoints(lCPs); } else { IChartPoint cp = null; while ((cp = lCPs.chartPoints.FirstOrDefault()) != null) { lCPs.RemoveChartPoint(cp); } } } } } data.projPoints.Remove(pcp); } return(true); }
//[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] //void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) //{ // info.AddValue(Globals.GetTypeName(data), data, data.GetType()); // info.AddValue("projPoints.Count", (UInt32)data.projPoints.Count); // foreach (IProjectChartPoints projCPs in data.projPoints) // { // info.AddValue("projPoints", projCPs, projCPs.GetType()); // } //} public IProjectChartPoints GetProjectChartPoints(string projName) { IProjectChartPoints pPnts = data.projPoints.FirstOrDefault((pp) => (pp.data.projName == projName)); return(pPnts); }
protected CPPropsDeSerializator(SerializationInfo info, StreamingContext context) { try { UInt32 projsCount = info.GetUInt32("projPoints.Count"); for (uint p = 0; p < projsCount; ++p) { string projName = info.GetString("projName_" + p.ToString()); Globals.processor.RemoveChartPoints(projName); UInt32 filesCount = info.GetUInt32("filePoints.Count_" + p.ToString()); if (filesCount > 0) { IProjectChartPoints projCPs = Globals.processor.GetProjectChartPoints(projName); if (projCPs == null) { Globals.processor.AddProjectChartPoints(projName, out projCPs); } if (projCPs != null) { for (uint f = 0; f < filesCount; ++f) { string fileName = info.GetString("fileName_" + p.ToString() + f.ToString()); IFileChartPoints fPnts = projCPs.AddFileChartPoints(fileName); if (fPnts != null) { UInt32 linesCount = info.GetUInt32("linePoints.Count_" + p.ToString() + f.ToString()); for (uint l = 0; l < linesCount; ++l) { UInt32 lineNum = info.GetUInt32("lineNum_" + p.ToString() + f.ToString() + l.ToString()); UInt32 linePos = info.GetUInt32("linePos_" + p.ToString() + f.ToString() + l.ToString()); ILineChartPoints lPnts = fPnts.AddLineChartPoints((int)lineNum, (int)linePos); if (lPnts != null) { UInt32 cpsCount = info.GetUInt32("cpsPoints.Count_" + p.ToString() + f.ToString() + l.ToString()); for (uint cp = 0; cp < cpsCount; ++cp) { IChartPoint chartPnt = null; string uniqueName = info.GetString("uniqueName_" + p.ToString() + f.ToString() + l.ToString() + cp.ToString()); bool enabled = info.GetBoolean("enabled_" + p.ToString() + f.ToString() + l.ToString() + cp.ToString()); if (lPnts.AddChartPoint(uniqueName, out chartPnt)) { chartPnt.SetStatus(enabled ? EChartPointStatus.SwitchedOn : EChartPointStatus.SwitchedOff); } } } if (lPnts.Count == 0) { fPnts.RemoveLineChartPoints(lPnts); } } } } } } } } catch (Exception ex) { Console.WriteLine(ex); } }
public CPProjEvArgs(IProjectChartPoints _projCPs, IFileChartPoints _fileCPs) { projCPs = _projCPs; fileCPs = _fileCPs; }