コード例 #1
0
 public AlignObjectsEditOperation(Box alignBox, AlignAxis axis, AlignDirection direction, TransformFlags transformFlags)
 {
     _alignBox = alignBox;
     _axis = axis;
     _direction = direction;
     _transformFlags = transformFlags;
 }
コード例 #2
0
ファイル: torch.cs プロジェクト: Jeremiahf/wix3
 /// <summary>
 /// Instantiate a new Torch class.
 /// </summary>
 private Torch()
 {
     this.extensionList = new StringCollection();
     this.inputFiles = new StringCollection();
     this.invalidArgs = new StringCollection();
     this.messageHandler = new ConsoleMessageHandler("TRCH", "torch.exe");
     this.showLogo = true;
     this.tidy = true;
     this.validationFlags = 0;
 }
コード例 #3
0
ファイル: MapObject.cs プロジェクト: KonstantinUb/sledge
 public virtual void Transform(IUnitTransformation transform, TransformFlags flags)
 {
     foreach (var mo in GetChildren())
     {
         mo.Transform(transform, flags);
     }
     UpdateBoundingBox();
 }
コード例 #4
0
 public ScenarioObjectDatumStruct(BinaryReader binaryReader)
 {
     this.placementFlags = (PlacementFlags)binaryReader.ReadInt32();
     this.position = binaryReader.ReadVector3();
     this.rotation = binaryReader.ReadVector3();
     this.scale = binaryReader.ReadSingle();
     this.transformFlags = (TransformFlags)binaryReader.ReadInt16();
     this.manualBSPFlags = binaryReader.ReadBlockFlags16();
     this.objectID = new ScenarioObjectIdStruct(binaryReader);
     this.bSPPolicy = (BSPPolicy)binaryReader.ReadByte();
     this.padding = binaryReader.ReadByte();
     this.editorFolder = binaryReader.ReadShortBlockIndex1();
 }
コード例 #5
0
 public TransformEditOperation(IUnitTransformation transformation, TransformFlags transformFlags)
 {
     _transformation = transformation;
     _transformFlags = transformFlags;
 }
コード例 #6
0
ファイル: Differ.cs プロジェクト: slamj1/Core-4
        private void UpdateTransformSummaryInformationTable(Table summaryInfoTable, TransformFlags validationFlags)
        {
            // calculate the minimum version of MSI required to process the transform
            int targetMin;
            int updatedMin;
            int minimumVersion = 100;

            if (Int32.TryParse(this.transformSummaryInfo.TargetMinimumVersion, out targetMin) && Int32.TryParse(this.transformSummaryInfo.UpdatedMinimumVersion, out updatedMin))
            {
                minimumVersion = Math.Max(targetMin, updatedMin);
            }

            Hashtable summaryRows = new Hashtable(summaryInfoTable.Rows.Count);

            foreach (Row row in summaryInfoTable.Rows)
            {
                summaryRows[row[0]] = row;

                if ((int)SummaryInformation.Transform.CodePage == (int)row[0])
                {
                    row.Fields[1].Data         = this.transformSummaryInfo.UpdatedSummaryInfoCodepage;
                    row.Fields[1].PreviousData = this.transformSummaryInfo.TargetSummaryInfoCodepage;
                }
                else if ((int)SummaryInformation.Transform.TargetPlatformAndLanguage == (int)row[0])
                {
                    row[1] = this.transformSummaryInfo.TargetPlatformAndLanguage;
                }
                else if ((int)SummaryInformation.Transform.UpdatedPlatformAndLanguage == (int)row[0])
                {
                    row[1] = this.transformSummaryInfo.UpdatedPlatformAndLanguage;
                }
                else if ((int)SummaryInformation.Transform.ProductCodes == (int)row[0])
                {
                    row[1] = String.Concat(this.transformSummaryInfo.TargetProductCode, this.transformSummaryInfo.TargetProductVersion, ';', this.transformSummaryInfo.UpdatedProductCode, this.transformSummaryInfo.UpdatedProductVersion, ';', this.transformSummaryInfo.TargetUpgradeCode);
                }
                else if ((int)SummaryInformation.Transform.InstallerRequirement == (int)row[0])
                {
                    row[1] = minimumVersion.ToString(CultureInfo.InvariantCulture);
                }
                else if ((int)SummaryInformation.Transform.Security == (int)row[0])
                {
                    row[1] = "4";
                }
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.TargetPlatformAndLanguage))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.TargetPlatformAndLanguage;
                summaryRow[1] = this.transformSummaryInfo.TargetPlatformAndLanguage;
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.UpdatedPlatformAndLanguage))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.UpdatedPlatformAndLanguage;
                summaryRow[1] = this.transformSummaryInfo.UpdatedPlatformAndLanguage;
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.ValidationFlags))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.ValidationFlags;
                summaryRow[1] = ((int)validationFlags).ToString(CultureInfo.InvariantCulture);
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.InstallerRequirement))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.InstallerRequirement;
                summaryRow[1] = minimumVersion.ToString(CultureInfo.InvariantCulture);
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.Security))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.Security;
                summaryRow[1] = "4";
            }
        }
コード例 #7
0
ファイル: Face.cs プロジェクト: NCC-Lykos/Chisel
        public virtual void Transform(IUnitTransformation transform, TransformFlags flags)
        {
            foreach (var t in Vertices)
            {
                t.Location = transform.Transform(t.Location);
            }
            Plane  = new Plane(Vertices[0].Location, Vertices[1].Location, Vertices[2].Location);
            Colour = Colour;

            var origin = transform.Transform(Coordinate.Zero);
            var ua     = transform.Transform(Texture.UAxis) - origin;
            var va     = transform.Transform(Texture.VAxis) - origin;

            if (flags.HasFlag(TransformFlags.TextureScalingLock) && Texture.Texture != null)
            {
                // Make a best-effort guess of retaining scaling. All bets are off during skew operations.
                // Transform the current texture axes
                // Multiply the scales by the magnitudes (they were normals before the transform operation)
                Texture.XScale *= ua.VectorMagnitude();
                Texture.YScale *= va.VectorMagnitude();
            }
            {
                //NOTE(SVK):Only edit solids not entities. //do entities have faces??
                if (this.Parent.Parent.GetType().Name == "World" && this.Parent.GetType().Name == "Solid")
                {
                    if (Texture.Flags.HasFlag(FaceFlags.TextureLocked))
                    {
                        Coordinate     Center = this.Parent.Parent.SelCenter;
                        Matrix         Xfrm   = transform.GetMatrix();
                        TransformFlags f      = (TransformFlags)0;
                        if (Xfrm != Matrix.Zero)
                        {
                            f = GetTransformFlags(Xfrm);
                        }
                        else
                        {
                            f = flags;
                        }


                        if (f.HasFlag(TransformFlags.Translate))
                        {
                            Texture.PositionRF = transform.Transform(Texture.PositionRF);
                        }

                        if (f.HasFlag(TransformFlags.Rotation))
                        {
                            Xfrm = ToRF(Xfrm);

                            Texture.TransformAngleRF = Xfrm * Texture.TransformAngleRF;
                            Texture.PositionRF       = Texture.PositionRF - Center;
                            Texture.PositionRF       = RotateRF(Xfrm, ToRF(Texture.PositionRF));
                            Texture.PositionRF       = ToChisel(Texture.PositionRF);
                            Texture.PositionRF       = Texture.PositionRF + Center;
                        }
                    }
                }
                else //entities etc...
                {
                    // Transform the texture axes and move them back to the origin
                    // Only do the transform if the axes end up being not perpendicular
                    // Otherwise just make a best-effort guess, same as the scaling lock

                    if (Math.Abs(ua.Dot(va)) < 0.0001m && DMath.Abs(Plane.Normal.Dot(ua.Cross(va).Normalise())) > 0.0001m)
                    {
                        Texture.UAxis = ua;
                        Texture.VAxis = va;
                    }
                    else
                    {
                        AlignTextureToWorld();
                    }
                    if (flags.HasFlag(TransformFlags.TextureLock) && Texture.Texture != null)
                    {
                        // Check some original reference points to see how the transform mutates them
                        var scaled   = (transform.Transform(Coordinate.One) - transform.Transform(Coordinate.Zero)).VectorMagnitude();
                        var original = (Coordinate.One - Coordinate.Zero).VectorMagnitude();
                        // Ignore texture lock when the transformation contains a scale
                        if (DMath.Abs(scaled - original) <= 0.01m)
                        {
                            // Calculate the new shift values based on the UV values of the vertices
                            var vtx = Vertices[0];
                            Texture.XShift = Texture.Texture.Width * vtx.TextureU - (vtx.Location.Dot(Texture.UAxis)) / Texture.XScale;
                            Texture.YShift = Texture.Texture.Height * vtx.TextureV - (vtx.Location.Dot(Texture.VAxis)) / Texture.YScale;
                        }
                    }
                }
            }

            AlignTexture();
            UpdateBoundingBox();
        }
