public override void ToCString(StringBuilder builder, string macroName) { builder.AppendLine(string.Format("BBSeriesMacro {0} = new BBSeriesMacro();", macroName)); string[] fieldNames = new string[] { "times", "duration", "delay" }; foreach (string fieldName in fieldNames) { FieldInfo fieldInfo = GetType().GetField(fieldName, BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public); builder.Append(string.Format("{0}.{1} = ", macroName, fieldName)); BBUtil.ConcatMemberString(builder, fieldInfo.FieldType, fieldInfo.GetValue(this)); builder.AppendLine(";"); } builder.AppendLine(string.Format("{0}.items = new BBMacro[{1}];", macroName, items.Length)); for (int i = 0; i < items.Length; i++) { string itemMacroName = macroName + "_" + i; items[i].ToCString(builder, itemMacroName); builder.AppendLine(string.Format("{0}.items[{1}] = {2};", macroName, i, itemMacroName)); } if (next != null) { string nextMacroName = macroName + "_n"; next.ToCString(builder, nextMacroName); builder.AppendLine(string.Format("{0}.next = {1};", macroName, nextMacroName)); } }
public void ToCString(StringBuilder builder, string configName) { builder.AppendLine(string.Format("BBConfig {0} = new BBConfig();", configName)); string[] fieldNames = new string[] { "axisType", "clipRatio", "screenWidth", "screenHeight", "device", "monitoringButtons", "monitoringKeyboard" }; foreach (string fieldName in fieldNames) { FieldInfo fieldInfo = GetType().GetField(fieldName, BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public); builder.Append(string.Format("{0}.{1} = ", configName, fieldName)); BBUtil.ConcatMemberString(builder, fieldInfo.FieldType, fieldInfo.GetValue(this)); builder.AppendLine(";"); } }
public virtual void ToCString(StringBuilder builder, string macroName) { builder.AppendLine(string.Format("BBMacro {0} = new BBMacro();", macroName)); string[] fieldNames = new string[] { "code", "button", "key", "data", "times", "duration", "delay", "script", "scriptData" }; foreach (string fieldName in fieldNames) { FieldInfo fieldInfo = GetType().GetField(fieldName, BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public); builder.Append(string.Format("{0}.{1} = ", macroName, fieldName)); BBUtil.ConcatMemberString(builder, fieldInfo.FieldType, fieldInfo.GetValue(this)); builder.AppendLine(";"); } if (next != null) { string nextMacroName = macroName + "_n"; next.ToCString(builder, nextMacroName); builder.AppendLine(string.Format("{0}.next = {1};", macroName, nextMacroName)); } }