Example #1
0
        private AbcConstant GetConstantValue(AsConstantKind kind, uint value)
        {
            switch (kind)
            {
            case AsConstantKind.Integer:
                return(FileInfo.ConstantPool.Integers[value]);

            case AsConstantKind.UInteger:
                return(FileInfo.ConstantPool.UnsignedIntegers[value]);

            case AsConstantKind.Double:
                return(FileInfo.ConstantPool.Doubles[value]);

            case AsConstantKind.String:
                return(FileInfo.ConstantPool.Strings[value]);

            case AsConstantKind.True:
                return(true);

            case AsConstantKind.False:
                return(false);

            case AsConstantKind.Null:
                return(AbcConstant.Null);

            case AsConstantKind.Undefined:
                return(AbcConstant.Undefined);

            case AsConstantKind.Namespace:
                return(GetNamespace(value, AbcNamespace.Any));

            //todo: other types
            default:
                throw new Exception("unknown constant");
            }
        }
Example #2
0
 private AbcConstant GetConstantValue(AsConstantKind kind, uint value)
 {
     switch (kind) {
         case AsConstantKind.Integer:
             return FileInfo.ConstantPool.Integers[value];
         case AsConstantKind.UInteger:
             return FileInfo.ConstantPool.UnsignedIntegers[value];
         case AsConstantKind.Double:
             return FileInfo.ConstantPool.Doubles[value];
         case AsConstantKind.String:
             return FileInfo.ConstantPool.Strings[value];
         case AsConstantKind.True:
             return true;
         case AsConstantKind.False:
             return false;
         case AsConstantKind.Null:
             return AbcConstant.Null;
         case AsConstantKind.Undefined:
             return AbcConstant.Undefined;
         case AsConstantKind.Namespace:
             return GetNamespace(value, AbcNamespace.Any);
         //todo: other types
         default:
             throw new Exception("unknown constant");
     }
 }