コード例 #8
0
ファイル: Solid.cs プロジェクト: KonstantinUb/sledge
        public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags)
        {
            Faces.ForEach(f => f.Transform(transform, flags));

            // Handle flip transforms / negative scales
            var origin = GetOrigin();
            if (Faces.All(x => x.Plane.OnPlane(origin) >= 0))
            {
                // All planes are facing inwards - flip them all
                Faces.ForEach(x => x.Flip());
            }

            base.Transform(transform, flags);
        }
コード例 #9
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.PropertyField(hostTransform);
            EditorGUILayout.PropertyField(manipulationType);
            EditorGUILayout.PropertyField(allowFarManipulation);

            var handedness = (ManipulationHandFlags)manipulationType.intValue;

            EditorGUILayout.Space();
            GUIStyle  style         = EditorStyles.foldout;
            FontStyle previousStyle = style.fontStyle;

            style.fontStyle  = FontStyle.Bold;
            oneHandedFoldout = EditorGUILayout.Foldout(oneHandedFoldout, "One Handed Manipulation", true);

            if (oneHandedFoldout)
            {
                if (handedness.HasFlag(ManipulationHandFlags.OneHanded))
                {
                    EditorGUILayout.PropertyField(oneHandRotationModeNear);
                    EditorGUILayout.PropertyField(oneHandRotationModeFar);
                }
                else
                {
                    EditorGUILayout.HelpBox("One handed manipulation disabled. If you wish to enable one handed manipulation select it as a Manipulation Type above.", MessageType.Info);
                }
            }

            EditorGUILayout.Space();
            twoHandedFoldout = EditorGUILayout.Foldout(twoHandedFoldout, "Two Handed Manipulation", true);

            if (twoHandedFoldout)
            {
                if (handedness.HasFlag(ManipulationHandFlags.TwoHanded))
                {
                    EditorGUILayout.PropertyField(twoHandedManipulationType);
                }
                else
                {
                    EditorGUILayout.HelpBox("Two handed manipulation disabled. If you wish to enable two handed manipulation select it as a Manipulation Type above.", MessageType.Info);
                }
            }

            var mh = (ObjectManipulator)target;
            var rb = mh.HostTransform.GetComponent <Rigidbody>();

            EditorGUILayout.Space();
            constraintsFoldout = InspectorUIUtility.DrawComponentTypeFoldout <TransformConstraint>(mh.gameObject, constraintsFoldout, "Constraint");

            EditorGUILayout.Space();
            physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true);

            if (physicsFoldout)
            {
                if (rb != null)
                {
                    EditorGUILayout.PropertyField(releaseBehavior);
                    EditorGUILayout.PropertyField(useForcesForNearManipulation);
                }
                else
                {
                    EditorGUILayout.HelpBox("Physics options disabled. If you wish to enable physics options, add a Rigidbody component to this object.", MessageType.Info);
                }
            }

            EditorGUILayout.Space();
            smoothingFoldout = EditorGUILayout.Foldout(smoothingFoldout, "Smoothing", true);

            if (smoothingFoldout)
            {
                EditorGUILayout.PropertyField(smoothingFar);
                EditorGUILayout.PropertyField(smoothingNear);
                EditorGUILayout.PropertyField(moveLerpTime);
                EditorGUILayout.PropertyField(rotateLerpTime);
                EditorGUILayout.PropertyField(scaleLerpTime);
            }

            EditorGUILayout.Space();
            elasticsFoldout = EditorGUILayout.Foldout(elasticsFoldout, "Elastics", true);

            if (elasticsFoldout)
            {
                // This two-way enum cast is required because EnumFlagsField does not play nicely with
                // SerializedProperties and custom enum flags.
                var newElasticTypesValue = EditorGUILayout.EnumFlagsField("Manipulation types using elastic feedback: ", (TransformFlags)elasticTypes.intValue);
                elasticTypes.intValue = (int)(TransformFlags)newElasticTypesValue;

                // If the particular elastic type is requested, we offer the user the ability
                // to configure the elastic system.
                TransformFlags currentFlags = (TransformFlags)elasticTypes.intValue;

                translationElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>(
                    "Translation Elastic",
                    translationElasticFoldout,
                    translationElasticConfigurationObject,
                    translationElasticExtent,
                    TransformFlags.Move,
                    currentFlags);

                rotationElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>(
                    "Rotation Elastic",
                    rotationElasticFoldout,
                    rotationElasticConfigurationObject,
                    rotationElasticExtent,
                    TransformFlags.Rotate,
                    currentFlags);

                scaleElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>(
                    "Scale Elastic",
                    scaleElasticFoldout,
                    scaleElasticConfigurationObject,
                    scaleElasticExtent,
                    TransformFlags.Scale,
                    currentFlags);
            }

            EditorGUILayout.Space();
            eventsFoldout = EditorGUILayout.Foldout(eventsFoldout, "Manipulation Events", true);

            if (eventsFoldout)
            {
                EditorGUILayout.PropertyField(onManipulationStarted);
                EditorGUILayout.PropertyField(onManipulationEnded);
                EditorGUILayout.PropertyField(onHoverEntered);
                EditorGUILayout.PropertyField(onHoverExited);
            }

            // reset foldouts style
            style.fontStyle = previousStyle;

            serializedObject.ApplyModifiedProperties();
        }
コード例 #10
0
ファイル: Solid.cs プロジェクト: Bananaman043/cbre
        public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags)
        {
            Faces.ForEach(f => f.Transform(transform, flags));

            // Handle flip transforms / negative scales
            var origin = GetOrigin();

            if (Faces.All(x => x.Plane.OnPlane(origin) >= 0))
            {
                // All planes are facing inwards - flip them all
                Faces.ForEach(x => x.Flip());
            }

            base.Transform(transform, flags);
        }
