Exemple #1
0
        protected Guid WriteOrUseUuidIfSupported(IFileSystemInfo info)
        {
            Guid uuid = Guid.Empty;

            if (info.IsExtendedAttributeAvailable())
            {
                try {
                    Guid?localUuid = info.Uuid;
                    if (localUuid == null || this.Storage.GetObjectByGuid((Guid)localUuid) != null)
                    {
                        uuid = Guid.NewGuid();
                        try {
                            info.Uuid = uuid;
                        } catch (RestoreModificationDateException restoreException) {
                            Logger.Debug("Could not retore the last modification date of " + info.FullName, restoreException);
                        }
                    }
                    else
                    {
                        uuid = localUuid ?? Guid.NewGuid();
                    }
                } catch (ExtendedAttributeException ex) {
                    throw new RetryException(ex.Message, ex);
                }
            }

            return(uuid);
        }
Exemple #2
0
        private Guid WriteOrUseUuidIfSupported(IFileSystemInfo localFile)
        {
            Guid uuid = Guid.Empty;

            if (localFile.IsExtendedAttributeAvailable())
            {
                try {
                    string ea = localFile.GetExtendedAttribute(MappedObject.ExtendedAttributeKey);
                    if (ea == null || !Guid.TryParse(ea, out uuid) || this.Storage.GetObjectByGuid(uuid) != null)
                    {
                        uuid = Guid.NewGuid();
                        localFile.SetExtendedAttribute(MappedObject.ExtendedAttributeKey, uuid.ToString(), true);
                    }
                } catch (ExtendedAttributeException ex) {
                    throw new RetryException(ex.Message, ex);
                }
            }

            return(uuid);
        }
        protected Guid WriteOrUseUuidIfSupported(IFileSystemInfo info) {
            Guid uuid = Guid.Empty;
            if (info.IsExtendedAttributeAvailable()) {
                try {
                    Guid? localUuid = info.Uuid;
                    if (localUuid == null || this.Storage.GetObjectByGuid((Guid)localUuid) != null) {
                        uuid = Guid.NewGuid();
                        try {
                            info.Uuid = uuid;
                        } catch (RestoreModificationDateException restoreException) {
                            Logger.Debug("Could not retore the last modification date of " + info.FullName, restoreException);
                        }
                    } else {
                        uuid = localUuid ?? Guid.NewGuid();
                    }
                } catch (ExtendedAttributeException ex) {
                    throw new RetryException(ex.Message, ex);
                }
            }

            return uuid;
        }