private static string GeneratePropertyName(TES5ScriptHeader header, TES5Property property)
 {
     return("col_" + property.GetPropertyNameWithoutSuffix() + "_" +
            PHPFunction.MD5(header.EscapedScriptName).Substring(0, 4)
            //WTM:  Note:  Instead of using an MD5 hash, I tried the below (where index was the property index within the script's TES5GlobalScope.
            //It worked, but I don't think the names matched up well with what GECK generates, so I've commented it for now.
            //header.EscapedScriptName + "_" + index
            );
 }
Esempio n. 2
0
 private static string GeneratePropertyName(TES5ScriptHeader header, TES5Property property)
 {
     if (property.AllowNameTransformation)
     {
         return("col_" + property.OriginalName + "_" + PHPFunction.MD5(header.EscapedScriptName).Substring(0, 4));
         //WTM:  Note:  Instead of using an MD5 hash, I tried the below (where index was the property index within the script's TES5GlobalScope).
         //"col_" + property.OriginalName + "_" + header.EscapedScriptName + "_" + index
         //It worked, but I don't think the names match with what GECKFrontend generates, so I've commented it for now.
     }
     return(property.OriginalName);
 }
        public static string GetEscapedName(string name, string prefix, bool includePrefix)
        {
            string newName  = PHPFunction.MD5(name.ToLower());//Some names are normal, and others are lowercase.  ToLower() homogenizes them.
            string fullName = prefix + newName;

            if (fullName.Length > maxLength)
            {
                int newNameLength = newName.Length - (fullName.Length - maxLength);
                newName  = newName.Substring(0, newNameLength);
                fullName = prefix + newName;
            }
            return(includePrefix ? fullName : newName);
        }
        private static string GetUniqueBuildFingerprint(this IEnumerable <IBuildTarget> buildTargets)
        {
#if PHP_COMPAT
            string md5 = PHPFunction.MD5("randomseed");
            foreach (var key in this.buildTargets.Select(kvp => kvp.Key).OrderBy(k => k))
            {
                md5 = PHPFunction.MD5(md5 + key);
            }
            return(md5);
#else
            string fileName = string.Join("", buildTargets.Select(bt => bt.Name));
            foreach (char invalid in Path.GetInvalidFileNameChars())
            {
                fileName = fileName.Replace(invalid.ToString(), "");
            }
            return(fileName);
#endif
        }