aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-05 12:29:15 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-05 12:29:15 +0200
commitba49db54c7b94315a55bed9ae10fe06e7a65cd33 (patch)
treeabc2b166a77dba28e0ac0707a07f4af4f5e7bb8f /Software/Visual_Studio
parent99ce3aa122c0d8f4703e0d5c43776f2658ac5392 (diff)
downloadTango-ba49db54c7b94315a55bed9ae10fe06e7a65cd33.tar.gz
Tango-ba49db54c7b94315a55bed9ae10fe06e7a65cd33.zip
Improved stubexec CLI !
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/Dotfuscator/Dotfuscated/Map.xml398
-rw-r--r--Software/Visual_Studio/Dotfuscator/Dotfuscated/stubexec.exebin0 -> 1788928 bytes
-rw-r--r--Software/Visual_Studio/Dotfuscator/stubexec.xml44
-rw-r--r--Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs53
4 files changed, 484 insertions, 11 deletions
diff --git a/Software/Visual_Studio/Dotfuscator/Dotfuscated/Map.xml b/Software/Visual_Studio/Dotfuscator/Dotfuscated/Map.xml
new file mode 100644
index 000000000..58e5c8453
--- /dev/null
+++ b/Software/Visual_Studio/Dotfuscator/Dotfuscated/Map.xml
@@ -0,0 +1,398 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE dotfuscatorMap SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscatorMap_v1.2.dtd">
+<dotfuscatorMap version="1.1">
+ <header>
+ <timestamp>2018-12-05T12:12:10</timestamp>
+ <product version="5.36.0.7050" user="Roy Ben-Shabat" serial="254969-391">Dotfuscator Community Edition</product>
+ </header>
+ <mapping>
+ <module>
+ <name>stubexec.exe</name>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.cctor</name>
+ </method>
+ </methodlist>
+ <type>
+ <name>Costura.AssemblyLoader</name>
+ <newname>b</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.cctor</name>
+ </method>
+ <method>
+ <signature>void()</signature>
+ <name>Attach</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>void(System.IO.Stream, System.IO.Stream)</signature>
+ <name>CopyTo</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>string(System.Globalization.CultureInfo)</signature>
+ <name>CultureToString</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>System.IO.Stream(System.Collections.Generic.Dictionary`2&lt;string,string&gt;, string)</signature>
+ <name>LoadStream</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>System.IO.Stream(string)</signature>
+ <name>LoadStream</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>System.Reflection.Assembly(System.Reflection.AssemblyName)</signature>
+ <name>ReadExistingAssembly</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>System.Reflection.Assembly(System.Collections.Generic.Dictionary`2&lt;string,string&gt;, System.Collections.Generic.Dictionary`2&lt;string,string&gt;, System.Reflection.AssemblyName)</signature>
+ <name>ReadFromEmbeddedResources</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>unsigned int8[](System.IO.Stream)</signature>
+ <name>ReadStream</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>System.Reflection.Assembly(object, System.ResolveEventArgs)</signature>
+ <name>ResolveAssembly</name>
+ <newname>a</newname>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>System.Collections.Generic.Dictionary`2&lt;string,string&gt;</signature>
+ <name>assemblyNames</name>
+ <newname>c</newname>
+ </field>
+ <field>
+ <signature>int32</signature>
+ <name>isAttached</name>
+ <newname>e</newname>
+ </field>
+ <field>
+ <signature>System.Collections.Generic.Dictionary`2&lt;string,bool&gt;</signature>
+ <name>nullCache</name>
+ <newname>b</newname>
+ </field>
+ <field>
+ <signature>object</signature>
+ <name>nullCacheLock</name>
+ <newname>a</newname>
+ </field>
+ <field>
+ <signature>System.Collections.Generic.Dictionary`2&lt;string,string&gt;</signature>
+ <name>symbolNames</name>
+ <newname>d</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>ProcessedByFody</name>
+ <newname>c</newname>
+ <methodlist />
+ <fieldlist>
+ <field>
+ <signature>string</signature>
+ <name>Costura</name>
+ <newname>b</newname>
+ </field>
+ <field>
+ <signature>string</signature>
+ <name>FodyVersion</name>
+ <newname>a</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program</name>
+ <newname>a</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ <method>
+ <signature>void()</signature>
+ <name>ExitError</name>
+ <newname>c</newname>
+ </method>
+ <method>
+ <signature>void()</signature>
+ <name>ExitSuccess</name>
+ <newname>b</newname>
+ </method>
+ <method>
+ <signature>System.Collections.Generic.List`1&lt;System.Type&gt;()</signature>
+ <name>GetAvailableRequestStubs</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>void(string[])</signature>
+ <name>Main</name>
+ <newname>b</newname>
+ </method>
+ <method>
+ <signature>void(string)</signature>
+ <name>PrintError</name>
+ <newname>a</newname>
+ </method>
+ <method>
+ <signature>void()</signature>
+ <name>PrintHelp</name>
+ <newname>d</newname>
+ </method>
+ <method>
+ <signature>void(string[])</signature>
+ <name>Run</name>
+ <newname>a</newname>
+ </method>
+ </methodlist>
+ <fieldlist />
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program/&lt;&gt;c</name>
+ <newname>a/&lt;&gt;c</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.cctor</name>
+ </method>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ <method>
+ <signature>bool(System.Type)</signature>
+ <name>&lt;GetAvailableRequestStubs&gt;b__6_0</name>
+ <newname>a</newname>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>Tango.Stubs.CLI.Program/&lt;&gt;c</signature>
+ <name>&lt;&gt;9</name>
+ </field>
+ <field>
+ <signature>System.Func`2&lt;System.Type,bool&gt;</signature>
+ <name>&lt;&gt;9__6_0</name>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_0</name>
+ <newname>a/a</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ <method>
+ <signature>bool(System.Type)</signature>
+ <name>&lt;Run&gt;b__0</name>
+ <newname>c</newname>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>string</signature>
+ <name>stubName</name>
+ <newname>a</newname>
+ </field>
+ <field>
+ <signature>System.Type</signature>
+ <name>stubType</name>
+ <newname>b</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_1</name>
+ <newname>a/b</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_0</signature>
+ <name>CS$&lt;&gt;8__locals1</name>
+ <newname>b</newname>
+ </field>
+ <field>
+ <signature>unsigned int8[]</signature>
+ <name>requestData</name>
+ <newname>a</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_2</name>
+ <newname>a/c</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_1</signature>
+ <name>CS$&lt;&gt;8__locals2</name>
+ <newname>b</newname>
+ </field>
+ <field>
+ <signature>Tango.Transport.Adapters.UsbTransportAdapter</signature>
+ <name>adapter</name>
+ <newname>a</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_3</name>
+ <newname>a/d</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ <method>
+ <signature>void()</signature>
+ <name>&lt;Run&gt;b__1</name>
+ <newname>c</newname>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_2</signature>
+ <name>CS$&lt;&gt;8__locals3</name>
+ <newname>b</newname>
+ </field>
+ <field>
+ <signature>bool</signature>
+ <name>done</name>
+ <newname>a</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ <type>
+ <name>Tango.Stubs.CLI.Program/&lt;&gt;c__DisplayClass1_4</name>
+ <newname>a/e</newname>
+ <methodlist>
+ <method>
+ <signature>void()</signature>
+ <name>.ctor</name>
+ </method>
+ <method>
+ <signature>void(object, unsigned int8[])</signature>
+ <name>&lt;Run&gt;b__2</name>
+ <newname>b</newname>
+ </method>
+ </methodlist>
+ <fieldlist>
+ <field>
+ <signature>Tango.PMR.Common.MessageContainer</signature>
+ <name>responseContainer</name>
+ <newname>a</newname>
+ </field>
+ </fieldlist>
+ <propertylist />
+ <eventlist />
+ </type>
+ </module>
+ </mapping>
+ <statistics>
+ <statisticline>
+ <description>Total Classes</description>
+ <statistic>10</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Methods</description>
+ <statistic>30</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Fields</description>
+ <statistic>18</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Properties</description>
+ <statistic>0</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Events</description>
+ <statistic>0</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Classes Renamed</description>
+ <statistic>9</statistic>
+ <statistic>90.00 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Methods Renamed</description>
+ <statistic>20</statistic>
+ <statistic>66.67 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Fields Renamed</description>
+ <statistic>16</statistic>
+ <statistic>88.89 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Properties Renamed</description>
+ <statistic>0</statistic>
+ <statistic>0.00 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Total Events Renamed</description>
+ <statistic>0</statistic>
+ <statistic>0.00 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Methods Renamed to 'a'</description>
+ <statistic>13</statistic>
+ <statistic>43.33 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Methods Renamed to 'b'</description>
+ <statistic>3</statistic>
+ <statistic>10.00 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Methods Renamed to 'c'</description>
+ <statistic>3</statistic>
+ <statistic>10.00 %</statistic>
+ </statisticline>
+ <statisticline>
+ <description>Methods Renamed to 'd'</description>
+ <statistic>1</statistic>
+ <statistic>3.33 %</statistic>
+ </statisticline>
+ </statistics>
+</dotfuscatorMap> \ No newline at end of file
diff --git a/Software/Visual_Studio/Dotfuscator/Dotfuscated/stubexec.exe b/Software/Visual_Studio/Dotfuscator/Dotfuscated/stubexec.exe
new file mode 100644
index 000000000..831291355
--- /dev/null
+++ b/Software/Visual_Studio/Dotfuscator/Dotfuscated/stubexec.exe
Binary files differ
diff --git a/Software/Visual_Studio/Dotfuscator/stubexec.xml b/Software/Visual_Studio/Dotfuscator/stubexec.xml
new file mode 100644
index 000000000..ec80ed4da
--- /dev/null
+++ b/Software/Visual_Studio/Dotfuscator/stubexec.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8" standalone="no"?>
+<!DOCTYPE dotfuscator SYSTEM "http://www.preemptive.com/dotfuscator/dtd/dotfuscator_v2.4.dtd">
+<dotfuscator version="2.3">
+ <input>
+ <loadpaths />
+ <asmlist>
+ <inputassembly refid="6add8a88-e4da-4ff3-8ba5-76688e68e568">
+ <option>honoroas</option>
+ <option>stripoa</option>
+ <option>transformxaml</option>
+ <file dir="D:\Development\Tango\Software\Visual_Studio\Build\Utilities\Release" name="stubexec.exe" />
+ </inputassembly>
+ </asmlist>
+ </input>
+ <output>
+ <file dir="${configdir}\Dotfuscated" />
+ </output>
+ <renaming>
+ <option>xmlserialization</option>
+ <mapping>
+ <mapoutput overwrite="false">
+ <file dir="${configdir}\Dotfuscated" name="Map.xml" />
+ </mapoutput>
+ </mapping>
+ <referencerulelist>
+ <referencerule rulekey="{6655B10A-FD58-462d-8D4F-5B1316DFF0FF}" />
+ <referencerule rulekey="{7D9C8B02-2383-420f-8740-A9760394C2C1}" />
+ <referencerule rulekey="{229FD6F8-5BCC-427b-8F72-A7A413ECDF1A}" />
+ <referencerule rulekey="{2B7E7C8C-A39A-4db8-9DFC-6AFD38509061}" />
+ <referencerule rulekey="{494EA3BA-B947-44B5-BEE8-A11CC85AAF9B}" />
+ <referencerule rulekey="{89769974-93E9-4e71-8D92-BE70E855ACFC}" />
+ <referencerule rulekey="{4D81E604-A545-4631-8B6D-C3735F793F80}" />
+ <referencerule rulekey="{62bd3899-7d53-4336-8ca2-4e5dbae187d5}" />
+ </referencerulelist>
+ </renaming>
+ <sos mergeruntime="true">
+ <option>version:v4</option>
+ <option>sendanalytics</option>
+ <option>dontsendtamper</option>
+ </sos>
+ <smartobfuscation>
+ <smartobfuscationreport verbosity="all" overwrite="false" />
+ </smartobfuscation>
+</dotfuscator> \ No newline at end of file
diff --git a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs
index 0e8a530a2..a98072458 100644
--- a/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs
+++ b/Software/Visual_Studio/Utilities/Tango.Stubs.CLI/Program.cs
@@ -33,7 +33,7 @@ namespace Tango.Stubs.CLI
String comPort = args[0].ToUpper();
String stubName = args[1];
- var stubType = GetAvailableRequestStubs().SingleOrDefault(x => x.Name.ToLower() == stubName.ToLower() || x.Name.Replace("Request", "").ToLower() == stubName.ToLower());
+ var stubType = GetAvailableRequestResponseStubs().SingleOrDefault(x => x.Name.ToLower() == stubName.ToLower() || x.Name.Replace("Request", "").ToLower() == stubName.ToLower());
if (stubType == null)
{
PrintError("Invalid stub '" + stubName + "'.");
@@ -50,7 +50,7 @@ namespace Tango.Stubs.CLI
{
MessageContainer container = new MessageContainer();
container.Token = Guid.NewGuid().ToString();
- container.Type = MessageFactory.ParseMessageType(stubType.Name);
+ container.Type = ParseMessageType(stubType.Name);
Object request = Activator.CreateInstance(stubType);
@@ -96,21 +96,23 @@ namespace Tango.Stubs.CLI
adapter.DataAvailable += (sender, data) =>
{
- responseContainer = MessageFactory.ParseContainer(data);
+ responseContainer = ParseContainer(data);
};
while (responseContainer == null)
{
Thread.Sleep(10);
- if (DateTime.Now > startTime.AddSeconds(2))
+ if (DateTime.Now > startTime.AddSeconds(5))
{
- PrintError("Response has failed to arrive after 2 seconds.");
+ PrintError("Response has failed to arrive after 5 seconds.");
}
}
Console.WriteLine("Response Received:");
- IMessage message = MessageFactory.ExtractMessageFromContainer(responseContainer);
+ var type = typeof(MessageFactory).Assembly.GetType("Tango.PMR.Stubs." + responseContainer.Type.ToString());
+ MessageParser parser = type.GetProperty("Parser").GetValue(container) as MessageParser;
+ IMessage message = parser.ParseFrom(container.Data);
Console.WriteLine(JsonConvert.SerializeObject(message, Formatting.Indented));
done = true;
});
@@ -144,15 +146,20 @@ namespace Tango.Stubs.CLI
Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName)));
Console.WriteLine();
- Console.WriteLine("Available Request Stubs:");
+ Console.WriteLine("Available Stubs:");
int stubCount = 1;
- foreach (var stub in GetAvailableRequestStubs())
+ foreach (var stub in GetAvailableRequestResponseStubs())
{
Console.WriteLine();
- Console.WriteLine((stubCount++) + ". " + stub.Name + ":");
+
+ if ((stubCount++) % 2 != 0)
+ {
+ Console.WriteLine("-----------------------------------------------------------------------------------");
+ }
+ Console.WriteLine(stub.Name + ":");
int paramCount = 1;
@@ -183,9 +190,33 @@ namespace Tango.Stubs.CLI
Environment.Exit(0);
}
- private static List<Type> GetAvailableRequestStubs()
+ private static List<Type> GetAvailableRequestResponseStubs()
+ {
+ return typeof(MessageFactory).Assembly.GetTypes().Where(x => x.Namespace != null && x.Namespace.Contains("Stubs") && (x.Name.Contains("Request") || x.Name.Contains("Response")) && !x.Name.Contains("Reflection")).ToList();
+ }
+
+ public static MessageType ParseMessageType(String text)
+ {
+ MessageType t;
+ if (Enum.TryParse<MessageType>(text, true, out t))
+ {
+ return t;
+ }
+ else
+ {
+ throw new InvalidCastException("Message type " + text + " was not found on PMR MessageType enumeration!");
+ }
+ }
+
+ /// <summary>
+ /// Parses a message container from the specified byte array.
+ /// </summary>
+ /// <param name="data">The data.</param>
+ /// <returns></returns>
+ public static MessageContainer ParseContainer(byte[] data)
{
- return typeof(MessageFactory).Assembly.GetTypes().Where(x => x.Namespace != null && x.Namespace.Contains("Stubs") && x.Name.Contains("Request") && !x.Name.Contains("Reflection")).ToList();
+ MessageContainer container = MessageContainer.Parser.ParseFrom(data);
+ return container;
}
}
}