Beispiel #1
0
        public GuerillaCs(string guerillaExecutablePath)
            : base(guerillaExecutablePath)
        {
            BinaryIOReflection.CacheMethods();
            var assembly = typeof(StringIdent).Assembly;
            var query    = from type in assembly.GetTypes()
                           where type.GetCustomAttributes(typeof(GuerillaTypeAttribute), false).Any()
                           select type;
            var valueTypes = query.ToArray();

            _valueTypeDictionary = new Dictionary <MoonfishFieldType, Type>(valueTypes.Count());
            foreach (var type in valueTypes)
            {
                var guerillaTypeAttributes =
                    (GuerillaTypeAttribute[])type.GetCustomAttributes(typeof(GuerillaTypeAttribute), false);
                foreach (var guerillaType in guerillaTypeAttributes)
                {
                    _valueTypeDictionary.Add(guerillaType.FieldType, type);
                }
            }
            _valueTypeDictionary.Add(MoonfishFieldType.FieldAngle, typeof(float));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealEulerAngles_3D, typeof(Vector3));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldCharInteger, typeof(byte));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldShortInteger, typeof(short));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldShortBounds, typeof(int));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldLongInteger, typeof(int));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldReal, typeof(float));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealFraction, typeof(float));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealFractionBounds, typeof(Vector2));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealPoint_2D, typeof(Vector2));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealVector_3D, typeof(Vector3));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealVector_2D, typeof(Vector2));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealPoint_3D, typeof(Vector3));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealEulerAngles_2D, typeof(Vector2));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealPlane_2D, typeof(Vector3));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealPlane_3D, typeof(Vector4));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealQuaternion, typeof(Quaternion));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRealArgbColor, typeof(Vector4));
            _valueTypeDictionary.Add(MoonfishFieldType.FieldRectangle_2D, typeof(Vector2));
        }
Beispiel #2
0
 static GuerillaCs()
 {
     BinaryIOReflection.CacheMethods();
     InitializeNamespaceDictionary();
 }