Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
updated readme, cleaned up formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
nexussays committed Dec 30, 2017
1 parent e7e189a commit 4af789d
Show file tree
Hide file tree
Showing 83 changed files with 7,264 additions and 6,904 deletions.
371 changes: 363 additions & 8 deletions LICENSE

Large diffs are not rendered by default.

36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,52 @@
# Overview

nexuslib is a collection of (in-development) Actionscript libraries.
nexuslib is a collection of Actionscript libraries. Enums, Random, Reflection, Serialization, Crypto.

The reflection library is production ready and is currently in-use in production environments.
The reflection library specifically is production ready and is currently in-use in production environments.

## Getting Started

Download the [latest release](https://github.com/nexussays/nexuslib-as3/releases), or clone the repo and reference in your project.

### Dependencies
### External Dependencies

blooddy-crypto (statically linked with nexuslib.swc)
None

> blooddy-crypto is statically linked with nexuslib.swc
### API Docs

http://docs.nexussays.com/nexuslib/index.html

## Components

### Enum & EnumSet

Since AS3 doesn't provide a native enum structure you can use this to ceate one thusly:
```as3
public class MyEnum extends Enum
{
public static const Enum1 : MyEnum = new MyEnum();
public static const Enum2 : MyEnum = new MyEnum();
public static function get All():EnumSet { return Enum.values(MyEnum); }
}
```
For more examples of correct and incorrect Enum usage, see the [mocks in the test directory](./test/src/mock)

### Reflection & Serialization

`nexus.utils.reflection`, `nexus.utils.serialization`

Reflection & serialization library. Features deterministic JSON de/serialization, deserializing directly to typed AS objects, a structured reflection class heirarchy, and more. Full support for Application Domains and namespaces.

### Enigma
### Crypto & security

`nexus.security.crypto`

Crypto & security library. Currently only provides an HMAC class and some utilities.

### Mercury

`nexus.net`

In development.
Currently only provides an HMAC class and some utilities.

### Git
### Version control (Git)

`nexus.vcs.git`

Expand Down
Binary file removed etc/core_logo.png
Binary file not shown.
5 changes: 0 additions & 5 deletions etc/count.bat

This file was deleted.

182 changes: 91 additions & 91 deletions src/avmplus/AVMDescribeType.as
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ package avmplus
/**
* Provides access to the avmplus.describeTypeJSON method which was (accidentally?) exposed in Flash 10.1
*
* @see http://hg.mozilla.org/tamarin-redux/file/tip/core/DescribeType.as
* @see http://hg.mozilla.org/tamarin-redux/file/tip/core/DescribeType.as
* @private
*/
public final class AVMDescribeType
{
//--------------------------------------
// CLASS CONSTANTS
//--------------------------------------
private static var s_isAvailable : Boolean = false;
//as defined in avm
/*
public const HIDE_NSURI_METHODS:uint = 0x0001;
//--------------------------------------
// CLASS CONSTANTS
//--------------------------------------
private static var s_isAvailable : Boolean = false;
//as defined in avm
/*
public const HIDE_NSURI_METHODS:uint = 0x0001;
public const INCLUDE_BASES:uint = 0x0002;
public const INCLUDE_INTERFACES:uint = 0x0004;
public const INCLUDE_VARIABLES:uint = 0x0008;
Expand All @@ -34,86 +34,86 @@ public final class AVMDescribeType
public const USE_ITRAITS:uint = 0x0200;
// if set, hide everything from the base Object class
public const HIDE_OBJECT:uint = 0x0400;
//*/
private static const INCLUDE_BASES:uint = avmplus.INCLUDE_BASES;
private static const INCLUDE_INTERFACES:uint= avmplus.INCLUDE_INTERFACES;
private static const INCLUDE_VARIABLES:uint = avmplus.INCLUDE_VARIABLES;
private static const INCLUDE_ACCESSORS:uint = avmplus.INCLUDE_ACCESSORS;
private static const INCLUDE_METHODS:uint = avmplus.INCLUDE_METHODS;
private static const INCLUDE_METADATA:uint = avmplus.INCLUDE_METADATA;
private static const INCLUDE_CONSTRUCTOR:uint = avmplus.INCLUDE_CONSTRUCTOR;
private static const INCLUDE_TRAITS:uint = avmplus.INCLUDE_TRAITS;
private static const USE_ITRAITS:uint = avmplus.USE_ITRAITS;
private static const HIDE_OBJECT:uint = avmplus.HIDE_OBJECT;
private static const GET_CLASS : uint = INCLUDE_VARIABLES | INCLUDE_ACCESSORS | INCLUDE_METHODS | INCLUDE_METADATA | INCLUDE_TRAITS | HIDE_OBJECT;
private static const GET_INSTANCE : uint = INCLUDE_BASES | INCLUDE_INTERFACES | INCLUDE_VARIABLES | INCLUDE_ACCESSORS | INCLUDE_METHODS | INCLUDE_METADATA | INCLUDE_CONSTRUCTOR | INCLUDE_TRAITS | USE_ITRAITS | HIDE_OBJECT;
//--------------------------------------
// STATIC INITIALIZER
//--------------------------------------
{
try
{
if(describeTypeJSON is Function && describeType is Function)
{
s_isAvailable = true;
}
}
catch(e:Error)
{
s_isAvailable = false;
}
}
//--------------------------------------
// GETTERS/SETTERS
//--------------------------------------
public static function get isAvailable():Boolean { return s_isAvailable; }
//--------------------------------------
// PUBLIC CLASS METHODS
//--------------------------------------
public static function getJson(object:Object):Object
{
var factory : Object = describeTypeJSON(object, GET_INSTANCE);
factory.traits.isDynamic = factory.isDynamic;
factory.traits.isFinal = factory.isFinal;
factory.traits.isStatic = factory.isStatic;
factory.traits.name = factory.name;
factory = factory.traits;
factory.methods = factory.methods || [];
factory.accessors = factory.accessors || [];
factory.variables = factory.variables || [];
factory.constructor = factory.constructor || [];
var obj : Object = describeTypeJSON(object, GET_CLASS);
obj = obj.traits;
obj.methods = obj.methods || [];
obj.accessors = obj.accessors || [];
obj.variables = obj.variables || [];
delete obj.bases;
delete obj.constructor;
delete obj.interfaces;
obj.factory = factory;
return obj;
}
/**
* This method just calls getJson() and parses the result to XML. It is advised to not use this method unless you are sending the data
* to something that expects it in the standard flash.utils.describeType() format.
* @param object
* @return
*/
public static function getXml(object:Object):XML
{
return describeType(object, GET_CLASS);
}
//*/
private static const INCLUDE_BASES:uint = avmplus.INCLUDE_BASES;
private static const INCLUDE_INTERFACES:uint= avmplus.INCLUDE_INTERFACES;
private static const INCLUDE_VARIABLES:uint = avmplus.INCLUDE_VARIABLES;
private static const INCLUDE_ACCESSORS:uint = avmplus.INCLUDE_ACCESSORS;
private static const INCLUDE_METHODS:uint = avmplus.INCLUDE_METHODS;
private static const INCLUDE_METADATA:uint = avmplus.INCLUDE_METADATA;
private static const INCLUDE_CONSTRUCTOR:uint = avmplus.INCLUDE_CONSTRUCTOR;
private static const INCLUDE_TRAITS:uint = avmplus.INCLUDE_TRAITS;
private static const USE_ITRAITS:uint = avmplus.USE_ITRAITS;
private static const HIDE_OBJECT:uint = avmplus.HIDE_OBJECT;
private static const GET_CLASS : uint = INCLUDE_VARIABLES | INCLUDE_ACCESSORS | INCLUDE_METHODS | INCLUDE_METADATA | INCLUDE_TRAITS | HIDE_OBJECT;
private static const GET_INSTANCE : uint = INCLUDE_BASES | INCLUDE_INTERFACES | INCLUDE_VARIABLES | INCLUDE_ACCESSORS | INCLUDE_METHODS | INCLUDE_METADATA | INCLUDE_CONSTRUCTOR | INCLUDE_TRAITS | USE_ITRAITS | HIDE_OBJECT;
//--------------------------------------
// STATIC INITIALIZER
//--------------------------------------
{
try
{
if(describeTypeJSON is Function && describeType is Function)
{
s_isAvailable = true;
}
}
catch(e:Error)
{
s_isAvailable = false;
}
}
//--------------------------------------
// GETTERS/SETTERS
//--------------------------------------
public static function get isAvailable():Boolean { return s_isAvailable; }
//--------------------------------------
// PUBLIC CLASS METHODS
//--------------------------------------
public static function getJson(object:Object):Object
{
var factory : Object = describeTypeJSON(object, GET_INSTANCE);
factory.traits.isDynamic = factory.isDynamic;
factory.traits.isFinal = factory.isFinal;
factory.traits.isStatic = factory.isStatic;
factory.traits.name = factory.name;
factory = factory.traits;
factory.methods = factory.methods || [];
factory.accessors = factory.accessors || [];
factory.variables = factory.variables || [];
factory.constructor = factory.constructor || [];
var obj : Object = describeTypeJSON(object, GET_CLASS);
obj = obj.traits;
obj.methods = obj.methods || [];
obj.accessors = obj.accessors || [];
obj.variables = obj.variables || [];
delete obj.bases;
delete obj.constructor;
delete obj.interfaces;
obj.factory = factory;
return obj;
}
/**
* This method just calls getJson() and parses the result to XML. It is advised to not use this method unless you are sending the data
* to something that expects it in the standard flash.utils.describeType() format.
* @param object
* @return
*/
public static function getXml(object:Object):XML
{
return describeType(object, GET_CLASS);
}
}

}
}
Loading

0 comments on commit 4af789d

Please sign in to comment.