/// <summary> /// Will extract the <paramref name="item"/> from the back-end directories to the <paramref name="destinationPath"/>. /// </summary> /// <param name="destinationPath">The directory to extract files to.</param> /// <param name="item">The store item to extract.</param> /// <param name="state">A null reference, <b>Nothing</b> in VB.</param> /// <returns>The filename of the extracted file.</returns> protected override string Extract_ExtractFileToPath(string destinationPath, IFileStoreItem item, object state) { CreateDirectory(destinationPath); var sourceFilename = System.IO.Path.Combine(RootPath, CleanFilenameString(item.RootFilename)); var destFilename = System.IO.Path.Combine(destinationPath, CleanFilenameString(item.Name)); System.IO.File.Copy(sourceFilename, destFilename, true); return(destFilename); }
/// <summary> /// When overridden, should extract the <paramref name="item"/> from the underlying storage system to the <paramref name="destRootPath"/>. /// </summary> /// <param name="destRootPath">The directory to export the files to.</param> /// <param name="item">The store item to extract.</param> /// <param name="state">An object, defined by the user, that will be passed to all Extract_ methods.</param> /// <returns>The filename of the extract file.</returns> protected override string Extract_ExtractFileToPath(string destRootPath, IFileStoreItem item, object state) { // find zip entry var found = ((System.IO.Compression.ZipArchive)state).Entries.FirstOrDefault((zf) => { return(CleanFilenameString(zf.FullName).Equals(item.RootFilename, StringComparison.InvariantCultureIgnoreCase)); }); // extract file if (found != null) { return(ZipperExtractFileToPath(destRootPath, found)); } return(""); }
/// <summary> /// Will extract the <paramref name="item"/> from the back-end directories to the destination root path given in the method <see cref="Extract_StartUp(string, out object)"/>. /// </summary> /// <param name="item">The store item to extract.</param> /// <param name="state">A null reference, <b>Nothing</b> in VB.</param> /// <returns>The filename of the extracted file.</returns> protected override string Extract_ExtractFile(IFileStoreItem item, object state) { if (!item.StateChangeViewer.IsNew) { CreateDirectory(System.IO.Path.GetDirectoryName(System.IO.Path.Combine(_Extract_DestRootPath, item.RootFilename))); var sourceFilename = System.IO.Path.Combine(RootPath, CleanFilenameString(item.RootFilename)); var destFilename = System.IO.Path.Combine(_Extract_DestRootPath, CleanFilenameString(item.RootFilename)); System.IO.File.Copy(sourceFilename, destFilename, true); return(destFilename); } return(""); }
/// <summary> /// Will remove an existing file, referenced by the <paramref name="item"/>, from the .zip file. /// </summary> /// <param name="item">The store item to remove.</param> /// <param name="state">A reference to an initialized System.IO.Compression.ZipArchive object. This reference, created in the <see cref="Save_Startup(out object)"/> will be passed to all Save_ methods.</param> protected override void Save_RemoveFileFromSource(IFileStoreItem item, object state) { _BackendChanged = true; ZipperRemoveFile(((System.IO.Compression.ZipArchive)state), item); }
/// <summary> /// Will update an existing file in the .zip file with the <paramref name="item"/>. /// </summary> /// <param name="item">The store item to update from.</param> /// <param name="state">A reference to an initialized System.IO.Compression.ZipArchive object. This reference, created in the <see cref="Save_Startup(out object)"/> will be passed to all Save_ methods.</param> protected override void Save_UpdateFileInSource(IFileStoreItem item, object state) { _BackendChanged = true; ZipperUpdateFile(((System.IO.Compression.ZipArchive)state), (dodSON.Core.FileStorage.ICompressedFileStoreItem)item); }
/// <summary> /// Constructor. /// </summary> /// <param name="offendingItem">The ItemType involved in the error.</param> /// <param name="message">The message that describes the error.</param> /// <param name="innerException">Gets the exception instance that caused the current exception.</param> public FileStoreException(IFileStoreItem offendingItem, string message, Exception innerException) : base(message, innerException) { OffendingItem = offendingItem; }
/// <summary> /// Constructor. /// </summary> /// <param name="offendingItem">The ItemType involved in the error.</param> /// <param name="message">The message that describes the error.</param> public FileStoreException(IFileStoreItem offendingItem, string message) : base(message) { OffendingItem = offendingItem; }
/// <summary> /// Will remove an existing file, referenced by <paramref name="item"/>, from the back-end directories. /// </summary> /// <param name="item">The store item to remove.</param> /// <param name="state">A null reference, <b>Nothing</b> in VB.</param> protected override void Save_RemoveFileFromSource(IFileStoreItem item, object state) => RemoveFile(item);
/// <summary> /// Will update an existing file in the back-end directories with given <paramref name="item"/>. /// </summary> /// <param name="item">The store item to update from.</param> /// <param name="state">A null reference, <b>Nothing</b> in VB.</param> protected override void Save_UpdateFileInSource(IFileStoreItem item, object state) => AddFile(item);