// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.ILAst;
using Mono.Cecil;
namespace ICSharpCode.ILSpy.Debugger
{
///
/// Contains the data important for debugger from the main application.
///
public static class DebugInformation
{
static DecompiledLanguages language;
///
/// Gets or sets the decompiled language.
///
public static DecompiledLanguages Language {
get { return language; }
set {
var oldLanguage = language;
if (value != language) {
language = value;
OnLanguageChanged(new LanguageEventArgs(oldLanguage, language));
}
}
}
///
/// List of loaded assemblies.
///
public static IEnumerable LoadedAssemblies { get; set; }
///
/// Gets or sets the current code mappings.
///
public static Dictionary> CodeMappings { get; set; }
///
/// Gets or sets the local variables of the current decompiled type, method, etc.
///
public static ConcurrentDictionary> LocalVariables { get; set; }
///
/// Gets or sets the old code mappings.
///
public static Dictionary> OldCodeMappings { get; set; }
///
/// Gets or sets the MembeReference that was decompiled (a TypeDefinition, MethodDefinition, etc)
///
public static Dictionary DecompiledMemberReferences { get; set; }
///
/// Gets or sets the current token, IL offset and member reference. Used for step in/out.
///
public static Tuple DebugStepInformation { get; set; }
///
/// Gets or sets whether the debugger is loaded.
///
public static bool IsDebuggerLoaded { get; set; }
///
/// Occures when the language is changed.
///
public static event EventHandler LanguageChanged;
private static void OnLanguageChanged(LanguageEventArgs e)
{
var handler = LanguageChanged;
if (handler != null) {
handler(null, e);
}
}
}
public class LanguageEventArgs : EventArgs
{
public DecompiledLanguages OldLanguage { get; private set; }
public DecompiledLanguages NewLanguage { get; private set; }
public LanguageEventArgs(DecompiledLanguages oldLanguage, DecompiledLanguages newLanguage)
{
this.OldLanguage = oldLanguage;
this.NewLanguage = newLanguage;
}
}
}