コード例 #11
0
        public override void OnInspectorGUI()
        {
            EditorGUILayout.PropertyField(hostTransform);
            EditorGUILayout.PropertyField(manipulationType);
            EditorGUILayout.PropertyField(allowFarManipulation);

            var handedness = (ManipulationHandFlags)manipulationType.intValue;

            EditorGUILayout.Space();
            GUIStyle  style         = EditorStyles.foldout;
            FontStyle previousStyle = style.fontStyle;

            style.fontStyle  = FontStyle.Bold;
            oneHandedFoldout = EditorGUILayout.Foldout(oneHandedFoldout, "One Handed Manipulation", true);

            if (oneHandedFoldout)
            {
                if (handedness.HasFlag(ManipulationHandFlags.OneHanded))
                {
                    EditorGUILayout.PropertyField(oneHandRotationModeNear);
                    EditorGUILayout.PropertyField(oneHandRotationModeFar);
                }
                else
                {
                    EditorGUILayout.HelpBox("One handed manipulation disabled. If you wish to enable one handed manipulation select it as a Manipulation Type above.", MessageType.Info);
                }
            }

            EditorGUILayout.Space();
            twoHandedFoldout = EditorGUILayout.Foldout(twoHandedFoldout, "Two Handed Manipulation", true);

            if (twoHandedFoldout)
            {
                if (handedness.HasFlag(ManipulationHandFlags.TwoHanded))
                {
                    EditorGUILayout.PropertyField(twoHandedManipulationType);
                }
                else
                {
                    EditorGUILayout.HelpBox("Two handed manipulation disabled. If you wish to enable two handed manipulation select it as a Manipulation Type above.", MessageType.Info);
                }
            }

            var mh = (ObjectManipulator)target;
            var rb = mh.HostTransform.GetComponent <Rigidbody>();

            EditorGUILayout.Space();
            constraintsFoldout = EditorGUILayout.Foldout(constraintsFoldout, "Constraints", true);

            if (constraintsFoldout)
            {
                if (EditorGUILayout.DropdownButton(new GUIContent("Add Constraint"), FocusType.Keyboard))
                {
                    // create the menu and add items to it
                    GenericMenu menu = new GenericMenu();

                    var type  = typeof(TransformConstraint);
                    var types = AppDomain.CurrentDomain.GetAssemblies()
                                .SelectMany(s => s.GetLoadableTypes())
                                .Where(p => type.IsAssignableFrom(p) && !p.IsAbstract);

                    foreach (var derivedType in types)
                    {
                        menu.AddItem(new GUIContent(derivedType.Name), false, t => mh.gameObject.AddComponent((Type)t), derivedType);
                    }

                    menu.ShowAsContext();
                }

                var constraints = mh.GetComponents <TransformConstraint>();

                foreach (var constraint in constraints)
                {
                    EditorGUILayout.BeginHorizontal();
                    string constraintName = constraint.GetType().Name;
                    EditorGUILayout.LabelField(constraintName);
                    if (GUILayout.Button("Go to component"))
                    {
                        Highlighter.Highlight("Inspector", $"{ObjectNames.NicifyVariableName(constraintName)} (Script)");
                        EditorGUIUtility.ExitGUI();
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.Space();
            physicsFoldout = EditorGUILayout.Foldout(physicsFoldout, "Physics", true);

            if (physicsFoldout)
            {
                if (rb != null)
                {
                    EditorGUILayout.PropertyField(releaseBehavior);
                }
                else
                {
                    EditorGUILayout.HelpBox("Physics options disabled. If you wish to enable physics options, add a Rigidbody component to this object.", MessageType.Info);
                }
            }

            EditorGUILayout.Space();
            smoothingFoldout = EditorGUILayout.Foldout(smoothingFoldout, "Smoothing", true);

            if (smoothingFoldout)
            {
                EditorGUILayout.PropertyField(smoothingActive);
                EditorGUILayout.PropertyField(moveLerpTime);
                EditorGUILayout.PropertyField(rotateLerpTime);
                EditorGUILayout.PropertyField(scaleLerpTime);
            }

            EditorGUILayout.Space();
            elasticsFoldout = EditorGUILayout.Foldout(elasticsFoldout, "Elastics", true);

            if (elasticsFoldout)
            {
                // This two-way enum cast is required because EnumFlagsField does not play nicely with
                // SerializedProperties and custom enum flags.
                var newElasticTypesValue = EditorGUILayout.EnumFlagsField("Manipulation types using elastic feedback: ", (TransformFlags)elasticTypes.intValue);
                elasticTypes.intValue = (int)(TransformFlags)newElasticTypesValue;

                // If the particular elastic type is requested, we offer the user the ability
                // to configure the elastic system.
                TransformFlags currentFlags = (TransformFlags)elasticTypes.intValue;

                translationElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>(
                    "Translation Elastic",
                    translationElasticFoldout,
                    translationElasticConfigurationObject,
                    translationElasticExtent,
                    TransformFlags.Move,
                    currentFlags);

                rotationElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>(
                    "Rotation Elastic",
                    rotationElasticFoldout,
                    rotationElasticConfigurationObject,
                    rotationElasticExtent,
                    TransformFlags.Rotate,
                    currentFlags);

                scaleElasticFoldout = DrawElasticConfiguration <ElasticConfiguration>(
                    "Scale Elastic",
                    scaleElasticFoldout,
                    scaleElasticConfigurationObject,
                    scaleElasticExtent,
                    TransformFlags.Scale,
                    currentFlags);
            }

            EditorGUILayout.Space();
            eventsFoldout = EditorGUILayout.Foldout(eventsFoldout, "Manipulation Events", true);

            if (eventsFoldout)
            {
                EditorGUILayout.PropertyField(onManipulationStarted);
                EditorGUILayout.PropertyField(onManipulationEnded);
                EditorGUILayout.PropertyField(onHoverEntered);
                EditorGUILayout.PropertyField(onHoverExited);
            }

            // reset foldouts style
            style.fontStyle = previousStyle;

            serializedObject.ApplyModifiedProperties();
        }
コード例 #12
0
ファイル: Entity.cs プロジェクト: NCC-Lykos/Chisel
 public override void Transform(IUnitTransformation transform, TransformFlags flags)
 {
     Origin = transform.Transform(Origin);
     base.Transform(transform, flags);
 }
コード例 #13
0
        /// <summary>
        /// Creates a transform by diffing two outputs.
        /// </summary>
        /// <param name="targetOutput">The target output.</param>
        /// <param name="updatedOutput">The updated output.</param>
        /// <param name="validationFlags"></param>
        /// <returns>The transform.</returns>
        public Output Diff(Output targetOutput, Output updatedOutput, TransformFlags validationFlags)
        {
            Output transform = new Output(null);

            transform.Type            = OutputType.Transform;
            transform.Codepage        = updatedOutput.Codepage;
            this.transformSummaryInfo = new SummaryInformationStreams();

            // compare the codepages
            if (targetOutput.Codepage != updatedOutput.Codepage && 0 == (TransformFlags.ErrorChangeCodePage & validationFlags))
            {
                this.OnMessage(WixErrors.OutputCodepageMismatch(targetOutput.SourceLineNumbers, targetOutput.Codepage, updatedOutput.Codepage));
                if (null != updatedOutput.SourceLineNumbers)
                {
                    this.OnMessage(WixErrors.OutputCodepageMismatch2(updatedOutput.SourceLineNumbers));
                }
            }

            // compare the output types
            if (targetOutput.Type != updatedOutput.Type)
            {
                throw new WixException(WixErrors.OutputTypeMismatch(targetOutput.SourceLineNumbers, targetOutput.Type.ToString(), updatedOutput.Type.ToString()));
            }

            // compare the contents of the tables
            foreach (Table targetTable in targetOutput.Tables)
            {
                Table          updatedTable = updatedOutput.Tables[targetTable.Name];
                TableOperation operation    = TableOperation.None;

                RowCollection rows = this.CompareTables(targetOutput, targetTable, updatedTable, out operation);

                if (TableOperation.Drop == operation)
                {
                    Table droppedTable = transform.Tables.EnsureTable(null, targetTable.Definition);
                    droppedTable.Operation = TableOperation.Drop;
                }
                else if (TableOperation.None == operation)
                {
                    Table modified = transform.Tables.EnsureTable(null, updatedTable.Definition);
                    modified.Rows.AddRange(rows);
                }
            }

            // added tables
            foreach (Table updatedTable in updatedOutput.Tables)
            {
                if (null == targetOutput.Tables[updatedTable.Name])
                {
                    Table addedTable = transform.Tables.EnsureTable(null, updatedTable.Definition);
                    addedTable.Operation = TableOperation.Add;

                    foreach (Row updatedRow in updatedTable.Rows)
                    {
                        updatedRow.Operation = RowOperation.Add;
                        updatedRow.SectionId = sectionDelimiter + updatedRow.SectionId;
                        addedTable.Rows.Add(updatedRow);
                    }
                }
            }

            // set summary information properties
            if (!this.suppressKeepingSpecialRows)
            {
                Table summaryInfoTable = transform.Tables["_SummaryInformation"];
                this.UpdateTransformSummaryInformationTable(summaryInfoTable, validationFlags);
            }

            // inspect the transform
            InspectorCore inspectorCore = new InspectorCore(this.Message);

            foreach (InspectorExtension inspectorExtension in this.inspectorExtensions)
            {
                inspectorExtension.Core = inspectorCore;
                inspectorExtension.InspectTransform(transform);

                // reset
                inspectorExtension.Core = null;
            }

            return(transform);
        }
コード例 #14
0
ファイル: Differ.cs プロジェクト: Jeremiahf/wix3
        private void UpdateTransformSummaryInformationTable(Table summaryInfoTable, TransformFlags validationFlags)
        {
            // calculate the minimum version of MSI required to process the transform
            int targetMin;
            int updatedMin;
            int minimumVersion = 100;

            if (Int32.TryParse(this.transformSummaryInfo.TargetMinimumVersion, out targetMin) && Int32.TryParse(this.transformSummaryInfo.UpdatedMinimumVersion, out updatedMin))
            {
                minimumVersion = Math.Max(targetMin, updatedMin);
            }

            Hashtable summaryRows = new Hashtable(summaryInfoTable.Rows.Count);
            foreach (Row row in summaryInfoTable.Rows)
            {
                summaryRows[row[0]] = row;

                if ((int)SummaryInformation.Transform.CodePage == (int)row[0])
                {
                    row.Fields[1].Data = this.transformSummaryInfo.UpdatedSummaryInfoCodepage;
                    row.Fields[1].PreviousData = this.transformSummaryInfo.TargetSummaryInfoCodepage;
                }
                else if ((int)SummaryInformation.Transform.TargetPlatformAndLanguage == (int)row[0])
                {
                    row[1] = this.transformSummaryInfo.TargetPlatformAndLanguage;
                }
                else if ((int)SummaryInformation.Transform.UpdatedPlatformAndLanguage == (int)row[0])
                {
                    row[1] = this.transformSummaryInfo.UpdatedPlatformAndLanguage;
                }
                else if ((int)SummaryInformation.Transform.ProductCodes == (int)row[0])
                {
                    row[1] = String.Concat(this.transformSummaryInfo.TargetProductCode, this.transformSummaryInfo.TargetProductVersion, ';', this.transformSummaryInfo.UpdatedProductCode, this.transformSummaryInfo.UpdatedProductVersion, ';', this.transformSummaryInfo.TargetUpgradeCode);
                }
                else if ((int)SummaryInformation.Transform.InstallerRequirement == (int)row[0])
                {
                    row[1] = minimumVersion.ToString(CultureInfo.InvariantCulture);
                }
                else if ((int)SummaryInformation.Transform.Security == (int)row[0])
                {
                    row[1] = "4";
                }
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.TargetPlatformAndLanguage))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.TargetPlatformAndLanguage;
                summaryRow[1] = this.transformSummaryInfo.TargetPlatformAndLanguage;
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.UpdatedPlatformAndLanguage))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.UpdatedPlatformAndLanguage;
                summaryRow[1] = this.transformSummaryInfo.UpdatedPlatformAndLanguage;
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.ValidationFlags))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.ValidationFlags;
                summaryRow[1] = ((int)validationFlags).ToString(CultureInfo.InvariantCulture);
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.InstallerRequirement))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.InstallerRequirement;
                summaryRow[1] = minimumVersion.ToString(CultureInfo.InvariantCulture);
            }

            if (!summaryRows.Contains((int)SummaryInformation.Transform.Security))
            {
                Row summaryRow = summaryInfoTable.CreateRow(null);
                summaryRow[0] = (int)SummaryInformation.Transform.Security;
                summaryRow[1] = "4";
            }
        }
