private ProxyGenerator(string rootOfClasses, DynaType type, bool persist) { Type = type; rootOfGenerated = RootOfGeneratedSources(type); this.persist = persist; targetClassPath = new FileInfo(rootOfClasses); }
protected DynaUIText(Section_AHDR AHDR, DynaType type, Game game, Endianness endianness) : base(AHDR, type, game, endianness) { using (var reader = new EndianBinaryReader(AHDR.data, endianness)) { reader.BaseStream.Position = dynaUIEnd; Text_AssetID = reader.ReadUInt32(); font = reader.ReadByte(); fontSizeW = reader.ReadByte(); fontSizeH = reader.ReadByte(); fontSpacingX = reader.ReadByte(); fontSpacingY = reader.ReadByte(); textBoxInsetTop = reader.ReadByte(); textBoxInsetLeft = reader.ReadByte(); textBoxInsetRight = reader.ReadByte(); textBoxInsetBottom = reader.ReadByte(); justifyX = reader.ReadByte(); justifyY = reader.ReadByte(); textFlags = reader.ReadByte(); ShadowColor = reader.ReadColor(); shadowOffsetX = reader.ReadSingle(); shadowOffsetY = reader.ReadSingle(); shadowScaleX = reader.ReadSingle(); shadowScaleY = reader.ReadSingle(); } }
public static ProxyGenerator ForClasPath( IList <FileInfo> classPath, DirectoryInfo destinationDirectory, DynaType type, bool persist, ILogger logger) => new ProxyGenerator(classPath, destinationDirectory, type, persist, logger);
private ProxyGenerator(IList <FileInfo> rootOfClasses, DirectoryInfo rootOfGenerated, DynaType type, bool persist, ILogger logger) { this.rootOfGenerated = rootOfGenerated; Type = type; this.persist = persist; this.logger = logger; }
public DynaUI(Section_AHDR AHDR, DynaType type, Game game, Endianness endianness) : base(AHDR, type, game, endianness) { using (var reader = new EndianBinaryReader(AHDR.data, endianness)) { reader.BaseStream.Position = dynaDataStartPosition; PositionX = reader.ReadSingle(); PositionY = reader.ReadSingle(); PositionZ = reader.ReadSingle(); Width = reader.ReadSingle(); Height = reader.ReadSingle(); Flags.FlagValueInt = reader.ReadUInt32(); Color = reader.ReadColor(); UIMotion_Selected_AssetID = reader.ReadUInt32(); UIMotion_Unselected_AssetID = reader.ReadUInt32(); Brightness = reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); reader.ReadByte(); autoMenuUp = reader.ReadUInt32(); autoMenuDown = reader.ReadUInt32(); autoMenuLeft = reader.ReadUInt32(); autoMenuRight = reader.ReadUInt32(); custom = reader.ReadUInt32(); customWidget = reader.ReadUInt32(); } }
private ResourceDispatcherGenerator(IList <Action> actions, FileInfo rootOfClasses, DirectoryInfo rootOfGenerated, DynaType type, bool persist, ILogger logger) { _actions = actions; _rootOfClasses = rootOfClasses; _rootOfGenerated = rootOfGenerated; Type = type; _persist = persist; _logger = logger; }
public DynaHud(Section_AHDR AHDR, DynaType type, Game game, Endianness endianness) : base(AHDR, type, game, endianness) { using (var reader = new EndianBinaryReader(AHDR.data, endianness)) { reader.BaseStream.Position = dynaDataStartPosition; PositionX = reader.ReadSingle(); PositionY = reader.ReadSingle(); PositionZ = reader.ReadSingle(); ScaleX = reader.ReadSingle(); ScaleY = reader.ReadSingle(); ScaleZ = reader.ReadSingle(); } }
public DynaHudMeter(Section_AHDR AHDR, DynaType type, Game game, Endianness endianness) : base(AHDR, type, game, endianness) { using (var reader = new EndianBinaryReader(AHDR.data, endianness)) { reader.BaseStream.Position = dynaHudEnd; StartValue = reader.ReadSingle(); MinValue = reader.ReadSingle(); MaxValue = reader.ReadSingle(); IncrementTime = reader.ReadSingle(); DecrementTime = reader.ReadSingle(); StartIncrement_SoundAssetID = reader.ReadUInt32(); Increment_SoundAssetID = reader.ReadUInt32(); StartDecrement_SoundAssetID = reader.ReadUInt32(); Decrement_SoundAssetID = reader.ReadUInt32(); } }
public Input( Type protocol, string fullyQualifiedClassName, string source, FileInfo sourceFile, DynaClassLoader classLoader, DynaType type, bool persist) { Protocol = protocol; FullyQualifiedClassName = fullyQualifiedClassName; Source = source; SourceFile = sourceFile; ClassLoader = classLoader; Type = type; Persist = persist; }
private static string RootOfGeneratedSources(DynaType type) => type == DynaType.Main ? Properties.Instance.GetProperty("proxy.generated.sources.main", GeneratedSources) : Properties.Instance.GetProperty("proxy.generated.sources.test", GeneratedTestSources);
private static DirectoryInfo RootOfGeneratedSources(DynaType type) => type == DynaType.Main ? new DirectoryInfo(Properties.Instance.GetProperty("resource.dispatcher.generated.sources.main", GeneratedSources)) : new DirectoryInfo(Properties.Instance.GetProperty("resource.dispatcher.generated.sources.test", GeneratedTestSources));
//should proxy a certain interface, and then in construction take a certain lambda to handle each call //... public static FnProxifier BuildProxifier(Type tGrain) { var tProxy = DynaType.Design(x => { //x.Name = $"{tGrain.Name}_Wrapper"; //need to get nice names of types x.BaseType = typeof(GrainProxy <>).MakeGenericType(tGrain); x.Attributes |= TypeAttributes.Serializable | TypeAttributes.Public; x.Constructor() .ArgTypes(typeof(Fixture), typeof(AbstractKey)) .PassThroughToBaseCtor(); var grainInterfaces = new[] { tGrain }.Concat(tGrain.GetInterfaces()); //.Where(t => IsGrainInterface(t)); //each interface fulfilled by grain type should be fulfilled by inward delegation -------------- foreach (var tInterface in grainInterfaces) { var methods = tInterface.GetMethods(); if (!methods.All(m => m.ReturnType.IsTaskType())) { throw new InvalidOperationException($"Can't proxy type {tInterface}, as not all of its methods return tasks!"); } x.AddInterface(tInterface); foreach (var m in methods) { var taskReturnType = GetTaskReturnType(m.ReturnType); var mProxyDispatch = _mgProxyDispatch.MakeGenericMethod(taskReturnType); var fMethod = x.StaticField($"__{Guid.NewGuid()}", typeof(MethodInfo)) .Value(m); var rParams = m.GetParameters(); x.OverrideMethod(m) .Emit(il => { //Delegate to GrainProxy.Dispatch(), via packaging of args into object array il.Emit(OpCodes.Ldarg_0); il.Emit(OpCodes.Ldsfld, fMethod); il.Emit(OpCodes.Ldc_I4, rParams.Length); il.Emit(OpCodes.Newarr, typeof(object)); foreach (var p in rParams) { il.Emit(OpCodes.Dup); il.Emit(OpCodes.Ldc_I4, p.Position); il.Emit(OpCodes.Ldarg, p.Position + 1); if (p.ParameterType.IsValueType) { il.Emit(OpCodes.Box, p.ParameterType); } il.Emit(OpCodes.Stelem, typeof(object)); } il.Emit(OpCodes.Call, mProxyDispatch); il.Emit(OpCodes.Ret); }); } } }); var exFixtureParam = Expression.Parameter(typeof(Fixture)); var exKeyParam = Expression.Parameter(typeof(AbstractKey)); var exLambda = Expression.Lambda <FnProxifier>( Expression.New( tProxy.GetConstructor( new[] { typeof(Fixture), typeof(AbstractKey) }), exFixtureParam, exKeyParam ), exFixtureParam, exKeyParam); return(exLambda.Compile()); }
private static DirectoryInfo RootOfGeneratedSources(DynaType type) => type == DynaType.Main ? new DirectoryInfo(Properties.Instance.GetProperty("proxy.generated.sources.main", GeneratedSources) !) :
public DynaGeneric(Section_AHDR AHDR, DynaType type, Game game, Endianness endianness) : base(AHDR, type, game, endianness) { Data = AHDR.data.Skip(dynaDataStartPosition).Take(AHDR.data.Length - dynaDataStartPosition - _links.Length * Link.sizeOfStruct).ToArray(); }