summaryrefslogtreecommitdiff
path: root/BCT/BytecodeTranslator/Program.cs
diff options
context:
space:
mode:
authorGravatar t-espave <unknown>2011-07-25 16:16:22 -0700
committerGravatar t-espave <unknown>2011-07-25 16:16:22 -0700
commit92bd1a620784b897b5b7e731aca7f30c246c44f2 (patch)
tree0af0a6baf61c24e6dc549d2270a82180df268715 /BCT/BytecodeTranslator/Program.cs
parentc1b40ee54e8a1f2c458451563372cfb456398f22 (diff)
adding checks and code injection for phone feedback checking
Diffstat (limited to 'BCT/BytecodeTranslator/Program.cs')
-rw-r--r--BCT/BytecodeTranslator/Program.cs33
1 files changed, 27 insertions, 6 deletions
diff --git a/BCT/BytecodeTranslator/Program.cs b/BCT/BytecodeTranslator/Program.cs
index 4851de9b..3f230dd9 100644
--- a/BCT/BytecodeTranslator/Program.cs
+++ b/BCT/BytecodeTranslator/Program.cs
@@ -46,6 +46,12 @@ namespace BytecodeTranslator {
[OptionDescription("Phone translation controls configuration")]
public string phoneControls = null;
+ [OptionDescription("Add phone navigation code on translation. Requires /phoneControls. Default false", ShortForm = "wpnav")]
+ public bool phoneNavigationCode= false;
+
+ [OptionDescription("Add phone feedback code on translation. Requires /phoneControls. Default false", ShortForm = "wpfb")]
+ public bool phoneFeedbackCode = false;
+
}
public class BCT {
@@ -96,7 +102,13 @@ namespace BytecodeTranslator {
return 1;
}
- result = TranslateAssembly(assemblyNames, heap, options.libpaths, options.wholeProgram, options.stub, options.phoneControls);
+ if ((options.phoneFeedbackCode || options.phoneNavigationCode) && (options.phoneControls == null || options.phoneControls == "")) {
+ Console.WriteLine("Options /phoneNavigationCode and /phoneFeedbackCode need /phoneControls option set.");
+ return 1;
+ }
+
+ result = TranslateAssembly(assemblyNames, heap, options.libpaths, options.wholeProgram, options.stub,
+ options.phoneControls, options.phoneNavigationCode, options.phoneFeedbackCode);
} catch (Exception e) { // swallow everything and just return an error code
Console.WriteLine("The byte-code translator failed: {0}", e.Message);
@@ -106,7 +118,8 @@ namespace BytecodeTranslator {
return result;
}
- public static int TranslateAssembly(List<string> assemblyNames, HeapFactory heapFactory, List<string>/*?*/ libPaths, bool wholeProgram, List<string>/*?*/ stubAssemblies, string phoneControlsConfigFile) {
+ public static int TranslateAssembly(List<string> assemblyNames, HeapFactory heapFactory, List<string>/*?*/ libPaths, bool wholeProgram, List<string>/*?*/ stubAssemblies,
+ string phoneControlsConfigFile, bool doPhoneNav, bool doPhoneFeedback) {
Contract.Requires(assemblyNames != null);
Contract.Requires(heapFactory != null);
@@ -191,10 +204,18 @@ namespace BytecodeTranslator {
if (phoneControlsConfigFile != null && phoneControlsConfigFile != "") {
phonePlugin = new PhoneControlsPlugin(phoneControlsConfigFile);
PhoneCodeHelper.PhonePlugin = phonePlugin;
- PhoneInitializationMetadataTraverser initTr = new PhoneInitializationMetadataTraverser(host);
- initTr.InjectPhoneCodeAssemblies(modules);
- PhoneNavigationMetadataTraverser navTr = new PhoneNavigationMetadataTraverser(host);
- navTr.InjectPhoneCodeAssemblies(modules);
+ if (doPhoneNav) {
+ PhoneCodeHelper.PhoneNavigationToggled = true;
+ PhoneInitializationMetadataTraverser initTr = new PhoneInitializationMetadataTraverser(host);
+ initTr.InjectPhoneCodeAssemblies(modules);
+ PhoneNavigationMetadataTraverser navTr = new PhoneNavigationMetadataTraverser(host);
+ navTr.InjectPhoneCodeAssemblies(modules);
+ }
+
+ if (doPhoneFeedback) {
+ PhoneCodeHelper.PhoneFeedbackToggled = true;
+ //PhoneControlFeedbackMetadataTraverser fbMetaDataTraverser= new PhoneControlFeedbackMetadataTraverser(host);
+ }
}
translator.TranslateAssemblies(modules);