コード例 #15
0
ファイル: PasteSpecial.cs プロジェクト: juanjp600/cbre
        private IEnumerable <MapObject> CreateCopy(IDGenerator gen, Coordinate origin, Coordinate rotation, List <string> names, TransformFlags transformFlags)
        {
            var box = new Box(_objectsToPaste.Select(x => x.BoundingBox));

            var mov       = Matrix.Translation(-box.Center);                                    // Move to zero
            var rot       = Matrix.Rotation(Quaternion.EulerAngles(rotation * DMath.PI / 180)); // Do rotation
            var fin       = Matrix.Translation(origin);                                         // Move to final origin
            var transform = new UnitMatrixMult(fin * rot * mov);

            foreach (var mo in _objectsToPaste)
            {
                // Copy, transform and fix entity names
                var copy = mo.Copy(gen);
                copy.Transform(transform, transformFlags);
                FixEntityNames(copy, names);
                yield return(copy);
            }
        }
コード例 #16
0
ファイル: Face.cs プロジェクト: silky/sledge
        public virtual void Transform(IUnitTransformation transform, TransformFlags flags)
        {
            foreach (var t in Vertices)
            {
                t.Location = transform.Transform(t.Location);
            }
            Plane = new Plane(Vertices[0].Location, Vertices[1].Location, Vertices[2].Location);
            Colour = Colour;
            if (flags.HasFlag(TransformFlags.TextureScalingLock) && Texture.Texture != null)
            {
                // Make a best-effort guess of retaining scaling. All bets are off during skew operations.
                // Transform the current texture axes
                var origin = transform.Transform(Coordinate.Zero);
                var ua = transform.Transform(Texture.UAxis) - origin;
                var va = transform.Transform(Texture.VAxis) - origin;
                // Multiply the scales by the magnitudes (they were normals before the transform operation)
                Texture.XScale *= ua.VectorMagnitude();
                Texture.YScale *= va.VectorMagnitude();
            }
            {
                // Transform the texture axes and move them back to the origin
                var origin = transform.Transform(Coordinate.Zero);
                var ua = transform.Transform(Texture.UAxis) - origin;
                var va = transform.Transform(Texture.VAxis) - origin;

                // Only do the transform if the axes end up being not perpendicular
                // Otherwise just make a best-effort guess, same as the scaling lock
                if (Math.Abs(ua.Dot(va)) < 0.0001m && DMath.Abs(Plane.Normal.Dot(ua.Cross(va).Normalise())) > 0.0001m)
                {
                    Texture.UAxis = ua;
                    Texture.VAxis = va;
                }
                else
                {
                    AlignTextureToFace();
                }

                if (flags.HasFlag(TransformFlags.TextureLock) && Texture.Texture != null)
                {
                    // Check some original reference points to see how the transform mutates them
                    var scaled = (transform.Transform(Coordinate.One) - transform.Transform(Coordinate.Zero)).VectorMagnitude();
                    var original = (Coordinate.One - Coordinate.Zero).VectorMagnitude();

                    // Ignore texture lock when the transformation contains a scale
                    if (DMath.Abs(scaled - original) <= 0.01m)
                    {
                        // Calculate the new shift values based on the UV values of the vertices
                        var vtx = Vertices[0];
                        Texture.XShift = Texture.Texture.Width * vtx.TextureU - (vtx.Location.Dot(Texture.UAxis)) / Texture.XScale;
                        Texture.YShift = Texture.Texture.Height * vtx.TextureV - (vtx.Location.Dot(Texture.VAxis)) / Texture.YScale;
                    }
                }
            }
            CalculateTextureCoordinates(true);
            UpdateBoundingBox();
        }
コード例 #17
0
ファイル: Differ.cs プロジェクト: AlexKubiesa/WixToolset.Core
        /// <summary>
        /// Creates a transform by diffing two outputs.
        /// </summary>
        /// <param name="targetOutput">The target output.</param>
        /// <param name="updatedOutput">The updated output.</param>
        /// <param name="validationFlags"></param>
        /// <returns>The transform.</returns>
        public WindowsInstallerData Diff(WindowsInstallerData targetOutput, WindowsInstallerData updatedOutput, TransformFlags validationFlags)
        {
            WindowsInstallerData transform = new WindowsInstallerData(null);

            transform.Type            = OutputType.Transform;
            transform.Codepage        = updatedOutput.Codepage;
            this.transformSummaryInfo = new SummaryInformationStreams();

            // compare the codepages
            if (targetOutput.Codepage != updatedOutput.Codepage && 0 == (TransformFlags.ErrorChangeCodePage & validationFlags))
            {
                this.messaging.Write(ErrorMessages.OutputCodepageMismatch(targetOutput.SourceLineNumbers, targetOutput.Codepage, updatedOutput.Codepage));
                if (null != updatedOutput.SourceLineNumbers)
                {
                    this.messaging.Write(ErrorMessages.OutputCodepageMismatch2(updatedOutput.SourceLineNumbers));
                }
            }

            // compare the output types
            if (targetOutput.Type != updatedOutput.Type)
            {
                throw new WixException(ErrorMessages.OutputTypeMismatch(targetOutput.SourceLineNumbers, targetOutput.Type.ToString(), updatedOutput.Type.ToString()));
            }

            // compare the contents of the tables
            foreach (Table targetTable in targetOutput.Tables)
            {
                Table          updatedTable = updatedOutput.Tables[targetTable.Name];
                TableOperation operation    = TableOperation.None;

                List <Row> rows = this.CompareTables(targetOutput, targetTable, updatedTable, out operation);

                if (TableOperation.Drop == operation)
                {
                    Table droppedTable = transform.EnsureTable(targetTable.Definition);
                    droppedTable.Operation = TableOperation.Drop;
                }
                else if (TableOperation.None == operation)
                {
                    Table modified = transform.EnsureTable(updatedTable.Definition);
                    rows.ForEach(r => modified.Rows.Add(r));
                }
            }

            // added tables
            foreach (Table updatedTable in updatedOutput.Tables)
            {
                if (null == targetOutput.Tables[updatedTable.Name])
                {
                    Table addedTable = transform.EnsureTable(updatedTable.Definition);
                    addedTable.Operation = TableOperation.Add;

                    foreach (Row updatedRow in updatedTable.Rows)
                    {
                        updatedRow.Operation = RowOperation.Add;
                        updatedRow.SectionId = sectionDelimiter + updatedRow.SectionId;
                        addedTable.Rows.Add(updatedRow);
                    }
                }
            }

            // set summary information properties
            if (!this.suppressKeepingSpecialRows)
            {
                Table summaryInfoTable = transform.Tables["_SummaryInformation"];
                this.UpdateTransformSummaryInformationTable(summaryInfoTable, validationFlags);
            }

            return(transform);
        }
