public AdoInputReader(InputContext input, Field[] fields, IConnectionFactory factory, IRowFactory rowFactory) { _input = input; _fields = fields; _factory = factory; _rowCreator = new AdoRowCreator(input, rowFactory); _typeTransform = new TypeTransform(input, fields); }
public async Task When_SameNamespace_And_New_Name() { var transforms = new TypeTransform[] { new TypeTransform { TypeName = "MyNameSpace.MyNewType", OriginalTypeName = "MyOriginalType" } }; await TransformValidation.Validate(transforms); }
private static TypeTransform HackGetComponents(TypeTransform typeTransform) { if (typeTransform.type == typeof(GameObject)) { typeTransform.AddTSMethodDeclaration($"AddComponent<T extends Component>(type: {{ new(): T }}): T", "AddComponent", typeof(Type)); typeTransform.WriteCSMethodOverrideBinding("AddComponent", GameObjectFix.Bind_AddComponent); typeTransform.WriteCSMethodOverrideBinding("GetComponent", GameObjectFix.Bind_GetComponent); typeTransform.WriteCSMethodOverrideBinding("GetComponentInChildren", GameObjectFix.Bind_GetComponentInChildren); typeTransform.WriteCSMethodOverrideBinding("GetComponentInParent", GameObjectFix.Bind_GetComponentInParent); typeTransform.WriteCSMethodOverrideBinding("GetComponentsInChildren", GameObjectFix.Bind_GetComponentsInChildren); typeTransform.WriteCSMethodOverrideBinding("GetComponentsInParent", GameObjectFix.Bind_GetComponentsInParent); typeTransform.WriteCSMethodOverrideBinding("GetComponents", GameObjectFix.Bind_GetComponents); } else { typeTransform.WriteCSMethodOverrideBinding("GetComponent", ComponentFix.Bind_GetComponent); typeTransform.WriteCSMethodOverrideBinding("GetComponentInChildren", ComponentFix.Bind_GetComponentInChildren); typeTransform.WriteCSMethodOverrideBinding("GetComponentInParent", ComponentFix.Bind_GetComponentInParent); typeTransform.WriteCSMethodOverrideBinding("GetComponentsInChildren", ComponentFix.Bind_GetComponentsInChildren); typeTransform.WriteCSMethodOverrideBinding("GetComponentsInParent", ComponentFix.Bind_GetComponentsInParent); typeTransform.WriteCSMethodOverrideBinding("GetComponents", ComponentFix.Bind_GetComponents); } typeTransform.AddTSMethodDeclaration($"GetComponent<T extends Component>(type: {{ new(): T }}): T", "GetComponent", typeof(Type)) .AddTSMethodDeclaration($"GetComponentInChildren<T extends Component>(type: {{ new(): T }}, includeInactive: boolean): T", "GetComponentInChildren", typeof(Type), typeof(bool)) .AddTSMethodDeclaration($"GetComponentInChildren<T extends Component>(type: {{ new(): T }}): T", "GetComponentInChildren", typeof(Type)) .AddTSMethodDeclaration($"GetComponentInParent<T extends Component>(type: {{ new(): T }}): T", "GetComponentInParent", typeof(Type)) .AddTSMethodDeclaration($"GetComponents<T extends Component>(type: {{ new(): T }}): T[]", "GetComponents", typeof(Type)) .AddTSMethodDeclaration($"GetComponentsInChildren<T extends Component>(type: {{ new(): T }}, includeInactive: boolean): T[]", "GetComponentsInChildren", typeof(Type), typeof(bool)) .AddTSMethodDeclaration($"GetComponentsInChildren<T extends Component>(type: {{ new(): T }}): T[]", "GetComponentsInChildren", typeof(Type)) .AddTSMethodDeclaration($"GetComponentsInParent<T extends Component>(type: {{ new(): T }}, includeInactive: boolean): T[]", "GetComponentsInParent", typeof(Type), typeof(bool)) .AddTSMethodDeclaration($"GetComponentsInParent<T extends Component>(type: {{ new(): T }}): T[]", "GetComponentsInParent", typeof(Type)) ; return(typeTransform); }
private static Point multiMatrix(TypeTransform type, double dx, double dy, double[] array) { Console.WriteLine("ma tran dau: " + array[0] + " - " + array[1] + " - " + array[2]); double[,] matrix = new double[3, 3]; switch (type) { case TypeTransform.Translation: matrix[0, 0] = 1; matrix[0, 1] = 0; matrix[0, 2] = 0; matrix[1, 0] = 0; matrix[1, 1] = 1; matrix[1, 2] = 0; matrix[2, 0] = dx; matrix[2, 1] = dy; matrix[2, 2] = 1; break; case TypeTransform.Scaling: matrix[0, 0] = dx; matrix[0, 1] = 0; matrix[0, 2] = 0; matrix[1, 0] = 0; matrix[1, 1] = dy; matrix[1, 2] = 0; matrix[2, 0] = 0; matrix[2, 1] = 0; matrix[2, 2] = 1; break; case TypeTransform.Rotation: //double sin = Math.Sin((Math.PI * dx) / 180); //dx //double cos = Math.Cos((Math.PI * dx) / 180); //dy matrix[0, 0] = dy; matrix[0, 1] = dx; matrix[0, 2] = 0; matrix[1, 0] = -1 * dx; matrix[1, 1] = dy; matrix[1, 2] = 0; matrix[2, 0] = 0; matrix[2, 1] = 0; matrix[2, 2] = 1; //mang[0] = pt.X; mang[1] = pt.Y; mang[2] = 1; break; } double[] temparr = new double[3]; int count = 0; for (int i = 0; i < 3; i++) { temparr[i] = array[0] * matrix[0, count] + array[1] * matrix[1, count] + array[2] * matrix[2, count]; count++; } Console.WriteLine("Ma trận kq: " + temparr[0] + " - " + temparr[1] + " - " + temparr[2]); Point pt = new Point(Convert.ToInt16(temparr[0]), Convert.ToInt16(temparr[1])); return(pt); }
public TypedEntityMatchingKeysReader(ITakeAndReturnRows reader, IContext context) { _reader = reader; _typeTransform = new TypeTransform(context, CombineFields(context.Entity.GetPrimaryKey(), context.Entity.TflHashCode())); }