示例#1
0
        public static void Write(FileInfo file)
        {
            var state = new DebuggerState
            {
                WorkingDirectory     = WorkingDirectory,
                Arguments            = Arguments,
                EnvironmentVariables = EnvironmentVariables,
                Watches     = Watches,
                NextWatchId = _nextWatchId,
                Breakpoints = Breakpoints.ToDictionary(x => x.Key,
                                                       x => Tuple.Create(x.Value, BreakEvents.Contains(x.Value))),
                NextBreakpointId = _nextBreakpointId,
                Catchpoints      = BreakEvents.GetCatchpoints(),
                Aliases          = Aliases,
            };

            try
            {
                using (var stream = file.Open(FileMode.Create, FileAccess.Write))
                    new BinaryFormatter().Serialize(stream, state);
            }
            catch (Exception ex)
            {
                Log.Error("Could not write database file '{0}':", file);
                Log.Error(ex.ToString());
            }
        }