Esempio n. 1
0
        /// <summary>
        /// Checks the status of the object , and registers as updated property
        /// </summary>
        /// <param name="propertyName">The updated property name</param>
        protected void __Updated(string propertyName)
        {
            if (UpdatedProperties == null)
            {
                UpdatedProperties = new HashSet <string>();
            }

            if (DatabaseModelStatus == ModelStatus.Retrieved)
            {
                UpdatedProperties.Add(propertyName);
            }
        }
 // Called at taint-time!!
 public override void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable pObj)
 {
     // Nothing to do for constraints on property updates
 }
        // 'physicalUpdate' is true if these changes came directly from the physics engine. Don't need to rebuild then.
        // Called at taint-time.
        public override void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable updated)
        {
            if (!LinksetRoot.IsPhysical) return;
            // The user moving a child around requires the rebuilding of the linkset compound shape
            // One problem is this happens when a border is crossed -- the simulator implementation
            //    stores the position into the group which causes the move of the object
            //    but it also means all the child positions get updated.
            //    What would cause an unnecessary rebuild so we make sure the linkset is in a
            //    region before bothering to do a rebuild.
            if (!IsRoot(updated) && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
            {
            // If a child of the linkset is updating only the position or rotation, that can be done
            //    without rebuilding the linkset.
            // If a handle for the child can be fetch, we update the child here. If a rebuild was
            //    scheduled by someone else, the rebuild will just replace this setting.

            bool updatedChild = false;
            // Anything other than updating position or orientation usually means a physical update
            //     and that is caused by us updating the object.
            if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
            {
                    // Find the physical instance of the child
                if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape))
                {
                    // It is possible that the linkset is still under construction and the child is not yet
                    //    inserted into the compound shape. A rebuild of the linkset in a pre-step action will
                    //    build the whole thing with the new position or rotation.
                    // The index must be checked because Bullet references the child array but does no validity
                    //    checking of the child index passed.
                    int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape);
                    if (updated.LinksetChildIndex < numLinksetChildren)
                    {
                        BulletShape linksetChildShape = PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape, updated.LinksetChildIndex);
                        if (linksetChildShape.HasPhysicalShape)
                        {
                            // Found the child shape within the compound shape
                            PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, updated.LinksetChildIndex,
                                                                        updated.RawPosition - LinksetRoot.RawPosition,
                                                                        updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation),
                                                                        true /* shouldRecalculateLocalAabb */);
                            updatedChild = true;
                            DetailLog("{0},BSLinksetCompound.UpdateProperties,changeChildPosRot,whichUpdated={1},pos={2},rot={3}",
                                                        updated.LocalID, whichUpdated, updated.RawPosition, updated.RawOrientation);
                        }
                        else    // DEBUG DEBUG
                        {       // DEBUG DEBUG
                            DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noChildShape,shape={1}",
                                                                        updated.LocalID, linksetChildShape);
                        }       // DEBUG DEBUG
                    }
                    else    // DEBUG DEBUG
                    {       // DEBUG DEBUG
                        // the child is not yet in the compound shape. This is non-fatal.
                        DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,childNotInCompoundShape,numChildren={1},index={2}",
                                                                    updated.LocalID, numLinksetChildren, updated.LinksetChildIndex);
                    }       // DEBUG DEBUG
                }
                else    // DEBUG DEBUG
                {       // DEBUG DEBUG
                    DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noBodyOrNotCompound", updated.LocalID);
                }       // DEBUG DEBUG

                if (!updatedChild)
                {
                    // If couldn't do the individual child, the linkset needs a rebuild to incorporate the new child info.
                    // Note: there are several ways through this code that will not update the child if
                    //    the linkset is being rebuilt. In this case, scheduling a rebuild is a NOOP since
                    //    there will already be a rebuild scheduled.
                    DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}",
                                                                    updated.LocalID, whichUpdated);
                    updated.LinksetInfo = null; // setting to 'null' causes relative position to be recomputed.
                    ScheduleRebuild(updated);
                }
            }
            }
        }
        // 'physicalUpdate' is true if these changes came directly from the physics engine. Don't need to rebuild then.
        // Called at taint-time.
        public override void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable updated)
        {
            if (!LinksetRoot.IsPhysical)
            {
                return;
            }
            // The user moving a child around requires the rebuilding of the linkset compound shape
            // One problem is this happens when a border is crossed -- the simulator implementation
            //    stores the position into the group which causes the move of the object
            //    but it also means all the child positions get updated.
            //    What would cause an unnecessary rebuild so we make sure the linkset is in a
            //    region before bothering to do a rebuild.
            if (!IsRoot(updated) && PhysicsScene.TerrainManager.IsWithinKnownTerrain(LinksetRoot.RawPosition))
            {
                // If a child of the linkset is updating only the position or rotation, that can be done
                //    without rebuilding the linkset.
                // If a handle for the child can be fetch, we update the child here. If a rebuild was
                //    scheduled by someone else, the rebuild will just replace this setting.

                bool updatedChild = false;
                // Anything other than updating position or orientation usually means a physical update
                //     and that is caused by us updating the object.
                if ((whichUpdated & ~(UpdatedProperties.Position | UpdatedProperties.Orientation)) == 0)
                {
                    // Find the physical instance of the child
                    if (LinksetRoot.PhysShape.HasPhysicalShape && PhysicsScene.PE.IsCompound(LinksetRoot.PhysShape))
                    {
                        // It is possible that the linkset is still under construction and the child is not yet
                        //    inserted into the compound shape. A rebuild of the linkset in a pre-step action will
                        //    build the whole thing with the new position or rotation.
                        // The index must be checked because Bullet references the child array but does no validity
                        //    checking of the child index passed.
                        int numLinksetChildren = PhysicsScene.PE.GetNumberOfCompoundChildren(LinksetRoot.PhysShape);
                        if (updated.LinksetChildIndex < numLinksetChildren)
                        {
                            BulletShape linksetChildShape =
                                PhysicsScene.PE.GetChildShapeFromCompoundShapeIndex(LinksetRoot.PhysShape,
                                                                                    updated.LinksetChildIndex);
                            if (linksetChildShape.HasPhysicalShape)
                            {
                                // Found the child shape within the compound shape
                                PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, updated.LinksetChildIndex,
                                                                     updated.RawPosition - LinksetRoot.RawPosition,
                                                                     updated.RawOrientation * OMV.Quaternion.Inverse(LinksetRoot.RawOrientation),
                                                                     true /* shouldRecalculateLocalAabb */);
                                updatedChild = true;
                                DetailLog(
                                    "{0},BSLinksetCompound.UpdateProperties,changeChildPosRot,whichUpdated={1},pos={2},rot={3}",
                                    updated.LocalID, whichUpdated, updated.RawPosition, updated.RawOrientation);
                            }
                            else // DEBUG DEBUG
                            {
                                // DEBUG DEBUG
                                DetailLog(
                                    "{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noChildShape,shape={1}",
                                    updated.LocalID, linksetChildShape);
                            } // DEBUG DEBUG
                        }
                        else  // DEBUG DEBUG
                        {
                            // DEBUG DEBUG
                            // the child is not yet in the compound shape. This is non-fatal.
                            DetailLog(
                                "{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,childNotInCompoundShape,numChildren={1},index={2}",
                                updated.LocalID, numLinksetChildren, updated.LinksetChildIndex);
                        } // DEBUG DEBUG
                    }
                    else  // DEBUG DEBUG
                    {
                        // DEBUG DEBUG
                        DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild,noBodyOrNotCompound",
                                  updated.LocalID);
                    } // DEBUG DEBUG

                    if (!updatedChild)
                    {
                        // If couldn't do the individual child, the linkset needs a rebuild to incorporate the new child info.
                        // Note: there are several ways through this code that will not update the child if
                        //    the linkset is being rebuilt. In this case, scheduling a rebuild is a NOOP since
                        //    there will already be a rebuild scheduled.
                        DetailLog(
                            "{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}",
                            updated.LocalID, whichUpdated);
                        updated.LinksetInfo = null; // setting to 'null' causes relative position to be recomputed.
                        ScheduleRebuild(updated);
                    }
                }
            }
        }
 // Called at taint-time!!
 public override void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable pObj)
 {
     // Nothing to do for constraints on property updates
 }
