public static StaticBodyProperties GetRandomStaticBodyProperties()
        {
            Random random = new Random((int)DateTime.Now.Ticks);
            StaticBodyProperties staticBodyProperties = new StaticBodyProperties();

            staticBodyProperties.KeyPart1   = (ulong)random.Next();
            staticBodyProperties.KeyPart1 <<= 32;
            staticBodyProperties.KeyPart1  += (ulong)random.Next();
            staticBodyProperties.KeyPart2   = (ulong)random.Next();
            staticBodyProperties.KeyPart2 <<= 32;
            staticBodyProperties.KeyPart2  += (ulong)random.Next();
            staticBodyProperties.KeyPart3   = (ulong)random.Next();
            staticBodyProperties.KeyPart3 <<= 32;
            staticBodyProperties.KeyPart3  += (ulong)random.Next();
            staticBodyProperties.KeyPart4   = (ulong)random.Next();
            staticBodyProperties.KeyPart4 <<= 32;
            staticBodyProperties.KeyPart4  += (ulong)random.Next();
            staticBodyProperties.KeyPart5   = (ulong)random.Next();
            staticBodyProperties.KeyPart5 <<= 32;
            staticBodyProperties.KeyPart5  += (ulong)random.Next();
            staticBodyProperties.KeyPart6   = (ulong)random.Next();
            staticBodyProperties.KeyPart6 <<= 32;
            staticBodyProperties.KeyPart6  += (ulong)random.Next();
            staticBodyProperties.KeyPart7   = (ulong)random.Next();
            staticBodyProperties.KeyPart7 <<= 32;
            staticBodyProperties.KeyPart7  += (ulong)random.Next();
            staticBodyProperties.KeyPart8   = (ulong)random.Next();
            staticBodyProperties.KeyPart8 <<= 32;
            staticBodyProperties.KeyPart8  += (ulong)random.Next();
            return(staticBodyProperties);
        }
Ejemplo n.º 2
0
 public BodyProperties(
     DynamicBodyProperties dynamicBodyProperties,
     StaticBodyProperties staticBodyProperties)
 {
     this._dynamicBodyProperties = dynamicBodyProperties;
     this._staticBodyProperties  = staticBodyProperties;
 }
Ejemplo n.º 3
0
        public static bool FromXmlNode(XmlNode node, out BodyProperties bodyProperties)
        {
            XmlAttributeCollection attributes = node.Attributes;
            float result1;
            float result2;
            float result3;
            DynamicBodyProperties dynamicBodyProperties = (attributes != null ? (attributes.Count == 5 ? 1 : 0) : 0) == 0 || node.Attributes["age"].Value == null || (node.Attributes["weight"].Value == null || node.Attributes["build"].Value == null) ? new DynamicBodyProperties() : (!float.TryParse(node.Attributes["age"].Value, out result1) || !float.TryParse(node.Attributes["weight"].Value, out result2) || !float.TryParse(node.Attributes["build"].Value, out result3) ? new DynamicBodyProperties() : new DynamicBodyProperties(result1, result2, result3));
            StaticBodyProperties  staticBodyProperties;

            if (StaticBodyProperties.FromXmlNode(node, out staticBodyProperties))
            {
                bodyProperties = new BodyProperties(dynamicBodyProperties, staticBodyProperties);
                return(true);
            }
            bodyProperties = new BodyProperties();
            return(false);
        }
        public static bool FromXmlNode(XmlNode node, out StaticBodyProperties staticBodyProperties)
        {
            string str = node.Attributes["key"].Value;

            if (str.Length != 128)
            {
                staticBodyProperties = new StaticBodyProperties();
                return(false);
            }
            ulong result1;

            ulong.TryParse(str.Substring(0, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result1);
            ulong result2;

            ulong.TryParse(str.Substring(16, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result2);
            ulong result3;

            ulong.TryParse(str.Substring(32, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result3);
            ulong result4;

            ulong.TryParse(str.Substring(48, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result4);
            ulong result5;

            ulong.TryParse(str.Substring(64, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result5);
            ulong result6;

            ulong.TryParse(str.Substring(80, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result6);
            ulong result7;

            ulong.TryParse(str.Substring(96, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result7);
            ulong result8;

            ulong.TryParse(str.Substring(112, 16), NumberStyles.AllowHexSpecifier, (IFormatProvider)CultureInfo.CurrentCulture, out result8);
            staticBodyProperties = new StaticBodyProperties(result1, result2, result3, result4, result5, result6, result7, result8);
            return(true);
        }