public void ClearTemporaryBreakPoint()
 {
     if (m_TemporaryBreakPointInfo != null)
     {
         m_TemporaryBreakPointInfo.IsDeleted = true;
         List <BreakPointInfo> bpList = new List <BreakPointInfo>(new BreakPointInfo[] { m_TemporaryBreakPointInfo });
         PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
         m_TemporaryBreakPointInfo = null;
     }
 }
Пример #2
0
        public void Import(string filePath)
        {
            if (File.Exists(filePath))
            {
                var breakPointList = Util.SerializeXML <List <BreakPointInfo> > .LoadFile(filePath);

                foreach (BreakPointInfo info in breakPointList)
                {
                    if (info.Line < 0)
                    {
                        continue;
                    }
                    info.FileFullPath = m_Project.GetAbsolutePath(info.FileFullPath);
                    BreakPointInfo existing = null;
                    if (m_BreakPointList != null && (existing = m_BreakPointList.Find(b => b.FileFullPath == info.FileFullPath && b.Line == info.Line)) != null && !existing.IsDeleted)
                    {
                        continue;
                    }

                    if (existing != null)
                    {
                        existing.IsDeleted = false;
                        existing.IsEnabled = info.IsEnabled;
                        existing.Exp       = info.Exp;
                    }
                    else
                    {
                        if (m_BreakPointList == null)
                        {
                            m_BreakPointList = new List <BreakPointInfo>();
                        }
                        m_BreakPointList.Add(info);
                    }

                    if (ChangeBreakPointEvent != null)
                    {
                        ChangeBreakPointEvent(this, new BreakPointArgs(info.FileFullPath, info.Line, info.Exp, info.IsDeleted, info.IsEnabled));
                    }
                }
            }
        }
Пример #3
0
        internal void SetBreakPointInfo(string filefullpath, int line, Boolean bDeleted, Boolean bEnabled)
        {
            if (!m_bAccessable)
            {
                return;
            }
            BreakPointInfo cbinfo = m_BreakPointList.Find(delegate(BreakPointInfo info)
            {
                return(info.FileFullPath == filefullpath && info.Line == line);
            });
            string exp = string.Empty;

            if (cbinfo != null)
            {
                bool chn = (cbinfo.IsDeleted != bDeleted || cbinfo.IsEnabled != bEnabled);
                cbinfo.IsDeleted = bDeleted;
                cbinfo.IsEnabled = bEnabled;
                exp = cbinfo.Exp;
                // TMP
                if (chn && PluginMain.debugManager.FlashInterface.isDebuggerStarted)
                {
                    PluginMain.debugManager.FlashInterface.UpdateBreakpoints(this.BreakPoints);
                }
            }
            else if (!bDeleted)
            {
                m_BreakPointList.Add(new BreakPointInfo(filefullpath, line, exp, bDeleted, bEnabled));
                // TMP
                if (PluginMain.debugManager.FlashInterface.isDebuggerStarted)
                {
                    PluginMain.debugManager.FlashInterface.UpdateBreakpoints(this.BreakPoints);
                }
            }
            if (ChangeBreakPointEvent != null)
            {
                ChangeBreakPointEvent(this, new BreakPointArgs(filefullpath, line, exp, bDeleted, bEnabled));
            }
        }
Пример #4
0
 public void InitBreakPoints()
 {
     foreach (ITabbedDocument doc in PluginBase.MainForm.Documents)
     {
         if (Path.GetExtension(doc.SciControl.FileName) == ".as" || Path.GetExtension(doc.SciControl.FileName) == ".mxml")
         {
             List <int>     lines  = GetMarkers(doc.SciControl, ScintillaHelper.markerBPEnabled);
             BreakPointInfo cbinfo = m_BreakPointList.Find(delegate(BreakPointInfo info)
             {
                 return(info.FileFullPath.Equals(doc.FileName, StringComparison.OrdinalIgnoreCase));
             });
             string exp = string.Empty;
             if (cbinfo != null)
             {
                 exp = cbinfo.Exp;
                 m_BreakPointList.Remove(cbinfo);
             }
             foreach (int i in lines)
             {
                 m_BreakPointList.Add(new BreakPointInfo(doc.SciControl.FileName, i, exp, false, true));
             }
         }
     }
 }
Пример #5
0
        public void Save(string filePath)
        {
            if (m_Project != null)
            {
                List<BreakPointInfo> bpSaveList = new List<BreakPointInfo>();
                foreach (BreakPointInfo info in m_BreakPointList)
                {
                    if (!info.IsDeleted)
                    {
                        BreakPointInfo infoCopy;

                        if (!Path.IsPathRooted(info.FileFullPath))
                            infoCopy = info;
                        else
                            infoCopy = new BreakPointInfo(m_Project.GetRelativePath(info.FileFullPath),
                                info.Line, info.Exp, info.IsDeleted, info.IsEnabled);
                        
                        bpSaveList.Add(infoCopy);
                    }
                }
                Util.SerializeXML<List<BreakPointInfo>>.SaveFile(filePath, bpSaveList);
            }
        }
Пример #6
0
 public void SetTemporaryBreakPoint(string filefullpath, int line)
 {
     ClearTemporaryBreakPoint();
     m_TemporaryBreakPointInfo = new BreakPointInfo(filefullpath, line, string.Empty, false, true);
     List<BreakPointInfo> bpList = new List<BreakPointInfo>(new BreakPointInfo[] { m_TemporaryBreakPointInfo });
     PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
 }
