public bool Synchronize() { bool changed = false; foreach (ICheckElem _elem in elems) { if (_elem.HasChanged()) { if (pPnts == null) { ChartPoints.Globals.processor.AddProjectChartPoints(projName, out pPnts); } if (fPnts == null) { fPnts = pPnts.AddFileChartPoints(fileName); } if (lPnts == null) { lPnts = fPnts.AddLineChartPoints(lineNum, linePos); } changed = lPnts.SyncChartPoint(_elem); } } return(changed); }
public FileCPsObserver(IFileChartPoints _fCPs, IChartPointsTagger _fCPTagger) { fCPTagger = _fCPTagger; fCPs = _fCPs; fCPs.addCPLineEvent += OnAddCpLine; fCPs.remCPLineEvent += OnRemCpLine; fCPs.moveCPLineEvent += OnMoveCPLine; }
protected bool RemoveFileChartPoints(IFileChartPoints filePnts) { bool ret = filePoints.Remove(filePnts); if (ret) { remCPFileEvent.Fire(new CPProjEvArgs(this, filePnts)); } return(ret); }
public ILineChartPoints GetFileLineChartPoints(string fname, int lineNum) { ILineChartPoints lPnts = null; IFileChartPoints fPnts = GetFileChartPoints(fname); if (fPnts != null) { lPnts = fPnts.GetLineChartPoints(lineNum); } return(lPnts); }
public void CreateObserver(IFileChartPoints _fCPs) { fCPs = _fCPs; if (fCPTagger != null) { if (fCPObserver != null) { fCPObserver.SetTagger(fCPTagger); } else { fCPObserver = new FileCPsObserver(fCPs, fCPTagger); } } }
public IFileChartPoints AddFileChartPoints(string fileName) { IFileChartPoints fPnts = GetFileChartPoints(fileName); if (fPnts == null) { IFileElem fileElem = cpCodeModel.GetFile(fileName); if (fileElem != null) { fPnts = CP.Utils.IClassFactory.GetInstance().CreateFileCPs(fileElem, data); AddFileChartPoints(fPnts, false); } } return(fPnts); }
protected bool AddFileChartPoints(IFileChartPoints filePnts, bool checkExistance = true) { if (checkExistance) { IFileChartPoints fPnts = GetFileChartPoints(filePnts.data.fileName); if (fPnts != null) { return(false); } } filePoints.Add(filePnts); filePnts.remCPLineEvent += OnRemLineCPs; addCPFileEvent.Fire(new CPProjEvArgs(this, filePnts)); return(true); }
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); }
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 FileCPTracker(IFileChartPoints _fcps) { fcps = _fcps; fcps.addCPLineEvent += OnAddCpLine; fcps.remCPLineEvent += OnRemCpLine; }
public void RemoveObserver() { fCPObserver = null; fCPs = null; }
public FileCPTagObserver(IFileChartPoints fCPs) { CreateObserver(fCPs); }
//private ProjectChartPoints(SerializationInfo info, StreamingContext context) //{ // theData = info.GetValue(Globals.GetTypeName(data), Globals.GetType(data)) as CPProjectData; // DTE2 dte2 = (DTE2)Globals.dte; // Events2 evs2 = (Events2)dte2.Events; // cpCodeModel = new CP.Code.Model(data.projName, evs2); // UInt32 Count = info.GetUInt32("filePoints.Count"); // for (uint i = 0; i < Count; ++i) // { // IFileChartPoints fileCPs = null; // fileCPs = info.GetValue(Globals.GetTypeName(fileCPs), Globals.GetType(fileCPs)) as IFileChartPoints; // AddFileChartPoints(fileCPs, false); // } //} //[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] //public void GetObjectData(SerializationInfo info, StreamingContext context) //{ // info.AddValue(data.GetType().ToString(), data, data.GetType()); // info.AddValue("filePoints.Count", (UInt32)filePoints.Count); // foreach (IFileChartPoints fileCPs in filePoints) // { // info.AddValue("filePoints", fileCPs, fileCPs.GetType()); // } //} public IFileChartPoints GetFileChartPoints(string fname) { IFileChartPoints fPnts = filePoints.FirstOrDefault((fp) => (fp.data.fileName == fname)); return(fPnts); }
public CPProjEvArgs(IProjectChartPoints _projCPs, IFileChartPoints _fileCPs) { projCPs = _projCPs; fileCPs = _fileCPs; }
public CPFileEvArgs(IFileChartPoints _fileCPs, ILineChartPoints _lineCPs) { fileCPs = _fileCPs; lineCPs = _lineCPs; }