public string GenerateScript(byte[] serialized_object, string entry_class_name, string additional_script, RuntimeVersion version, bool enable_debug) { string[] lines = JScriptGenerator.BinToBase64Lines(serialized_object); return(VBShared.GetScriptHeader(version, enable_debug ? "WScript.Echo" : String.Empty) + Properties.Resources.vbs_template.Replace("%SERIALIZED%", String.Join(Environment.NewLine + "s = s & ", lines)).Replace("%CLASS%", entry_class_name).Replace("%ADDEDSCRIPT%", additional_script)); }
public string GenerateScript(byte[] serialized_object, string entry_class_name, string additional_script, RuntimeVersion version, bool enable_debug) { string hex_encoded = BitConverter.ToString(serialized_object).Replace("-", ""); StringBuilder builder = new StringBuilder(); for (int i = 0; i < hex_encoded.Length; i++) { if (i == 0) { builder.Append(" serialized_obj = \""); } else if (i % 100 == 0) { builder.Append("\""); builder.AppendLine(); builder.Append(" serialized_obj = serialized_obj & \""); } builder.Append(hex_encoded[i]); } builder.Append("\""); return(VBShared.GetScriptHeader(version, enable_debug, ScriptName) + Properties.Resources.vba_template.Replace("%SERIALIZED%", builder.ToString()).Replace("%CLASS%", entry_class_name).Replace("%ADDEDSCRIPT%", additional_script)); }