Beispiel #1
0
        static public void RemoveAllBreakpoints()
        {
            var document = Npp.GetCurrentDocument();

            foreach (var key in breakpoints.Keys)
            {
                document.DeleteMarker(breakpoints[key]);
                if (IsRunning)
                {
                    DebuggerServer.RemoveBreakpoint(key);
                }
            }
            breakpoints.Clear();

            foreach (string file in Npp.Editor.GetOpenFilesSafe())
            {
                string dbgInfo = CSScriptHelper.GetDbgInfoFile(file, false);
                if (File.Exists(dbgInfo))
                {
                    File.Delete(dbgInfo);
                }
            }

            if (OnBreakpointChanged != null)
            {
                OnBreakpointChanged();
            }
        }
Beispiel #2
0
        static public void SaveBreakPointsFor(string file)
        {
            string expectedkeyPrefix = file + "|";

            string[] fileBreakpoints = breakpoints.Keys.Where(x => x.StartsWith(expectedkeyPrefix, StringComparison.OrdinalIgnoreCase)).ToArray();

            if (fileBreakpoints.Any())
            {
                try
                {
                    string   dbg    = CSScriptHelper.GetDbgInfoFile(file, true);
                    string[] header = new[] { "#script: " + file };
                    File.WriteAllLines(dbg, header.Concat(fileBreakpoints).ToArray());
                }
                catch { }
            }
            else
            {
                string dbg = CSScriptHelper.GetDbgInfoFile(file);
                if (File.Exists(dbg))
                {
                    try
                    {
                        File.Delete(dbg);
                    }
                    catch { }
                }
            }
        }
Beispiel #3
0
        public static void OnCurrentFileChanged()
        {
            string file     = Npp.Editor.GetCurrentFilePath();
            var    document = Npp.GetCurrentDocument();

            string dbg = CSScriptHelper.GetDbgInfoFile(file);

            if (File.Exists(dbg))
            {
                PlaceBreakPointsForCurrentTab();
            }

            if (!IsRunning)
            {
                OnNextFileOpenComplete = null;
                document.ClearIndicator(INDICATOR_DEBUGSTEP, 0, -1); //clear all document
            }
            else
            {
                if (OnNextFileOpenComplete != null)
                {
                    OnNextFileOpenComplete();
                    OnNextFileOpenComplete = null;
                }
            }

            if (OnBreakpointChanged != null)
            {
                OnBreakpointChanged();
            }
        }
Beispiel #4
0
        static public void LoadBreakPointsFor(string file)
        {
            string expectedkeyPrefix = file + "|";

            string[] fileBreakpoints = breakpoints.Keys.Where(x => x.StartsWith(expectedkeyPrefix, StringComparison.OrdinalIgnoreCase)).ToArray();

            foreach (var key in fileBreakpoints)
            {
                breakpoints.Remove(key); //clear old if any
            }
            try
            {
                string dbg = CSScriptHelper.GetDbgInfoFile(file);
                if (File.Exists(dbg))
                {
                    string[] lines = File.ReadAllLines(dbg);
                    foreach (var key in lines.Skip(1))
                    {
                        breakpoints.Add(key, IntPtr.Zero);
                    }
                }
            }
            catch { }
        }