Esempio n. 6
0
 // Called when a parameter update comes from the physics engine for any object
 //      of the linkset is received.
 // Passed flag is update came from physics engine (true) or the user (false).
 // Called at taint-time!!
 public abstract void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable physObject);
 // Called when a parameter update comes from the physics engine for any object
 //      of the linkset is received.
 // Passed flag is update came from physics engine (true) or the user (false).
 // Called at taint-time!!
 public abstract void UpdateProperties(UpdatedProperties whichUpdated, BSPrimLinkable physObject);
Esempio n. 8
0
        public override void ProcessPropertyUpdate <T>(string variableName, T value)
        {
            base.ProcessPropertyUpdate(variableName, value);

            UpdatedProperties.Add(variableName);
        }
        public virtual void Update(IFileSystemInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            DateTime dt;

            foreach (var propNode in Document.SelectNodes(DavServerExtensions.DavNamespacePrefix + ":propertyupdate/" + DavServerExtensions.DavNamespacePrefix + ":set/" + DavServerExtensions.DavNamespacePrefix + ":prop/*", PropFindRequest.NsMgr).OfType <XmlElement>())
            {
                // avoid changes when possible
                try
                {
                    switch (propNode.NamespaceURI)
                    {
                    case DavServerExtensions.DavNamespaceUri:
                        break;

                    case DavServerExtensions.MsNamespaceUri:
                        switch (propNode.LocalName)
                        {
                        case "Win32CreationTime":
                            if (DavProperty.TryGet(propNode.InnerText, out dt))
                            {
                                var dtu = dt.ToUniversalTime();
                                if (info.CreationTimeUtc != dtu)
                                {
                                    info.CreationTimeUtc = dtu;
                                }
                            }
                            break;

                        case "Win32LastAccessTime":
                            if (DavProperty.TryGet(propNode.InnerText, out dt))
                            {
                                var dtu = dt.ToUniversalTime();
                                if (info.LastAccessTimeUtc != dtu)
                                {
                                    info.LastAccessTimeUtc = dtu;
                                }
                            }
                            break;

                        case "Win32LastModifiedTime":
                            if (DavProperty.TryGet(propNode.InnerText, out dt))
                            {
                                var dtu = dt.ToUniversalTime();
                                if (info.LastWriteTimeUtc != dtu)
                                {
                                    info.LastWriteTimeUtc = dtu;
                                }
                            }
                            break;

                        case "Win32FileAttributes":
                            if (DavProperty.TryGetFromHexadecimal(propNode.InnerText, out int i))
                            {
                                const FileAttributes allowed = FileAttributes.Archive | FileAttributes.Hidden | FileAttributes.ReadOnly;
                                var newAtts = (FileAttributes)i;
                                newAtts &= allowed;

                                var existing = info.Attributes & allowed;
                                if (existing != newAtts)
                                {
                                    if (info.Attributes.HasFlag(FileAttributes.ReadOnly))
                                    {
                                        try
                                        {
                                            info.Attributes &= ~FileAttributes.ReadOnly;
                                            info.Attributes  = newAtts;
                                        }
                                        finally
                                        {
                                            if (newAtts.HasFlag(FileAttributes.ReadOnly))
                                            {
                                                info.Attributes |= FileAttributes.ReadOnly;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        info.Attributes = newAtts;
                                    }
                                }
                            }

                            UpdatedProperties.Add(new DavProperty(propNode.LocalName, propNode.NamespaceURI));
                            break;
                        }
                        break;
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    UnauthorizedProperties.Add(new DavProperty(propNode.LocalName, propNode.NamespaceURI));
                }
            }
        }