public string GetEDID(string[] stringArguments) { string?md5 = messageMD5s.Where(kvp => kvp.Key.SequenceEqual(stringArguments)).Select(kvp => kvp.Value).FirstOrDefault(); //WTM: Added: See notes on messageEDIDs. if (md5 != null) { return(TES5TypeFactory.TES4Prefix + "MessageBox" + md5); } else { //WTM: Note: If not found, generate a more predictable name; return(NameTransformer.GetEscapedName(string.Join("", stringArguments), MessageBoxFactory.MessageBoxPrefix + "_", true)); //WTM: Change: PHPFunction.MD5(PHPFunction.Serialize(functionArguments.getValues())) } }
public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope) { TES5LocalScope localScope = codeScope.LocalScope; TES4FunctionArguments functionArguments = function.Arguments; string firstArgument = functionArguments[0].StringValue; string referenceName = NameTransformer.GetEscapedName(calledOn.Name + firstArgument, TES5TypeFactory.TES4Prefix + "SCENE_", true); this.metadataLogService.WriteLine("ADD_SCRIPT_SCENE", new string[] { firstArgument, referenceName }); ITES5Referencer reference = this.referenceFactory.CreateReference(referenceName, TES5BasicType.T_SCENE, globalScope, multipleScriptsScope, localScope); TES5ObjectCallArguments funcArgs = new TES5ObjectCallArguments(); /* * Force start because in oblivion double using AddScriptPackage would actually overwrite the script package, so we mimic this */ return(this.objectCallFactory.CreateObjectCall(reference, "ForceStart", funcArgs)); }
public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope) { TES5LocalScope localScope = codeScope.LocalScope; TES4FunctionArguments functionArguments = function.Arguments; //todo Refactor - add floating point vars . if (functionArguments.Count == 1) { TES5StaticReference calledOnRef = TES5StaticReference.Debug; return(this.objectCallFactory.CreateObjectCall(calledOnRef, "MessageBox", multipleScriptsScope, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope))); } else { string edid = NameTransformer.GetEscapedName(string.Join("", functionArguments.Select(v => v.StringValue)), TES5TypeFactory.TES4Prefix + "MessageBox_", true);//WTM: Change: PHPFunction.MD5(PHPFunction.Serialize(functionArguments.getValues())) IEnumerable <string> messageArguments = (new string[] { edid }).Concat(functionArguments.Select(a => a.StringValue)); this.metadataLogService.WriteLine("ADD_MESSAGE", messageArguments); ITES5Referencer messageBoxResult = this.referenceFactory.CreateReadReference(TES5ReferenceFactory.MESSAGEBOX_VARIABLE_CONST, globalScope, multipleScriptsScope, localScope); ITES5Referencer reference = this.referenceFactory.CreateReadReference(edid, globalScope, multipleScriptsScope, localScope); return(TES5VariableAssignationFactory.CreateAssignation(messageBoxResult, this.objectCallFactory.CreateObjectCall(reference, "show", multipleScriptsScope))); } }