コード例 #18
0
ファイル: SpawnInfo.cs プロジェクト: troymac1ure/Entity
            /// <summary>
            /// For ScaleRotateYawPitchRollSpawn objects, the first 52 bytes are all
            /// generic for Halo 2.
            /// </summary>
            /// <param name="map">The HaloMap.Map.Map</param>
            public override void Read(Map map)
            {
                map.BR.BaseStream.Position = this.offset;
                this.PaletteIndex = map.BR.ReadInt16();
                this.NameIndex = map.BR.ReadInt16();
                this.Placements = (PlacementFlags)map.BR.ReadInt32();

                this.X = map.BR.ReadSingle();
                this.Y = map.BR.ReadSingle();
                this.Z = map.BR.ReadSingle();
                switch (map.HaloVersion)
                {
                    // Halo 1 Stores values in Degrees
                    case HaloVersionEnum.Halo1:
                        this.Yaw = Renderer.DegreeToRadian(map.BR.ReadSingle());
                        this.Pitch = Renderer.DegreeToRadian(map.BR.ReadSingle());
                        this.Roll = Renderer.DegreeToRadian(map.BR.ReadSingle());
                        break;

                    case HaloVersionEnum.Halo2:
                    case HaloVersionEnum.Halo2Vista:
                        // Is this correct? I think it should be Yaw, Pitch, Roll.
                        // Before cleaing code into this shared read section some spawns
                        // were Y,P,R and some were R,P,Y.
                        this.Yaw = map.BR.ReadSingle();
                        this.Pitch = map.BR.ReadSingle();
                        this.Roll = map.BR.ReadSingle();
                        this.Scale = map.BR.ReadSingle();

                        // None of this is currently saved
                        this.Transforms = (TransformFlags)map.BR.ReadInt16();
                        this.ManualBSPs = (ManualBSPFlags)map.BR.ReadInt16();
                        this.UniqueID = map.BR.ReadUInt32();
                        this.OriginBSP = map.BR.ReadInt16();
                        this.MetaSpawnType = (SpawnTypeEnum)map.BR.ReadByte();
                        this.Source = (SourceEnum)map.BR.ReadByte();
                        this.BSPPolicy = (BSPPolicyEnum)map.BR.ReadByte(); ;
                        this.Unused = map.BR.ReadByte();
                        this.EditorFolder = map.BR.ReadInt16();
                        break;
                }
            }
コード例 #19
0
ファイル: Solid.cs プロジェクト: juanjp600/cbre
        public override void Transform(Transformations.IUnitTransformation transform, TransformFlags flags)
        {
            Coordinate newStart = transform.Transform(BoundingBox.Start);
            Coordinate newEnd   = transform.Transform(BoundingBox.End);

            if ((newStart - newEnd).VectorMagnitude() > 1000000m)
            {
                return;
            }

            Faces.ForEach(f => f.Transform(transform, flags));

            // Handle flip transforms / negative scales
            var origin = GetOrigin();

            if (Faces.All(x => x.Plane.OnPlane(origin) >= 0))
            {
                // All planes are facing inwards - flip them all
                Faces.ForEach(x => x.Flip());
            }

            base.Transform(transform, flags);
        }
コード例 #20
0
        private void ApplyConstraintsForType(ref MixedRealityTransform transform, bool isOneHanded, bool isNear, TransformFlags transformType)
        {
            ManipulationHandFlags      handMode      = isOneHanded ? ManipulationHandFlags.OneHanded : ManipulationHandFlags.TwoHanded;
            ManipulationProximityFlags proximityMode = isNear ? ManipulationProximityFlags.Near : ManipulationProximityFlags.Far;

            foreach (var constraint in constraints)
            {
                if (constraint.isActiveAndEnabled &&
                    constraint.ConstraintType == transformType &&
                    constraint.HandType.HasFlag(handMode) &&
                    constraint.ProximityType.HasFlag(proximityMode))
                {
                    constraint.ApplyConstraint(ref transform);
                }
            }
        }
コード例 #21
0
 public SnapToGridEditOperation(decimal gridSpacing, TransformFlags transformFlags)
 {
     _gridSpacing    = gridSpacing;
     _transformFlags = transformFlags;
 }
コード例 #22
0
 public TransformEditOperation(IUnitTransformation transformation, TransformFlags transformFlags)
 {
     _transformation = transformation;
     _transformFlags = transformFlags;
 }
コード例 #23
0
 /// <summary>
 /// Checks to determine if all bits in a provided mask are set.
 /// </summary>
 /// <param name="a"><see cref="TransformFlags"/> value.</param>
 /// <param name="b"><see cref="TransformFlags"/> mask.</param>
 /// <returns>
 /// True if all of the bits in the specified mask are set in the current value.
 /// </returns>
 public static bool IsMaskSet(this TransformFlags a, TransformFlags b)
 {
     return((a & b) == b);
 }
