aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Core/ExtensionMethods
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-02 16:37:25 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-02 16:37:25 +0200
commita2d959a7777bf2387d0f50dbc1ecf69f53e2253d (patch)
tree8c6367189294d96ae074f386cdb4139dfeacb84a /Software/Visual_Studio/Tango.Core/ExtensionMethods
parentae614a63f593122cd28c644625db179f298dd640 (diff)
downloadTango-a2d959a7777bf2387d0f50dbc1ecf69f53e2253d.tar.gz
Tango-a2d959a7777bf2387d0f50dbc1ecf69f53e2253d.zip
Implemented machine studio storage module. firmware upgrade version/validate/activate.
Implemented firmware package generator utility.
Diffstat (limited to 'Software/Visual_Studio/Tango.Core/ExtensionMethods')
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs21
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs1
2 files changed, 22 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs
index fdb041ea9..86434cdc4 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ExceptionExtensions.cs
@@ -29,5 +29,26 @@ public static class ExceptionExtensions
return stringBuilder.ToString();
}
+
+ /// <summary>
+ /// Flattens the exception message in case it is an aggregated exception.
+ /// </summary>
+ /// <param name="exception">The exception.</param>
+ /// <returns></returns>
+ public static String FlattenMessage(this Exception exception)
+ {
+ String message = exception.Message;
+
+ if (exception is AggregateException)
+ {
+ try
+ {
+ message += Environment.NewLine + String.Join(Environment.NewLine, (exception as AggregateException).InnerExceptions.Select(x => x.Message));
+ }
+ catch { }
+ }
+
+ return message;
+ }
}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs
index cff4e6a3a..0ce3e8369 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/ObjectExtensions.cs
@@ -132,6 +132,7 @@ public static class ObjectExtensions
{
var settings = new JsonSerializerSettings();
settings.Converters.Add(new StringEnumConverter { CamelCaseText = false });
+ settings.ContractResolver = new ProtobufContractResolver();
return settings;
});