private JazzStateMachine.Animation ExportEntry( string sourceFile, uint code, bool useSourceFile, string nameSpace, ActorDefinition actor, IDictionary <ulong, string> nameMap, bool ean) { System.IO.Stream s = null; uint hash; string name; JazzStateMachine.Animation animation = new JazzStateMachine.Animation(0, null, s); if (useSourceFile) { // TODO: sourceFile should not allow parsable numbers // Try to create a better brute force unhasher for // reading animation source files. if (!sourceFile.StartsWith("0x") || !uint.TryParse(sourceFile.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out hash)) { hash = FNVHash.HashString32(sourceFile); if (!nameMap.TryGetValue(hash, out name) && (ean || !KeyNameReg.TryFindName(hash, out name))) { nameMap[hash] = sourceFile; } } animation.NameHash = hash; } else { animation.NameHash = code; } if (nameSpace.StartsWith("0x") && uint.TryParse(nameSpace.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out hash)) { animation.Actor1Hash = hash; } else { hash = FNVHash.HashString32(nameSpace); if (!nameMap.TryGetValue(hash, out name) && (ean || !KeyNameReg.TryFindName(hash, out name))) { nameMap[hash] = sourceFile; } animation.Actor1Hash = hash; } animation.Actor2Hash = actor == null ? 0 : actor.NameHash; return(animation); }
private JazzStateMachine.Animation ExportEntry( string sourceFile, uint code, bool useSourceFile, string nameSpace, ActorDefinition actor, IDictionary<ulong, string> nameMap, bool ean) { System.IO.Stream s = null; uint hash; string name; JazzStateMachine.Animation animation = new JazzStateMachine.Animation(0, null, s); if (useSourceFile) { // TODO: sourceFile should not allow parsable numbers // Try to create a better brute force unhasher for // reading animation source files. if (!sourceFile.StartsWith("0x") || !uint.TryParse(sourceFile.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out hash)) { hash = FNVHash.HashString32(sourceFile); if (!nameMap.TryGetValue(hash, out name) && (ean || !KeyNameReg.TryFindName(hash, out name))) { nameMap[hash] = sourceFile; } } animation.NameHash = hash; } else { animation.NameHash = code; } if (nameSpace.StartsWith("0x") && uint.TryParse(nameSpace.Substring(2), System.Globalization.NumberStyles.HexNumber, null, out hash)) { animation.Actor1Hash = hash; } else { hash = FNVHash.HashString32(nameSpace); if (!nameMap.TryGetValue(hash, out name) && (ean || !KeyNameReg.TryFindName(hash, out name))) { nameMap[hash] = sourceFile; } animation.Actor1Hash = hash; } animation.Actor2Hash = actor == null ? 0 : actor.NameHash; return animation; }