コード例 #24
0
ファイル: torch.cs プロジェクト: Jeremiahf/wix3
        /// <summary>
        /// Parse the commandline arguments.
        /// </summary>
        /// <param name="args">Commandline arguments.</param>
        private void ParseCommandLine(string[] args)
        {
            bool usingTransformType = false;
            for (int i = 0; i < args.Length; ++i)
            {
                string arg = args[i];
                if (null == arg || 0 == arg.Length) // skip blank arguments
                {
                    continue;
                }

                if ('-' == arg[0] || '/' == arg[0])
                {
                    string parameter = arg.Substring(1);

                    if ("a" == parameter)
                    {
                        this.adminImage = true;
                    }
                    else if ("ax" == parameter)
                    {
                        this.exportBasePath = CommandLine.GetDirectory(parameter, this.messageHandler, args, ++i);

                        if (String.IsNullOrEmpty(this.exportBasePath))
                        {
                            return;
                        }

                        this.adminImage = true;
                    }
                    else if ("ext" == parameter)
                    {
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.TypeSpecificationForExtensionRequired("-ext"));
                            return;
                        }

                        this.extensionList.Add(args[i]);
                    }
                    else if ("nologo" == parameter)
                    {
                        this.showLogo = false;
                    }
                    else if ("notidy" == parameter)
                    {
                        this.tidy = false;
                    }
                    else if ("o" == parameter || "out" == parameter)
                    {
                        this.outputFile = CommandLine.GetFile(parameter, this.messageHandler, args, ++i);

                        if (String.IsNullOrEmpty(this.outputFile))
                        {
                            return;
                        }
                    }
                    else if ("p" == parameter)
                    {
                        this.preserveUnchangedRows = true;
                    }
                    else if ("pedantic" == parameter)
                    {
                        this.showPedanticMessages = true;
                    }
                    else if ("swall" == parameter)
                    {
                        this.messageHandler.Display(this, WixWarnings.DeprecatedCommandLineSwitch("swall", "sw"));
                        this.messageHandler.SuppressAllWarnings = true;
                    }
                    else if (parameter.StartsWith("sw", StringComparison.Ordinal))
                    {
                        string paramArg = parameter.Substring(2);
                        try
                        {
                            if (0 == paramArg.Length)
                            {
                                this.messageHandler.SuppressAllWarnings = true;
                            }
                            else
                            {
                                int suppressWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat);
                                if (0 >= suppressWarning)
                                {
                                    this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg));
                                }

                                this.messageHandler.SuppressWarningMessage(suppressWarning);
                            }
                        }
                        catch (FormatException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg));
                        }
                        catch (OverflowException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg));
                        }
                    }
                    else if ("wxall" == parameter)
                    {
                        this.messageHandler.Display(this, WixWarnings.DeprecatedCommandLineSwitch("wxall", "wx"));
                        this.messageHandler.WarningAsError = true;
                    }
                    else if (parameter.StartsWith("wx", StringComparison.Ordinal))
                    {
                        string paramArg = parameter.Substring(2);
                        try
                        {
                            if (0 == paramArg.Length)
                            {
                                this.messageHandler.WarningAsError = true;
                            }
                            else
                            {
                                int elevateWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat);
                                if (0 >= elevateWarning)
                                {
                                    this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg));
                                }

                                this.messageHandler.ElevateWarningMessage(elevateWarning);
                            }
                        }
                        catch (FormatException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg));
                        }
                        catch (OverflowException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg));
                        }
                    }
                    else if ("serr" == parameter)
                    {
                        // arguments consistent with msitran.exe
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                            return;
                        }

                        if (usingTransformType)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalValidationArguments());
                        }
                        else
                        {
                            switch (args[i].ToLower())
                            {
                                case "a":
                                    this.validationFlags |= TransformFlags.ErrorAddExistingRow;
                                    break;
                                case "b":
                                    this.validationFlags |= TransformFlags.ErrorDeleteMissingRow;
                                    break;
                                case "c":
                                    this.validationFlags |= TransformFlags.ErrorAddExistingTable;
                                    break;
                                case "d":
                                    this.validationFlags |= TransformFlags.ErrorDeleteMissingTable;
                                    break;
                                case "e":
                                    this.validationFlags |= TransformFlags.ErrorUpdateMissingRow;
                                    break;
                                case "f":
                                    this.validationFlags |= TransformFlags.ErrorChangeCodePage;
                                    break;
                                default:
                                    this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                                    break;
                            }
                        }
                    }
                    else if ("t" == parameter)
                    {
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                            return;
                        }

                        if (0 != this.validationFlags)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalValidationArguments());
                        }
                        else
                        {
                            switch (args[i].ToLower())
                            {
                                case "language":
                                    this.validationFlags = TransformFlags.LanguageTransformDefault;
                                    break;
                                case "instance":
                                    this.validationFlags = TransformFlags.InstanceTransformDefault;
                                    break;
                                case "patch":
                                    this.validationFlags = TransformFlags.PatchTransformDefault;
                                    break;
                                default:
                                    this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                                    return;
                            }

                            usingTransformType = true;
                        }
                    }
                    else if ("v" == parameter)
                    {
                        this.messageHandler.ShowVerboseMessages = true;
                    }
                    else if ("val" == parameter)
                    {
                        // arguments consistent with msitran.exe
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                            return;
                        }

                        if (usingTransformType)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalValidationArguments());
                        }
                        else
                        {
                            switch (args[i].ToLower())
                            {
                                case "g":
                                    this.validationFlags |= TransformFlags.ValidateUpgradeCode;
                                    break;
                                case "l":
                                    this.validationFlags |= TransformFlags.ValidateLanguage;
                                    break;
                                case "r":
                                    this.validationFlags |= TransformFlags.ValidateProduct;
                                    break;
                                case "s":
                                    this.validationFlags |= TransformFlags.ValidateMajorVersion;
                                    break;
                                case "t":
                                    this.validationFlags |= TransformFlags.ValidateMinorVersion;
                                    break;
                                case "u":
                                    this.validationFlags |= TransformFlags.ValidateUpdateVersion;
                                    break;
                                case "v":
                                    this.validationFlags |= TransformFlags.ValidateNewLessBaseVersion;
                                    break;
                                case "w":
                                    this.validationFlags |= TransformFlags.ValidateNewLessEqualBaseVersion;
                                    break;
                                case "x":
                                    this.validationFlags |= TransformFlags.ValidateNewEqualBaseVersion;
                                    break;
                                case "y":
                                    this.validationFlags |= TransformFlags.ValidateNewGreaterEqualBaseVersion;
                                    break;
                                case "z":
                                    this.validationFlags |= TransformFlags.ValidateNewGreaterBaseVersion;
                                    break;
                                default:
                                    this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                                    break;
                            }
                        }
                    }
                    else if ("x" == parameter)
                    {
                        this.exportBasePath = CommandLine.GetDirectory(parameter, this.messageHandler, args, ++i);

                        if (String.IsNullOrEmpty(this.exportBasePath))
                        {
                            return;
                        }
                    }
                    else if ("xi" == parameter)
                    {
                        this.xmlInputs = true;
                    }
                    else if ("xo" == parameter)
                    {
                        this.xmlOutput = true;
                    }
                    else if ("?" == parameter || "help" == parameter)
                    {
                        this.showHelp = true;
                        return;
                    }
                    else
                    {
                        this.invalidArgs.Add(parameter);
                    }
                }
                else if ('@' == arg[0])
                {
                    this.ParseCommandLine(CommandLineResponseFile.Parse(arg.Substring(1)));
                }
                else
                {
                    string inputFile = CommandLine.VerifyPath(this.messageHandler, arg);

                    if (String.IsNullOrEmpty(inputFile))
                    {
                        return;
                    }

                    this.inputFiles.Add(inputFile);
                }
            }
        }
コード例 #25
0
 protected Transform(TransformFlags flags, MissingTargetMessage message)
 {
     this.missingTargetMessage           = message;
     this.applyTransformToAllTargetNodes = (flags & TransformFlags.ApplyTransformToAllTargetNodes) == TransformFlags.ApplyTransformToAllTargetNodes;
     this.useParentAsTargetNode          = (flags & TransformFlags.UseParentAsTargetNode) == TransformFlags.UseParentAsTargetNode;
 }
コード例 #26
0
ファイル: Face.cs プロジェクト: jpiolho/sledge
 public virtual void Transform(IUnitTransformation transform, TransformFlags flags)
 {
     foreach (var t in Vertices)
     {
         t.Location = transform.Transform(t.Location);
     }
     Plane = new Plane(Vertices[0].Location, Vertices[1].Location, Vertices[2].Location);
     Colour = Colour;
     if (flags.HasFlag(TransformFlags.TextureScalingLock) && Texture.Texture != null)
     {
         // Make a best-effort guess of retaining scaling. All bets are off during skew operations.
         // Transform the current texture axes
         var origin = transform.Transform(Coordinate.Zero);
         var ua = transform.Transform(Texture.UAxis) - origin;
         var va = transform.Transform(Texture.VAxis) - origin;
         // Multiply the scales by the magnitudes (they were normals before the transform operation)
         Texture.XScale *= ua.VectorMagnitude();
         Texture.YScale *= va.VectorMagnitude();
     }
     if (flags.HasFlag(TransformFlags.TextureLock) && Texture.Texture != null)
     {
         // Transform the texture axes and move them back to the origin
         var origin = transform.Transform(Coordinate.Zero);
         var ua = transform.Transform(Texture.UAxis) - origin;
         var va = transform.Transform(Texture.VAxis) - origin;
         // Only do the transform if the axes end up being not perpendicular
         // Otherwise just make a best-effort guess, same as the scaling lock
         if (Math.Abs(ua.Dot(va)) < 0.0001m)
         {
             Texture.UAxis = ua;
             Texture.VAxis = va;
         }
         // Calculate the new shift values based on the UV values of the vertices
         var vtx = Vertices[0];
         Texture.XShift = Texture.Texture.Width * vtx.TextureU - (vtx.Location.Dot(Texture.UAxis)) / Texture.XScale;
         Texture.YShift = Texture.Texture.Height * vtx.TextureV - (vtx.Location.Dot(Texture.VAxis)) / Texture.YScale;
     }
     else
     {
         // During rotate/skew operations we'll mess up the texture axes, just reset them.
         AlignTextureToFace();
     }
     CalculateTextureCoordinates();
     UpdateBoundingBox();
 }
コード例 #27
0
ファイル: Transform.cs プロジェクト: niklaslundberg/Arbor.Xdt
 protected Transform(TransformFlags flags)
     : this(flags, MissingTargetMessage.Warning)
 {
 }
コード例 #28
0
ファイル: MapObject.cs プロジェクト: ChristopherHaws/sledge
 public virtual void Transform(IUnitTransformation transform, TransformFlags flags)
 {
     Children.ForEach(c => c.Transform(transform, flags));
     UpdateBoundingBox();
 }
コード例 #29
0
 protected internal void WorldMatrixBecameDirty()
 {
     _flags |= TransformFlags.WorldMatrixIsDirty;
     TransformBecameDirty?.Invoke();
 }
