Ejemplo n.º 1
0
        public void DeleteIfExists(DeleteMode deleteMode = DeleteMode.Normal)
        {
            ThrowIfRelative();

            if (FileExists() || DirectoryExists())
            {
                Delete(deleteMode);
            }
        }
        public override void Deserialize(BinaryReader reader)
        {
            base.Deserialize(reader);
            ObjectID   = reader.ReadInt16();
            ObjectPID  = reader.ReadUInt32();
            CleanupAll = reader.ReadBoolean();
            Success    = reader.ReadBoolean();

            Mode = (DeleteMode)reader.ReadByte();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Empties the folder. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="deleteSubFolders">Indicates whether sub-folders should also be deleted.</param>
 public Task <ServiceResponseCollection <ServiceResponse> > Empty(
     DeleteMode deleteMode,
     bool deleteSubFolders)
 {
     this.ThrowIfThisIsNew();
     return(this.Service.EmptyFolder(
                this.Id,
                deleteMode,
                deleteSubFolders));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Deletes the object.
        /// </summary>
        /// <param name="deleteMode">The deletion mode.</param>
        /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
        /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
        internal override Task <ServiceResponseCollection <ServiceResponse> > InternalDelete(
            DeleteMode deleteMode,
            SendCancellationsMode?sendCancellationsMode,
            AffectedTaskOccurrence?affectedTaskOccurrences,
            CancellationToken token)
        {
            this.ThrowIfThisIsNew();

            return(this.Service.DeleteFolder(this.Id, deleteMode, token));
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Empties the folder. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="deleteSubFolders">Indicates whether sub-folders should also be deleted.</param>
 public void Empty(
     DeleteMode deleteMode,
     bool deleteSubFolders)
 {
     this.ThrowIfThisIsNew();
     this.Service.EmptyFolder(
         this.Id,
         deleteMode,
         deleteSubFolders);
 }
Ejemplo n.º 6
0
        internal void DeleteIfExists(DeleteMode deleteMode = DeleteMode.Normal)
        {
            ThrowIfNotInitialized();
            ThrowIfRelative();

            if (FileExists() || DirectoryExists())
            {
                Delete(deleteMode);
            }
        }
Ejemplo n.º 7
0
        public override bool Verify(VM vm, VMAvatar caller)
        {
            if (Verified)
            {
                return(true);
            }
            ObjectPID = 0;
            VMEntity obj = vm.GetObjectById(ObjectID);

            if (!vm.TS1)
            {
                Mode = vm.PlatformState.Validator.GetDeleteMode(Mode, caller, obj);
                if (Mode == DeleteMode.Disallowed)
                {
                    return(false);
                }
                if (caller.AvatarState.Permissions == VMTSOAvatarPermissions.Admin)
                {
                    VMNetLockCmd.LockObj(vm, obj);
                    return(true); //admins can always deete
                }
            }
            else if (vm.Context.Cheats.MoveObjects) //for ts1 moveobjects cheat
            {
                return(true);
            }
            if (obj == null || (obj is VMAvatar) || obj.IsUserMovable(vm.Context, true) != VMPlacementError.Success)
            {
                return(false);
            }
            if ((((VMGameObject)obj).Disabled & VMGameObjectDisableFlags.TransactionIncomplete) > 0)
            {
                return(false);                                                                                     //can't delete objects mid trasaction...
            }
            VMNetLockCmd.LockObj(vm, obj);

            if (Mode == DeleteMode.Delete)
            {
                //straight up delete this object. another check will be done at the execution stage.
                return(true);
            }
            else
            {
                //send to the owner's inventory
                ObjectPID = obj.PersistID; //we don't want to accidentally delete the wrong object - so use its real persist id.
                vm.GlobalLink.MoveToInventory(vm, obj.MultitileGroup, (bool success, uint pid) =>
                {
                    Success  = success;
                    Verified = true;
                    vm.ForwardCommand(this);
                });
                return(false);
            }
        }
Ejemplo n.º 8
0
 public RelationAttribute(Type relatedType, string relatedColumn, string mamyToManyRelationTable,
                          string MtmRelationTableParentColumn, string MtmRelationTableChildColumn, DeleteMode deleteMode)
 {
     _relationType                 = RelationType.ManyToMany;
     _relatedType                  = relatedType;
     _relatedColumn                = relatedColumn;
     _mamyToManyRelationTable      = mamyToManyRelationTable;
     _MtmRelationTableParentColumn = MtmRelationTableParentColumn;
     _MtmRelationTableChildColumn  = MtmRelationTableChildColumn;
     _deleteMode = deleteMode;
 }
 public void ExcluirEmail(EmailMessage mail)
 {
     try
     {
         DeleteMode delete = DeleteMode.MoveToDeletedItems;
         mail.Delete(delete);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Empties the folder. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="deleteSubFolders">Indicates whether sub-folders should also be deleted.</param>
 public Task <ServiceResponseCollection <ServiceResponse> > Empty(
     DeleteMode deleteMode,
     bool deleteSubFolders,
     CancellationToken token = default(CancellationToken))
 {
     this.ThrowIfThisIsNew();
     return(this.Service.EmptyFolder(
                this.Id,
                deleteMode,
                deleteSubFolders,
                token));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Deletes items in the specified conversation.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="contextFolderId">The Id of the folder items must belong to in order to be deleted. If contextFolderId is
 /// null, items across the entire mailbox are deleted.</param>
 /// <param name="deleteMode">The deletion mode.</param>
 public async System.Threading.Tasks.Task DeleteItems(
     FolderId contextFolderId,
     DeleteMode deleteMode)
 {
     (await this.Service.DeleteItemsInConversations(
          new KeyValuePair <ConversationId, DateTime?>[]
     {
         new KeyValuePair <ConversationId, DateTime?>(
             this.Id,
             this.GlobalLastDeliveryTime)
     },
          contextFolderId,
          deleteMode).ConfigureAwait(false))[0].ThrowIfNecessary();
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Deletes items in the specified conversation.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="contextFolderId">The Id of the folder items must belong to in order to be deleted. If contextFolderId is
 /// null, items across the entire mailbox are deleted.</param>
 /// <param name="deleteMode">The deletion mode.</param>
 public void DeleteItems(
     FolderId contextFolderId,
     DeleteMode deleteMode)
 {
     this.Service.DeleteItemsInConversations(
         new KeyValuePair <ConversationId, DateTime?>[]
     {
         new KeyValuePair <ConversationId, DateTime?>(
             this.Id,
             this.GlobalLastDeliveryTime)
     },
         contextFolderId,
         deleteMode)[0].ThrowIfNecessary();
 }
Ejemplo n.º 13
0
        public override DeleteMode GetDeleteMode(DeleteMode desired, VMAvatar ava, VMEntity obj)
        {
            if (desired > DeleteMode.Delete)
            {
                return(DeleteMode.Disallowed);
            }
            if (obj == null || ava == null)
            {
                return(DeleteMode.Disallowed);
            }
            if (desired == DeleteMode.Sendback &&
                (obj.PersistID == 0 || obj is VMAvatar || !CanSendbackObject(ava, (VMGameObject)obj)))
            {
                return(DeleteMode.Disallowed);
            }

            if (obj is VMAvatar && ava.AvatarState.Permissions < VMTSOAvatarPermissions.Admin)
            {
                return(DeleteMode.Disallowed);
            }

            if (ava.AvatarState.Permissions >= VMTSOAvatarPermissions.Owner)
            {
                return(desired);
            }

            if (ava.AvatarState.Permissions < VMTSOAvatarPermissions.BuildBuyRoommate)
            {
                return(DeleteMode.Disallowed);
            }

            //build buy donator can delete build mode objects that are donated

            if (!(obj.TSOState as VMTSOObjectState).ObjectFlags.HasFlag(VMTSOObjectFlags.FSODonated))
            {
                return(DeleteMode.Disallowed);
            }
            var catalog = Content.Content.Get().WorldCatalog;
            var item    = catalog.GetItemByGUID(obj.Object.OBJ.GUID);

            if (item != null)
            {
                if (BuilderWhiteList.Contains(item.Value.Category) && !RoomieWhiteList.Contains(item.Value.Category))
                {
                    return(desired);
                }
            }
            return(DeleteMode.Disallowed);
        }
        public static void RemoveWorkspace(Workspace workspace, DeleteMode deleteMode)
        {
            Workspaces.Remove(workspace);

            if (deleteMode == DeleteMode.DeleteWorkspace)
            {
                try
                {
                    Directory.Delete(workspace.WorkspacePath, true);
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Error deleting workspace folder {0}", workspace.WorkspacePath);
                }
            }
        }
Ejemplo n.º 15
0
        private static void DeleteTask(ExchangeService service, string Subject, DeleteMode deleteMode)
        {
            // Try to retrieve the task specified by the subject.
            Task task = Ex15_FindTaskBySubject_CS.FindTaskBySubject(service, Subject);

            // If the task if found, delete it with the specified deleteMode.
            if (task != null)
            {
                task.Delete(deleteMode);
                Console.WriteLine("Task deleted.");
            }
            else
            {
                Console.WriteLine("Task not found.");
            }
        }
Ejemplo n.º 16
0
        private static void HandleDelete(DeleteMode d, string file)
        {
            switch (d)
            {
            case DeleteMode.truncate:
                File.WriteAllBytes(file, new byte[0]);
                break;

            case DeleteMode.delete:
                File.Delete(file);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 17
0
        private static void DeleteTask(ExchangeService service, string Subject, DeleteMode deleteMode)
        {
            // Try to retrieve the task specified by the subject.
            Task task = Ex15_FindTaskBySubject_CS.FindTaskBySubject(service, Subject);

            // If the task if found, delete it with the specified deleteMode.
            if (task != null)
            {
                task.Delete(deleteMode);
                Console.WriteLine("Task deleted.");
            }
            else
            {
                Console.WriteLine("Task not found.");
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Deletes the specified page version id.
        /// </summary>
        /// <param name="pageVersionId">The page version id.</param>
        /// <param name="userUID">The user UID.</param>
        /// <param name="deleteMode">The delete mode.</param>
        public void Delete(int pageVersionId, Guid userUID, DeleteMode deleteMode)
        {
            switch (deleteMode)
            {
            case DeleteMode.TemporaryStorage:

                if (userUID != Guid.Empty)
                {
                    _temporaryDocumentStorage.Delete(pageVersionId, userUID);
                }
                break;

            case DeleteMode.PersistantStorage:
                //pDocument = _persistentDocumentStorage.Load(PageVersionId);
                break;

            default:
                throw new ArgumentNullException("DeleteMode");
            }
        }
        static void DeleteFolder(ExchangeService service, string DisplayName, DeleteMode deleteMode, WellKnownFolderName ParentFolder)
        {
            // Attempt to retrieve the unique identifier of the folder with the specified display name (DisplayName) within the specified folder (ParentFolder).
            FolderId folderId = Ex15_FindFolderIdByDisplayName_CS.FindFolderIdByDisplayName(service, DisplayName, ParentFolder);

            if (folderId != null)
            {
                // Bind to the folder by using its unique identifier.
                Folder folder = Folder.Bind(service, folderId);

                // Delete the folder.
                folder.Delete(deleteMode);

                Console.WriteLine("Folder '" + DisplayName + "' has been deleted.");
            }
            else
            {
                Console.WriteLine("Folder '" + DisplayName + "' could not be found in the '" + ParentFolder + "' folder.");
            }
        }
Ejemplo n.º 20
0
 private void Delete(DeleteMode mode)
 {
     if (CheckDeleteGroup())
     {
         foreach (DataGridViewRow row in dgvResult.Rows)
         {
             if (row.Cells["colMatchType"].Value.ToString() == "SEPARATOR")
             {
                 continue;
             }
             if (true == Convert.ToBoolean(row.Cells["colCheck"].Value))
             {
                 string filename = row.Cells["colFilename"].Value.ToString();
                 try
                 {
                     Font fnt = new System.Drawing.Font(row.InheritedStyle.Font, FontStyle.Strikeout);
                     row.DefaultCellStyle.Font      = fnt;
                     row.DefaultCellStyle.BackColor = Color.Red;
                     row.Cells["colCheck"].Value    = false;
                     if (mode == DeleteMode.RECYCLED)
                     {
                         Logger.Info("Delete to Recyle Bin: " + filename);
                         Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(filename, Microsoft.VisualBasic.FileIO.UIOption.OnlyErrorDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.SendToRecycleBin);
                     }
                     else if (mode == DeleteMode.PERMANENT)
                     {
                         Logger.Info("Delete Permanently: " + filename);
                         System.IO.File.Delete(filename);
                     }
                     row.Cells["colStatus"].Value = mode.ToString();
                 }
                 catch (Exception ex)
                 {
                     Logger.Error(ex.Message + "(" + filename + ").");
                     row.Cells["colStatus"].Value = ex.Message;
                 }
             }
         }
         MessageBox.Show("Done.");
     }
 }
Ejemplo n.º 21
0
        public void Delete(DeleteMode deleteMode = DeleteMode.Normal)
        {
            ThrowIfNotInitialized();
            ThrowIfRelative();

            if (IsRoot)
            {
                throw new NotSupportedException("Delete is not supported on a root level directory because it would be dangerous:" + ToString());
            }

            var isFile = FileExists();
            var isDir  = DirectoryExists();

            if (!isFile && !isDir)
            {
                throw new InvalidOperationException("Trying to delete a path that does not exist: " + ToString());
            }

            try
            {
                if (isFile)
                {
                    FSWrapper.FileDelete(this);
                }
                else
                {
                    FSWrapper.DirectoryDelete(this, true);
                }
            }
            catch (IOException)
            {
                if (deleteMode == DeleteMode.Normal)
                {
                    throw;
                }
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Deserialize <see cref="RequestDelete"/>.
        /// </summary>
        /// <param name="uid"><c>uid</c> associated with the request</param>
        /// <param name="path">Path associated with the request</param>
        /// <returns>The deserialized request</returns>
        private RequestDelete DeserializeRequestDelete(ulong uid, string path)
        {
            int version = this.binaryReader.ReadInt32();

            DeleteMode mode = DeleteMode.None;

            if (this.serializationVersionUsed >= SerializationFormatVersions.Version18)
            {
                ushort moderaw = this.binaryReader.ReadUInt16();

                mode = (DeleteMode)moderaw;
            }
            else
            {
                bool iscascade = this.binaryReader.ReadBoolean();

                if (iscascade)
                {
                    mode |= DeleteMode.CascadeDelete;
                }
            }

            return(new RequestDelete(path, version, mode, uid));
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Deletes the folder. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">Deletion mode.</param>
 public Task <ServiceResponseCollection <ServiceResponse> > Delete(DeleteMode deleteMode)
 {
     return(this.InternalDelete(deleteMode, null, null));
 }
 /// <summary>
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal override void InternalDelete(
     DeleteMode deleteMode,
     SendCancellationsMode? sendCancellationsMode,
     AffectedTaskOccurrence? affectedTaskOccurrences)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 25
0
 public void DeleteFolder(FolderId findFolderId, DeleteMode deleteMode)
 {
     Folder folder = Folder.Bind(CurrentExchangeService, findFolderId);
     folder.Delete(deleteMode);
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Deletes the current occurrence of a recurring task. After the current occurrence isdeleted,
 /// the task represents the next occurrence. Developers should call Load to retrieve the new property
 /// values of the task. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 public void DeleteCurrentOccurrence(DeleteMode deleteMode)
 {
     this.InternalDelete(
         deleteMode,
         null,
         AffectedTaskOccurrence.SpecifiedOccurrenceOnly);
 }
Ejemplo n.º 27
0
 public void DeleteFolder(string findFolderId, DeleteMode deleteMode)
 {
     Folder folder = _ewsOperator. FolderBind(findFolderId);
     _ewsOperator.FolderDelete(folder, deleteMode);
 }
 /// <summary>
 /// Deletes a file and it's associated revisions. Iteratively deletes revisions for a file one by one.
 /// </summary>
 /// <param name="mode">Soft deletes are atomic. Hard are atomic on the file but not a file's chunks.</param>
 /// <param name="deleteOpts">Delete durability options. See ReQL API.</param>
 /// <param name="bucket"><see cref="Bucket"/></param>
 /// <param name="filename">The filename</param>
 public static void DeleteAllRevisions(this Bucket bucket, string filename, DeleteMode mode = DeleteMode.Soft, object deleteOpts = null)
 {
     DeleteAllRevisionsAsync(bucket, filename, mode, deleteOpts).WaitSync();
 }
Ejemplo n.º 29
0
        private void AddColOnClick(object sender, RoutedEventArgs e)
        {
            Mode = DeleteMode.Undelete;
            Step.AddPoint();

            AddCol(Step.GetPointCount() - 1);
        }
Ejemplo n.º 30
0
 private void DelRowOnClick(object sender, RoutedEventArgs e)
 {
     mainGrid.SelectedIndex = -1;
     Mode = DeleteMode.DeleteRow;
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Deletes async the item. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="suppressReadReceipts">Whether to suppress read receipts</param>
 public async System.Threading.Tasks.Task DeleteAsync(DeleteMode deleteMode, bool suppressReadReceipts)
 {
     await this.InternalDeleteAsync(deleteMode, null, null, suppressReadReceipts);
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Deletes async the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 /// <returns></returns>
 /// <exception cref="System.InvalidOperationException"></exception>
 internal override System.Threading.Tasks.Task InternalDeleteAsync(DeleteMode deleteMode, SendCancellationsMode? sendCancellationsMode, AffectedTaskOccurrence? affectedTaskOccurrences)
 {
     throw new InvalidOperationException(Strings.DeletingThisObjectTypeNotAuthorized);
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Helper method for deleting folder.
 /// </summary>
 /// <param name="folder">Folder to delete.</param>
 /// <param name="deleteMode">Delete mode operation.</param>
 private void RemoveFolder(Folder folder, DeleteMode deleteMode)
 {
     folder.Delete(deleteMode);
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Deletes async the item. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 public async System.Threading.Tasks.Task DeleteAsync(DeleteMode deleteMode)
 {
     await this.DeleteAsync(deleteMode, false);
 }
 /// <summary>
 /// Deletes a file in the bucket.
 /// </summary>
 /// <param name="mode">Soft deletes are atomic. Hard are atomic on the file but not a file's chunks.</param>
 /// <param name="deleteOpts">Delete durability options. See ReQL API.</param>
 /// <param name="bucket"><see cref="Bucket"/></param>
 /// <param name="fileId"><see cref="FileInfo.Id"/></param>
 public static void DeleteRevision(this Bucket bucket, Guid fileId, DeleteMode mode = DeleteMode.Soft, object deleteOpts = null)
 {
     DeleteRevisionAsync(bucket, fileId, mode, deleteOpts).WaitSync();
 }
        /// <summary>
        /// Deletes a file and it's associated revisions. Iteratively deletes revisions for a file one by one.
        /// </summary>
        /// <param name="mode">Soft deletes are atomic. Hard are atomic on the file but not a file's chunks.</param>
        /// <param name="deleteOpts">Delete durability options. See ReQL API.</param>
        /// <param name="bucket"><see cref="Bucket"/></param>
        /// <param name="filename">The filename</param>
        public static async Task DeleteAllRevisionsAsync(this Bucket bucket, string filename, DeleteMode mode = DeleteMode.Soft, object deleteOpts = null)
        {
            filename = filename.SafePath();

            var result = await GetAllRevisionsAsync(bucket, filename)
                .ConfigureAwait(false);

            foreach( var file in result )
            {
                await DeleteRevisionAsync(bucket, file.Id, mode, deleteOpts)
                    .ConfigureAwait(false);
            }
        }
Ejemplo n.º 37
0
 private void UndeleteOnClick(object sender, RoutedEventArgs e)
 {
     Mode = DeleteMode.Undelete;
 }
 public void update_mode(DeleteMode mode) => SelectedDeleteMode = mode;
Ejemplo n.º 39
0
 /// <summary>
 /// This is not supported in this object.
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal override void InternalDelete(DeleteMode deleteMode, SendCancellationsMode?sendCancellationsMode, AffectedTaskOccurrence?affectedTaskOccurrences)
 {
     throw new NotSupportedException();
 }
        /// <summary>
        /// Deletes a file in the bucket.
        /// </summary>
        /// <param name="mode">Soft deletes are atomic. Hard are atomic on the file but not a file's chunks.</param>
        /// <param name="deleteOpts">Delete durability options. See ReQL API.</param>
        /// <param name="bucket"><see cref="Bucket"/></param>
        /// <param name="cancelToken"><see cref="CancellationToken"/></param>
        /// <param name="fileId"><see cref="FileInfo.Id"/></param>
        public static async Task DeleteRevisionAsync(this Bucket bucket, Guid fileId, DeleteMode mode = DeleteMode.Soft, object deleteOpts = null,
            CancellationToken cancelToken = default(CancellationToken))
        {
            var result = await bucket.fileTable.Get(fileId)
                .Update(
                    R.HashMap(FileInfo.StatusJsonName, Status.Deleted)
                        .With(FileInfo.DeletedDateJsonName, DateTimeOffset.UtcNow)
                )[deleteOpts]
                .RunResultAsync(bucket.conn, cancelToken)
                .ConfigureAwait(false);

            result.AssertReplaced(1);

            if( mode == DeleteMode.Hard )
            {
                //delete the chunks....
                await bucket.chunkTable.Between(
                    R.Array(fileId, R.Minval()),
                    R.Array(fileId, R.Maxval()))[new {index = bucket.chunkIndexName}]
                    .Delete()[deleteOpts]
                    .RunResultAsync(bucket.conn, cancelToken)
                    .ConfigureAwait(false);

                //then delete the file.
                await bucket.fileTable.Get(fileId).Delete()[deleteOpts]
                    .RunResultAsync(bucket.conn, cancelToken)
                    .ConfigureAwait(false);
            }
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Method used to delete folder. If folder contains item or subfolder, force switch should be used.
        /// </summary>
        /// <param name="folder">Folder to delete.</param>
        /// <param name="deleteMode">Delete mode operation.</param>
        /// <param name="force">Overrides child folder and item check. </param>
        internal void RemoveFolder(Folder folder, DeleteMode deleteMode, bool force)
        {
            if (force)
            {
                this.RemoveFolder(folder, deleteMode);
            }
            else
            {
                int childFolderCount = folder.ChildFolderCount;
                int folderItemCount = folder.TotalCount;

                if (childFolderCount == 0 && folderItemCount == 0)
                    this.RemoveFolder(folder, deleteMode);
                else
                {
                    throw new InvalidOperationException(String.Format("Folder not empty or contains subfolders. ChildFolders: {0}, ItemsInFolder: {1}", childFolderCount, folderItemCount));
                }
            }
        }
Ejemplo n.º 42
0
 /// <summary>
 /// Deletes the item. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 public void Delete(DeleteMode deleteMode)
 {
     this.Delete(deleteMode, false);
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Deletes the folder. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">Deletion mode.</param>
 public void Delete(DeleteMode deleteMode)
 {
     this.InternalDelete(deleteMode, null, null);
 }
Ejemplo n.º 44
0
 /// <summary>
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal override async System.Threading.Tasks.Task InternalDeleteAsync(
     DeleteMode deleteMode,
     SendCancellationsMode? sendCancellationsMode,
     AffectedTaskOccurrence? affectedTaskOccurrences)
 {
     await this.InternalDeleteAsync(deleteMode, sendCancellationsMode, affectedTaskOccurrences, false);
 }
Ejemplo n.º 45
0
 private void AddRowOnClick(object sender, RoutedEventArgs e)
 {
     Mode = DeleteMode.Undelete;
     Step.AddStation();
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Deletes the item. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="suppressReadReceipts">Whether to suppress read receipts</param>
 public void Delete(DeleteMode deleteMode, bool suppressReadReceipts)
 {
     this.InternalDelete(deleteMode, null, null, suppressReadReceipts);
 }
Ejemplo n.º 47
0
        public void Delete(DeleteMode deleteMode = DeleteMode.Normal)
        {
            ThrowIfRelative();

            if (FileExists())
                File.Delete(ToString());
            else if (DirectoryExists())
                try
                {
                    Directory.Delete(ToString(), true);
                }
                catch (IOException)
                {
                    if (deleteMode == DeleteMode.Normal)
                        throw;
                }
            else
                throw new InvalidOperationException("Trying to delete a path that does not exist: " + ToString());
        }
Ejemplo n.º 48
0
 /// <summary>
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal override void InternalDelete(
     DeleteMode deleteMode,
     SendCancellationsMode? sendCancellationsMode,
     AffectedTaskOccurrence? affectedTaskOccurrences)
 {
     throw new InvalidOperationException(Strings.DeletingThisObjectTypeNotAuthorized);
 }
Ejemplo n.º 49
0
 /// <summary>
 /// Create a new instance of the <see cref="Op"/> class that represents a  Delete operation.
 /// </summary>
 /// <param name="path">Path of the node to be deleted</param>
 /// <param name="version">Version of the node's data</param>
 /// <param name="deletemode">the delete mode for the operation</param>
 /// <returns>A Delete operation</returns>
 public static Op Delete(string path, int version, DeleteMode deletemode = DeleteMode.None)
 {
     return(new Op(OpCode.Delete, new RequestDelete(path, version, deletemode)));
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Deletes this appointment. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Specifies if and how cancellations should be sent if this appointment is a meeting.</param>
 public void Delete(DeleteMode deleteMode, SendCancellationsMode sendCancellationsMode)
 {
     this.InternalDelete(
         deleteMode,
         sendCancellationsMode,
         null);
 }
Ejemplo n.º 51
0
 /// <summary>
 /// This is not supported in this object.
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal override Task <ServiceResponseCollection <ServiceResponse> > InternalDelete(DeleteMode deleteMode, SendCancellationsMode?sendCancellationsMode, AffectedTaskOccurrence?affectedTaskOccurrences, CancellationToken token)
 {
     throw new NotSupportedException();
 }
 /// <summary>
 /// Deletes items in the specified conversation.
 /// Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="contextFolderId">The Id of the folder items must belong to in order to be deleted. If contextFolderId is
 /// null, items across the entire mailbox are deleted.</param>
 /// <param name="deleteMode">The deletion mode.</param>
 public void DeleteItems(
     FolderId contextFolderId,
     DeleteMode deleteMode)
 {
     this.Service.DeleteItemsInConversations(
         new KeyValuePair<ConversationId, DateTime?>[]
         {
             new KeyValuePair<ConversationId, DateTime?>(
                 this.Id,
                 this.GlobalLastDeliveryTime)
         },
         contextFolderId,
         deleteMode)[0].ThrowIfNecessary();
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal override void InternalDelete(
     DeleteMode deleteMode,
     SendCancellationsMode? sendCancellationsMode,
     AffectedTaskOccurrence? affectedTaskOccurrences)
 {
     this.InternalDelete(deleteMode, sendCancellationsMode, affectedTaskOccurrences, false);
 }
 /// <summary>
 /// Deletes async the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 /// <returns></returns>
 /// <exception cref="System.NotSupportedException"></exception>
 internal override System.Threading.Tasks.Task InternalDeleteAsync(DeleteMode deleteMode, SendCancellationsMode? sendCancellationsMode, AffectedTaskOccurrence? affectedTaskOccurrences)
 {
     throw new NotSupportedException();
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Deletes the object.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
 /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
 internal abstract void InternalDelete(
     DeleteMode deleteMode,
     SendCancellationsMode?sendCancellationsMode,
     AffectedTaskOccurrence?affectedTaskOccurrences);
Ejemplo n.º 56
0
        /// <summary>
        /// Deletes the object.
        /// </summary>
        /// <param name="deleteMode">The deletion mode.</param>
        /// <param name="sendCancellationsMode">Indicates whether meeting cancellation messages should be sent.</param>
        /// <param name="affectedTaskOccurrences">Indicate which occurrence of a recurring task should be deleted.</param>
        /// <param name="suppressReadReceipts">Whether to suppress read receipts</param>
        internal void InternalDelete(
            DeleteMode deleteMode,
            SendCancellationsMode? sendCancellationsMode,
            AffectedTaskOccurrence? affectedTaskOccurrences,
            bool suppressReadReceipts)
        {
            this.ThrowIfThisIsNew();
            this.ThrowIfThisIsAttachment();

            // If sendCancellationsMode is null, use the default value that's appropriate for item type.
            if (!sendCancellationsMode.HasValue)
            {
                sendCancellationsMode = this.DefaultSendCancellationsMode;
            }

            // If affectedTaskOccurrences is null, use the default value that's appropriate for item type.
            if (!affectedTaskOccurrences.HasValue)
            {
                affectedTaskOccurrences = this.DefaultAffectedTaskOccurrences;
            }

            this.Service.DeleteItem(
                this.Id,
                deleteMode,
                sendCancellationsMode,
                affectedTaskOccurrences,
                suppressReadReceipts);
        }
Ejemplo n.º 57
0
 /// <summary>
 /// Deletes the item. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 /// <param name="suppressReadReceipts">Whether to suppress read receipts</param>
 public void Delete(DeleteMode deleteMode, bool suppressReadReceipts)
 {
     this.InternalDelete(deleteMode, null, null, suppressReadReceipts);
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Deletes the item. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="deleteMode">The deletion mode.</param>
 public void Delete(DeleteMode deleteMode)
 {
     this.Delete(deleteMode, false);
 }