/* * Gets the ES2Type for a specific System.Type. * Returns null if one is not found. */ public static ES2Type GetES2Type(System.Type type) { if (types == null) { ES2.Init(); } // We use caching of the last type as it is often likely that repeated calls to this method will be made for the same type. if (cachedType != null) { if (cachedType.type.Equals(type)) { return(cachedType); } } if (types.TryGetValue(type, out cachedType)) { return(cachedType); } else if (ES2TypeUtility.IsEnum(type)) { return(new ES2_Enum()); } return(null); }
/* * Gets the ES2Type with a specific 'key' byte. * Returns null if one is not found. */ public static ES2Type GetES2Type(int hash) { if (types == null) { ES2.Init(); } // We use caching of the last type as it is often likely that repeated calls to this method will be made for the same type. if (cachedType != null) { if (cachedType.hash == hash) { return(cachedType); } } // Iterate over array. foreach (KeyValuePair <System.Type, ES2Type> type in types) { if (type.Value.hash == hash) { return(cachedType = type.Value); } } return(null); }
public void Init() { if (!ES2.initialised) { ES2.Init(); } // Initialize global settings, saveLocation = ES2GlobalSettings.defaultSaveLocation; optimizeMode = ES2GlobalSettings.defaultOptimizeMode; format = ES2GlobalSettings.defaultFormat; encrypt = ES2GlobalSettings.defaultEncrypt; encryptionPassword = ES2GlobalSettings.defaultEncryptionPassword; encryptionType = ES2GlobalSettings.defaultEncryptionType; webUsername = ES2GlobalSettings.defaultWebUsername; webPassword = ES2GlobalSettings.defaultWebPassword; webFilename = ES2GlobalSettings.defaultWebFilename; }