-
Notifications
You must be signed in to change notification settings - Fork 0
Dynamically linked archivator
Oleg edited this page Nov 6, 2016
·
55 revisions
Dynamically Linked Archiving Methods - this is modern archivator for all. It has GUI and Console versions. You can write and integrade Compressing Methods into this archivator. You can integrade our FrameWork into your program or you can download fully worked compiled copy and use that as 7zip or WinRar.
You can select only one option:
- For archivate:
$dla ar C:\Users C:\Archives\Archive76.dla
-- Where C:\Users
- base folder for compress, C:\Users C:\Archives\Archive76.dla
- archive destination.
- For Unzip:
$dla dar C:\Archives\Archive76.dla C:\NewFolderForArchive76
--Where C:\Archives\Archive76.dla
- archive file, C:\NewFolderForArchive76
- folder for unzipping(will be created).
If you want to develop methods, you need to follow some rules:
-
DLL
-
You need to make project with Portable Class Library (PCL) (For realize MVVM pattern)
-
You need make class with constructor:
using System;
namespace Method
{
public class Method
{
/// <summary>
/// Constructor for methods
/// If Zip true then we need to call zip algorithm else unzip.
/// </summary>
/// <param name="InputFileStream"> Folder stream with data </param>
/// <param name="OutputFileStream"> Clear stream for compressed data </param>
/// <param name="ZipFlag"> Flag of method. If ZipFlag = true then need to call zip method </param>
public Method(System.IO.Stream InputFileStream, System.IO.Stream OutputFileStream, bool ZipFlag)
{
this.BinFileReader = new System.IO.BinaryReader(InputFileStream);
this.BinFileWriter = new System.IO.BinaryWriter(OutputFileStream);
if (ZipFlag)
{
Compress();
}
else
{
DeCompress();
}
}
/// <summary>
/// Method for compressing data from BinFileReader and write into BinFileWriter
/// </summary>
private void Compress()
{
for (; this.BinFileReader.BaseStream.Position < this.BinFileReader.BaseStream.Length;)
{
this.BinFileWriter.Write(this.BinFileReader.ReadByte());
}
}
/// <summary>
/// Method for decompressing data from BinFileReader and write into BinFileWriter
/// </summary>
private void DeCompress()
{
for (; this.BinFileReader.BaseStream.Position < this.BinFileReader.BaseStream.Length;)
{
this.BinFileWriter.Write(this.BinFileReader.ReadByte());
}
}
/// <summary>
/// Reader for input stream
/// </summary>
private System.IO.BinaryReader BinFileReader
{
get;
set;
}
/// <summary>
/// Writer for input stream
/// </summary>
private System.IO.BinaryWriter BinFileWriter
{
get;
set;
}
}
}