コード例 #30
0
ファイル: Differ.cs プロジェクト: Jeremiahf/wix3
        /// <summary>
        /// Creates a transform by diffing two outputs.
        /// </summary>
        /// <param name="targetOutput">The target output.</param>
        /// <param name="updatedOutput">The updated output.</param>
        /// <param name="validationFlags"></param>
        /// <returns>The transform.</returns>
        public Output Diff(Output targetOutput, Output updatedOutput, TransformFlags validationFlags)
        {
            Output transform = new Output(null);
            transform.Type = OutputType.Transform;
            transform.Codepage = updatedOutput.Codepage;
            this.transformSummaryInfo = new SummaryInformationStreams();

            // compare the codepages
            if (targetOutput.Codepage != updatedOutput.Codepage && 0 == (TransformFlags.ErrorChangeCodePage & validationFlags))
            {
                this.OnMessage(WixErrors.OutputCodepageMismatch(targetOutput.SourceLineNumbers, targetOutput.Codepage, updatedOutput.Codepage));
                if (null != updatedOutput.SourceLineNumbers)
                {
                    this.OnMessage(WixErrors.OutputCodepageMismatch2(updatedOutput.SourceLineNumbers));
                }
            }

            // compare the output types
            if (targetOutput.Type != updatedOutput.Type)
            {
                throw new WixException(WixErrors.OutputTypeMismatch(targetOutput.SourceLineNumbers, targetOutput.Type.ToString(), updatedOutput.Type.ToString()));
            }

            // compare the contents of the tables
            foreach (Table targetTable in targetOutput.Tables)
            {
                Table updatedTable = updatedOutput.Tables[targetTable.Name];
                TableOperation operation = TableOperation.None;

                RowCollection rows = this.CompareTables(targetOutput, targetTable, updatedTable, out operation);

                if (TableOperation.Drop == operation)
                {
                    Table droppedTable = transform.Tables.EnsureTable(null, targetTable.Definition);
                    droppedTable.Operation = TableOperation.Drop;
                }
                else if(TableOperation.None == operation)
                {
                    Table modified = transform.Tables.EnsureTable(null, updatedTable.Definition);
                    modified.Rows.AddRange(rows);
                }
            }

            // added tables
            foreach (Table updatedTable in updatedOutput.Tables)
            {
                if (null == targetOutput.Tables[updatedTable.Name])
                {
                    Table addedTable = transform.Tables.EnsureTable(null, updatedTable.Definition);
                    addedTable.Operation = TableOperation.Add;

                    foreach (Row updatedRow in updatedTable.Rows)
                    {
                        updatedRow.Operation = RowOperation.Add;
                        updatedRow.SectionId = sectionDelimiter + updatedRow.SectionId;
                        addedTable.Rows.Add(updatedRow);
                    }
                }
            }

            // set summary information properties
            if (!this.suppressKeepingSpecialRows)
            {
                Table summaryInfoTable = transform.Tables["_SummaryInformation"];
                this.UpdateTransformSummaryInformationTable(summaryInfoTable, validationFlags);
            }

            // inspect the transform
            InspectorCore inspectorCore = new InspectorCore(this.Message);
            foreach (InspectorExtension inspectorExtension in this.inspectorExtensions)
            {
                inspectorExtension.Core = inspectorCore;
                inspectorExtension.InspectTransform(transform);

                // reset
                inspectorExtension.Core = null;
            }

            return transform;
        }
コード例 #31
0
ファイル: PasteSpecial.cs プロジェクト: jpiolho/sledge
        private IEnumerable<MapObject> CreateCopy(IDGenerator gen, Coordinate origin, Coordinate rotation, List<string> names, TransformFlags transformFlags)
        {
            var box = new Box(_objectsToPaste.Select(x => x.BoundingBox));

            var mov = Matrix.Translation(-box.Center); // Move to zero
            var rot = Matrix.Rotation(Quaternion.EulerAngles(rotation * DMath.PI / 180)); // Do rotation
            var fin = Matrix.Translation(origin); // Move to final origin
            var transform = new UnitMatrixMult(fin * rot * mov);

            foreach (var mo in _objectsToPaste)
            {
                // Copy, transform and fix entity names
                var copy = mo.Copy(gen);
                copy.Transform(transform, transformFlags);
                FixEntityNames(copy, names);
                yield return copy;
            }
        }
コード例 #32
0
ファイル: Entity.cs プロジェクト: KonstantinUb/sledge
 public override void Transform(IUnitTransformation transform, TransformFlags flags)
 {
     Origin = transform.Transform(Origin);
     base.Transform(transform, flags);
 }
コード例 #33
0
 protected internal void LocalMatrixBecameDirty()
 {
     _flags = _flags | TransformFlags.LocalMatrixIsDirty;
 }
コード例 #34
0
ファイル: Compiler.cs プロジェクト: Jeremiahf/wix3
        /// <summary>
        /// Parses a Validate element.
        /// </summary>
        /// <param name="node">The element to parse.</param>
        /// <param name="validationFlags">TransformValidation flags to use when creating the authoring patch transform.</param>
        private void ParseValidateElement(XmlNode node, ref TransformFlags validationFlags)
        {
            SourceLineNumberCollection sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);

            foreach (XmlAttribute attrib in node.Attributes)
            {
                if (0 == attrib.NamespaceURI.Length || attrib.NamespaceURI == this.schema.TargetNamespace)
                {
                    switch (attrib.LocalName)
                    {
                        case "ProductId":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ValidateProduct;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ValidateProduct;
                            }
                            break;
                        case "ProductLanguage":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ValidateLanguage;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ValidateLanguage;
                            }
                            break;
                        case "ProductVersion":
                            string check = this.core.GetAttributeValue(sourceLineNumbers, attrib);
                            validationFlags &= ~TransformFlags.ProductVersionMask;
                            Wix.Validate.ProductVersionType productVersionType = Wix.Validate.ParseProductVersionType(check);
                            switch (productVersionType)
                            {
                                case Wix.Validate.ProductVersionType.Major:
                                    validationFlags |= TransformFlags.ValidateMajorVersion;
                                    break;
                                case Wix.Validate.ProductVersionType.Minor:
                                    validationFlags |= TransformFlags.ValidateMinorVersion;
                                    break;
                                case Wix.Validate.ProductVersionType.Update:
                                    validationFlags |= TransformFlags.ValidateUpdateVersion;
                                    break;
                                default:
                                    this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name, "Version", check, "Major", "Minor", "Update"));
                                    break;
                            }
                            break;
                        case "ProductVersionOperator":
                            string op = this.core.GetAttributeValue(sourceLineNumbers, attrib);
                            validationFlags &= ~TransformFlags.ProductVersionOperatorMask;
                            Wix.Validate.ProductVersionOperatorType opType = Wix.Validate.ParseProductVersionOperatorType(op);
                            switch (opType)
                            {
                                case Wix.Validate.ProductVersionOperatorType.Lesser:
                                    validationFlags |= TransformFlags.ValidateNewLessBaseVersion;
                                    break;
                                case Wix.Validate.ProductVersionOperatorType.LesserOrEqual:
                                    validationFlags |= TransformFlags.ValidateNewLessEqualBaseVersion;
                                    break;
                                case Wix.Validate.ProductVersionOperatorType.Equal:
                                    validationFlags |= TransformFlags.ValidateNewEqualBaseVersion;
                                    break;
                                case Wix.Validate.ProductVersionOperatorType.GreaterOrEqual:
                                    validationFlags |= TransformFlags.ValidateNewGreaterEqualBaseVersion;
                                    break;
                                case Wix.Validate.ProductVersionOperatorType.Greater:
                                    validationFlags |= TransformFlags.ValidateNewGreaterBaseVersion;
                                    break;
                                default:
                                    this.core.OnMessage(WixErrors.IllegalAttributeValue(sourceLineNumbers, node.Name, "Operator", op, "Lesser", "LesserOrEqual", "Equal", "GreaterOrEqual", "Greater"));
                                    break;
                            }
                            break;
                        case "UpgradeCode":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ValidateUpgradeCode;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ValidateUpgradeCode;
                            }
                            break;
                        case "IgnoreAddExistingRow":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ErrorAddExistingRow;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ErrorAddExistingRow;
                            }
                            break;
                        case "IgnoreAddExistingTable":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ErrorAddExistingTable;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ErrorAddExistingTable;
                            }
                            break;
                        case "IgnoreDeleteMissingRow":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ErrorDeleteMissingRow;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ErrorDeleteMissingRow;
                            }
                            break;
                        case "IgnoreDeleteMissingTable":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ErrorDeleteMissingTable;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ErrorDeleteMissingTable;
                            }
                            break;
                        case "IgnoreUpdateMissingRow":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ErrorUpdateMissingRow;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ErrorUpdateMissingRow;
                            }
                            break;
                        case "IgnoreChangingCodePage":
                            if (YesNoType.Yes == this.core.GetAttributeYesNoValue(sourceLineNumbers, attrib))
                            {
                                validationFlags |= TransformFlags.ErrorChangeCodePage;
                            }
                            else
                            {
                                validationFlags &= ~TransformFlags.ErrorChangeCodePage;
                            }
                            break;
                        default:
                            this.core.UnexpectedAttribute(sourceLineNumbers, attrib);
                            break;
                    }
                }
                else
                {
                    this.core.UnsupportedExtensionAttribute(sourceLineNumbers, attrib);
                }
            }

        }
コード例 #35
0
 private void ParentOnTransformBecameDirty()
 {
     _flags = _flags | TransformFlags.All;
 }
