public Manager(Exception exception) { Translate = Translate_DefaultImplementation; var explorer = new ObjectExplorer(); Tree = explorer.ExploreException(exception); }
public Manager AddData(TranslatableElement key, object value) { System.Diagnostics.Debug.Assert(Tree != null, "The property 'Tree' is not supposed to be null"); // Insert a new field right before the exception list var explorer = new ObjectExplorer(); var element = explorer.ExploreObject(key, value); Tree.Children.Insert(GetFirstExceptionIndex(), element); return(this); }
public BaseException AddData(string key, object obj) { if (obj == null) { Data[key] = obj; return(this); } var type = obj.GetType(); if (ObjectExplorer.IsDirectlyInterpretable(type)) { Data[key] = obj; } else { ObjectData[key] = obj; } return(this); }
private bool CheckValue(object value) { if (value == null) { // The value is not supposed to be NULL; return(false); } var type = value.GetType(); if (ObjectExplorer.IsDirectlyInterpretable(type)) { // it can only be directly converted using .ToString() return(true); } if (type == typeof(TranslatableElement)) { // or a translation element return(true); } return(false); }
private bool CheckParameters(object[] parameters) { if (parameters == null) { // Assign an empty list of parameters (e.g. new oject[]{}), instead of null return(false); } foreach (var parameter in parameters) { if (parameter == null) { // OK: parameter can be null continue; } if (!ObjectExplorer.IsDirectlyInterpretable(parameter.GetType())) { // Use only simple objects as parameters (e.g. strings, ints etc...). They must be serializable! return(false); } } return(true); }