Пример #7
0
 public void ClearTemporaryBreakPoint()
 {
     if (m_TemporaryBreakPointInfo != null)
     {
         m_TemporaryBreakPointInfo.IsDeleted = true;
         List<BreakPointInfo> bpList = new List<BreakPointInfo>(new BreakPointInfo[] { m_TemporaryBreakPointInfo });
         PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
         m_TemporaryBreakPointInfo = null;
     }
 }
Пример #8
0
        public Boolean ShouldBreak(SourceFile file, int line, Frame frame)
        {
            String localPath = PluginMain.debugManager.GetLocalPath(file);
            if (localPath == null)
            {
                return false;
            }
            if (m_TemporaryBreakPointInfo != null)
            {
                if (m_TemporaryBreakPointInfo.FileFullPath == localPath && m_TemporaryBreakPointInfo.Line == (line - 1))
                {
                    m_TemporaryBreakPointInfo.IsDeleted = true;
                    List<BreakPointInfo> bpList = new List<BreakPointInfo>();
                    bpList.Add(m_TemporaryBreakPointInfo);
                    PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
                    m_TemporaryBreakPointInfo = null;
                    return true;
                }
            }
            int index = GetBreakPointIndex(localPath, line - 1);
            if (index >= 0)
            {
                BreakPointInfo bpInfo = m_BreakPointList[index];
                if (bpInfo.ParsedExpression != null)
                {
                    try
                    {
                        if (frame == null)
                        {
                            // take currently active worker and frame
                            frame = PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame];
                        }
                        var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, frame);
                        var val = bpInfo.ParsedExpression.evaluate(ctx);
                        if (val is java.lang.Boolean)
                        {
                            return ((java.lang.Boolean)val).booleanValue();
                        }
                        if (val is Value)
                        {
                            return ECMA.toBoolean(((Value)val));
                        }
                        if (val is Variable)
                        {
                            return ECMA.toBoolean(((Variable)val).getValue());
                        }
                        throw new NotImplementedException(val.toString());
                    }
                    catch (/*Expression*/Exception e)
                    {
                        TraceManager.AddAsync("[Problem in breakpoint: "+e.ToString()+"]", 4);
                        ErrorManager.ShowError(e);
                        return true;
                    }
                }
                else return true;
            }

            return true;
        }
Пример #9
0
        public Boolean ShouldBreak(SourceFile file, int line, Frame frame)
        {
            String localPath = PluginMain.debugManager.GetLocalPath(file);

            if (localPath == null)
            {
                return(false);
            }
            if (m_TemporaryBreakPointInfo != null)
            {
                if (m_TemporaryBreakPointInfo.FileFullPath == localPath && m_TemporaryBreakPointInfo.Line == (line - 1))
                {
                    m_TemporaryBreakPointInfo.IsDeleted = true;
                    List <BreakPointInfo> bpList = new List <BreakPointInfo>();
                    bpList.Add(m_TemporaryBreakPointInfo);
                    PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
                    m_TemporaryBreakPointInfo = null;
                    return(true);
                }
            }
            int index = GetBreakPointIndex(localPath, line - 1);

            if (index >= 0)
            {
                BreakPointInfo bpInfo = m_BreakPointList[index];
                if (bpInfo.ParsedExpression != null)
                {
                    try
                    {
                        if (frame == null)
                        {
                            // take currently active worker and frame
                            frame = PluginMain.debugManager.FlashInterface.GetFrames()[PluginMain.debugManager.CurrentFrame];
                        }
                        var ctx = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session, frame);
                        var val = bpInfo.ParsedExpression.evaluate(ctx);
                        if (val is java.lang.Boolean)
                        {
                            return(((java.lang.Boolean)val).booleanValue());
                        }
                        if (val is Value)
                        {
                            return(ECMA.toBoolean(((Value)val)));
                        }
                        if (val is Variable)
                        {
                            return(ECMA.toBoolean(((Variable)val).getValue()));
                        }
                        throw new NotImplementedException(val.toString());
                    }
                    catch (/*Expression*/ Exception e)
                    {
                        TraceManager.AddAsync("[Problem in breakpoint: " + e.ToString() + "]", 4);
                        ErrorManager.ShowError(e);
                        return(true);
                    }
                }
                else
                {
                    return(true);
                }
            }

            return(true);
        }
Пример #10
0
		public Boolean ShouldBreak(SourceFile file, int line)
		{
			String localPath = PluginMain.debugManager.GetLocalPath(file);
			if (localPath == null)
			{
				return false;
			}
			if (m_TemporaryBreakPointInfo != null)
			{
				if (m_TemporaryBreakPointInfo.FileFullPath == localPath && m_TemporaryBreakPointInfo.Line == (line - 1))
				{
					m_TemporaryBreakPointInfo.IsDeleted = true;
					List<BreakPointInfo> bpList = new List<BreakPointInfo>();
					bpList.Add(m_TemporaryBreakPointInfo);
					PluginMain.debugManager.FlashInterface.UpdateBreakpoints(bpList);
					m_TemporaryBreakPointInfo = null;
					return true;
				}
			}
			int index = GetBreakPointIndex(localPath, line - 1);
			if (index >= 0)
			{
				BreakPointInfo bpInfo = m_BreakPointList[index];
				if (bpInfo.ParsedExpression != null)
				{
					ExpressionContext context = new ExpressionContext(PluginMain.debugManager.FlashInterface.Session);
					try
					{
						object val = bpInfo.ParsedExpression.evaluate(context);
						if (val is Boolean)
						{
							return (Boolean)val;
						}
						else if (val is Int32)
						{
							return (Int32)val != 0;
						}
						else if (val is Variable)
						{
							return ((Variable)val).getValue().ValueAsObject != null;
						}
					}
					catch (ExpressionException e)
					{
                        ErrorManager.ShowError(e);
						return true;
					}
				}
				else return true;
			}

			return true;
		}