コード例 #36
0
ファイル: Displacement.cs プロジェクト: jpiolho/sledge
 public override void Transform(IUnitTransformation transform, TransformFlags flags)
 {
     foreach (var p in Points)
     {
         p.InitialPosition = transform.Transform(p.InitialPosition);
         p.CurrentPosition.Location = transform.Transform(p.CurrentPosition.Location);
     }
     CalculateNormals();
     base.Transform(transform, flags);
 }
コード例 #37
0
ファイル: torch.cs プロジェクト: lukaswinzenried/WixCustBa
        /// <summary>
        /// Parse the commandline arguments.
        /// </summary>
        /// <param name="args">Commandline arguments.</param>
        private void ParseCommandLine(string[] args)
        {
            bool usingTransformType = false;

            for (int i = 0; i < args.Length; ++i)
            {
                string arg = args[i];
                if (null == arg || 0 == arg.Length) // skip blank arguments
                {
                    continue;
                }

                if ('-' == arg[0] || '/' == arg[0])
                {
                    string parameter = arg.Substring(1);

                    if ("a" == parameter)
                    {
                        this.adminImage = true;
                    }
                    else if ("ax" == parameter)
                    {
                        this.exportBasePath = CommandLine.GetDirectory(parameter, this.messageHandler, args, ++i);

                        if (String.IsNullOrEmpty(this.exportBasePath))
                        {
                            return;
                        }

                        this.adminImage = true;
                    }
                    else if ("ext" == parameter)
                    {
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.TypeSpecificationForExtensionRequired("-ext"));
                            return;
                        }

                        this.extensionList.Add(args[i]);
                    }
                    else if ("nologo" == parameter)
                    {
                        this.showLogo = false;
                    }
                    else if ("notidy" == parameter)
                    {
                        this.tidy = false;
                    }
                    else if ("o" == parameter || "out" == parameter)
                    {
                        this.outputFile = CommandLine.GetFile(parameter, this.messageHandler, args, ++i);

                        if (String.IsNullOrEmpty(this.outputFile))
                        {
                            return;
                        }
                    }
                    else if ("p" == parameter)
                    {
                        this.preserveUnchangedRows = true;
                    }
                    else if ("pedantic" == parameter)
                    {
                        this.showPedanticMessages = true;
                    }
                    else if ("swall" == parameter)
                    {
                        this.messageHandler.Display(this, WixWarnings.DeprecatedCommandLineSwitch("swall", "sw"));
                        this.messageHandler.SuppressAllWarnings = true;
                    }
                    else if (parameter.StartsWith("sw", StringComparison.Ordinal))
                    {
                        string paramArg = parameter.Substring(2);
                        try
                        {
                            if (0 == paramArg.Length)
                            {
                                this.messageHandler.SuppressAllWarnings = true;
                            }
                            else
                            {
                                int suppressWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat);
                                if (0 >= suppressWarning)
                                {
                                    this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg));
                                }

                                this.messageHandler.SuppressWarningMessage(suppressWarning);
                            }
                        }
                        catch (FormatException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg));
                        }
                        catch (OverflowException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalSuppressWarningId(paramArg));
                        }
                    }
                    else if ("wxall" == parameter)
                    {
                        this.messageHandler.Display(this, WixWarnings.DeprecatedCommandLineSwitch("wxall", "wx"));
                        this.messageHandler.WarningAsError = true;
                    }
                    else if (parameter.StartsWith("wx", StringComparison.Ordinal))
                    {
                        string paramArg = parameter.Substring(2);
                        try
                        {
                            if (0 == paramArg.Length)
                            {
                                this.messageHandler.WarningAsError = true;
                            }
                            else
                            {
                                int elevateWarning = Convert.ToInt32(paramArg, CultureInfo.InvariantCulture.NumberFormat);
                                if (0 >= elevateWarning)
                                {
                                    this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg));
                                }

                                this.messageHandler.ElevateWarningMessage(elevateWarning);
                            }
                        }
                        catch (FormatException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg));
                        }
                        catch (OverflowException)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalWarningIdAsError(paramArg));
                        }
                    }
                    else if ("serr" == parameter)
                    {
                        // arguments consistent with msitran.exe
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                            return;
                        }

                        if (usingTransformType)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalValidationArguments());
                        }
                        else
                        {
                            switch (args[i].ToLower())
                            {
                            case "a":
                                this.validationFlags |= TransformFlags.ErrorAddExistingRow;
                                break;

                            case "b":
                                this.validationFlags |= TransformFlags.ErrorDeleteMissingRow;
                                break;

                            case "c":
                                this.validationFlags |= TransformFlags.ErrorAddExistingTable;
                                break;

                            case "d":
                                this.validationFlags |= TransformFlags.ErrorDeleteMissingTable;
                                break;

                            case "e":
                                this.validationFlags |= TransformFlags.ErrorUpdateMissingRow;
                                break;

                            case "f":
                                this.validationFlags |= TransformFlags.ErrorChangeCodePage;
                                break;

                            default:
                                this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                                break;
                            }
                        }
                    }
                    else if ("t" == parameter)
                    {
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                            return;
                        }

                        if (0 != this.validationFlags)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalValidationArguments());
                        }
                        else
                        {
                            switch (args[i].ToLower())
                            {
                            case "language":
                                this.validationFlags = TransformFlags.LanguageTransformDefault;
                                break;

                            case "instance":
                                this.validationFlags = TransformFlags.InstanceTransformDefault;
                                break;

                            case "patch":
                                this.validationFlags = TransformFlags.PatchTransformDefault;
                                break;

                            default:
                                this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                                return;
                            }

                            usingTransformType = true;
                        }
                    }
                    else if ("v" == parameter)
                    {
                        this.messageHandler.ShowVerboseMessages = true;
                    }
                    else if ("val" == parameter)
                    {
                        // arguments consistent with msitran.exe
                        if (!CommandLine.IsValidArg(args, ++i))
                        {
                            this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                            return;
                        }

                        if (usingTransformType)
                        {
                            this.messageHandler.Display(this, WixErrors.IllegalValidationArguments());
                        }
                        else
                        {
                            switch (args[i].ToLower())
                            {
                            case "g":
                                this.validationFlags |= TransformFlags.ValidateUpgradeCode;
                                break;

                            case "l":
                                this.validationFlags |= TransformFlags.ValidateLanguage;
                                break;

                            case "r":
                                this.validationFlags |= TransformFlags.ValidateProduct;
                                break;

                            case "s":
                                this.validationFlags |= TransformFlags.ValidateMajorVersion;
                                break;

                            case "t":
                                this.validationFlags |= TransformFlags.ValidateMinorVersion;
                                break;

                            case "u":
                                this.validationFlags |= TransformFlags.ValidateUpdateVersion;
                                break;

                            case "v":
                                this.validationFlags |= TransformFlags.ValidateNewLessBaseVersion;
                                break;

                            case "w":
                                this.validationFlags |= TransformFlags.ValidateNewLessEqualBaseVersion;
                                break;

                            case "x":
                                this.validationFlags |= TransformFlags.ValidateNewEqualBaseVersion;
                                break;

                            case "y":
                                this.validationFlags |= TransformFlags.ValidateNewGreaterEqualBaseVersion;
                                break;

                            case "z":
                                this.validationFlags |= TransformFlags.ValidateNewGreaterBaseVersion;
                                break;

                            default:
                                this.messageHandler.Display(this, WixErrors.ExpectedArgument(parameter));
                                break;
                            }
                        }
                    }
                    else if ("x" == parameter)
                    {
                        this.exportBasePath = CommandLine.GetDirectory(parameter, this.messageHandler, args, ++i);

                        if (String.IsNullOrEmpty(this.exportBasePath))
                        {
                            return;
                        }
                    }
                    else if ("xi" == parameter)
                    {
                        this.xmlInputs = true;
                    }
                    else if ("xo" == parameter)
                    {
                        this.xmlOutput = true;
                    }
                    else if ("?" == parameter || "help" == parameter)
                    {
                        this.showHelp = true;
                        return;
                    }
                    else
                    {
                        this.invalidArgs.Add(parameter);
                    }
                }
                else if ('@' == arg[0])
                {
                    this.ParseCommandLine(CommandLineResponseFile.Parse(arg.Substring(1)));
                }
                else
                {
                    string inputFile = CommandLine.VerifyPath(this.messageHandler, arg);

                    if (String.IsNullOrEmpty(inputFile))
                    {
                        return;
                    }

                    this.inputFiles.Add(inputFile);
                }
            }
        }