namespace SRDebugger { using System; using Services; using SRF; public sealed class InfoEntry { public string Title { get; set; } public object Value { get { try { return _valueGetter(); } catch (Exception e) { return "Error ({0})".Fmt(e.GetType().Name); } } } public bool IsPrivate { get; private set; } private Func _valueGetter; /// /// Create an instance with a getter function for the value. /// /// Name to display to the user. /// Getter method to acquire the latest value. /// If true, will be excluded from the bug reporter system. /// The created object. public static InfoEntry Create(string name, Func getter, bool isPrivate = false) { return new InfoEntry { Title = name, _valueGetter = getter, IsPrivate = isPrivate }; } /// /// Create an instance with a fixed value. /// /// Name to display to the user. /// The value of the entry. /// If true, will be excluded from the bug reporter system. /// The created object. public static InfoEntry Create(string name, object value, bool isPrivate = false) { return new InfoEntry { Title = name, _valueGetter = () => value, IsPrivate = isPrivate }; } } } namespace SRDebugger.Services { using System.Collections.Generic; public interface ISystemInformationService { /// /// Get an IEnumerable with the available data categories for this system /// IEnumerable GetCategories(); /// /// Get a list of information for a category /// /// Category name to fetch (get a list of these from GetCategories()) /// IList GetInfo(string category); /// /// Add a piece of system information. /// /// /// void Add(InfoEntry info, string category = "Default"); /// /// Generate a report from all available system data (useful for sending with bug reports) /// /// Set to true to include identifying private information (usually you don't want this) /// The generated report Dictionary> CreateReport(bool includePrivate = false); } }