public static IWriter Open(Stream stream, ArchiveType archiveType, CompressionType compressionType, bool leaveOpen = false) { return Open(stream, archiveType, new CompressionInfo { Type = compressionType }, leaveOpen); }
/// <summary> /// The user clicked on the 'Open archive' menu item in the 'File' menu. /// </summary> private void openFARArchiveToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog OpenFDiag = new OpenFileDialog(); OpenFDiag.Title = "Open FAR archive"; OpenFDiag.Filter = "FAR archive|*.dat|FAR archive|*.far|DBPF Archive|*.dat"; if (OpenFDiag.ShowDialog() == DialogResult.OK) { m_Far3Entries.Clear(); m_DBPFEntries.Clear(); m_FarEntries.Clear(); if (OpenFDiag.FileName.Contains(".dat")) { if (DetermineArchiveType(OpenFDiag.FileName) == ArchiveType.FAR3) { OpenDatArchive(OpenFDiag.FileName); m_CurrentFile = OpenFDiag.FileName; m_CurrentArchiveType = ArchiveType.FAR3; } else if(DetermineArchiveType(OpenFDiag.FileName) == ArchiveType.DBPF) { OpenDBPF(OpenFDiag.FileName); m_CurrentFile = OpenFDiag.FileName; m_CurrentArchiveType = ArchiveType.DBPF; } } else if (OpenFDiag.FileName.Contains(".far")) { OpenFARArchive(OpenFDiag.FileName); m_CurrentFile = OpenFDiag.FileName; m_CurrentArchiveType = ArchiveType.FAR; } } }
// File : Create new, Append to existing, Raz existing // ArchiveType : Rar = 0, Zip = 1, Tar = 2, SevenZip = 3, GZip = 4 // CompressionType : None = 0, GZip = 1, BZip2 = 2, PPMd = 3, Deflate = 4, Rar = 5, LZMA = 6, BCJ = 7, BCJ2 = 8, Unknown = 9, // Zip compression type : BZip2 // GZip compression type : GZip // example from https://github.com/adamhathcock/sharpcompress/wiki/API-Examples // this example dont work to add file to an existing zip public static void Test_Compress(string compressFile, IEnumerable<string> files, string baseDirectory = null, ArchiveType archiveType = ArchiveType.Zip, CompressionType compressionType = CompressionType.BZip2, CompressionLevel compressionLevel = CompressionLevel.Default) { //FileOption if (baseDirectory != null && !baseDirectory.EndsWith("\\")) baseDirectory = baseDirectory + "\\"; CompressionInfo compressionInfo = new CompressionInfo(); compressionInfo.DeflateCompressionLevel = compressionLevel; compressionInfo.Type = compressionType; //Trace.WriteLine("SharpCompressManager : DeflateCompressionLevel {0}", compressionInfo.DeflateCompressionLevel); //Trace.WriteLine("SharpCompressManager : CompressionType {0}", compressionInfo.Type); Trace.WriteLine($"open compressed file \"{compressFile}\""); // File.OpenWrite ==> OpenOrCreate using (FileStream stream = File.OpenWrite(compressFile)) using (IWriter writer = WriterFactory.Open(stream, archiveType, compressionInfo)) //using (IWriter writer = WriterFactory.Open(stream, archiveType, CompressionType.BZip2)) { foreach (string file in files) { string entryPath; if (baseDirectory != null && file.StartsWith(baseDirectory)) entryPath = file.Substring(baseDirectory.Length); else entryPath = zPath.GetFileName(file); Trace.WriteLine($"add file \"{entryPath}\" \"{file}\""); writer.Write(entryPath, file); } } }
public static IWriter Open(Stream stream, ArchiveType archiveType, CompressionType compressionType) { return Open(stream, archiveType, new CompressionInfo { Type = compressionType }); }
public static IWriter Open(Stream stream, ArchiveType archiveType, CompressionInfo compressionInfo) { switch (archiveType) { case ArchiveType.GZip: { if (compressionInfo.Type != CompressionType.GZip) { throw new InvalidFormatException("GZip archives only support GZip compression type."); } return new GZipWriter(stream); } case ArchiveType.Zip: { return new ZipWriter(stream, compressionInfo, null); } case ArchiveType.Tar: { return new TarWriter(stream, compressionInfo); } default: { throw new NotSupportedException("Archive Type does not have a Writer: " + archiveType); } } }
//useful to show only an image //in a future do a DialogImage class (with this). And the inherit to DialogImageTest public DialogImageTest(string title, string imagePath, ArchiveType archiveType) { Glade.XML gladeXML; gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "dialog_image_test.glade", "dialog_image_test", "chronojump"); gladeXML.Autoconnect(this); dialog_image_test.Title = title; label_name_description.Visible = false; //put an icon to window UtilGtk.IconWindow(dialog_image_test); scrolledwindow28.Hide(); if(archiveType == ArchiveType.FILE) { if(File.Exists(imagePath)) { Pixbuf pixbuf = new Pixbuf (imagePath); image_test.Pixbuf = pixbuf; } else new DialogMessage(Constants.MessageTypes.WARNING, Constants.MultimediaFileNoExists); } else { //ASSEMBLY Pixbuf pixbuf = new Pixbuf (null, imagePath); image_test.Pixbuf = pixbuf; } }
/// <summary> Initializes a new instance of the <see cref="Archive" /> class. </summary> /// <param name="path">Archive file path.</param> /// <param name="type">Archive type.</param> /// <param name="physicalSize">Size of the archive as reported by file system.</param> /// <param name="lastModified">The last modified date for this archive latest modified file.</param> protected Archive(string path, ArchiveType type, long physicalSize = 0, DateTime? lastModified = null) { Contract.Requires(!string.IsNullOrWhiteSpace(path)); Contract.Requires(physicalSize >= 0); Path = path; Type = type; LastModified = lastModified; PhysicalSize = physicalSize; }
/// <summary> Initializes a new instance of the <see cref="Archive" /> class. </summary> /// <param name="path">Archive name.</param> /// <param name="type">Archive type.</param> /// <param name="entries">Uninitialized archive entries.</param> /// <param name="physicalSize">Size of the archive as reported by file system.</param> /// <param name="size">Uncompressed contents size, 0 if unavailable. </param> /// <param name="packedSize">Cmpressed contents size, 0 if unavailable.</param> /// <param name="lastModified">The last modified date for this archive latest modified file.</param> public SingleArchive(string path, ArchiveType type, IEnumerable<Entry> entries, long physicalSize = 0, long size = 0, long packedSize = 0, DateTime? lastModified = null) : base(path, type, physicalSize, lastModified) { Contract.Requires(entries != null); Contract.Requires(size >= 0); Contract.Requires(physicalSize >= 0); Contract.Requires(packedSize >= 0); Contract.Ensures(Contents != null); Size = size; PackedSize = packedSize; _contents = new List<Entry>(); Initialize(entries); }
public static void Test_Compress_01(string compressFile, IEnumerable<string> files, string baseDirectory = null, ArchiveType archiveType = ArchiveType.Zip, CompressionType compressionType = CompressionType.BZip2, CompressionLevel compressionLevel = CompressionLevel.Default) { Trace.WriteLine("Test_Compress_01 :"); Trace.WriteLine(" compress file : \"{0}\"", compressFile); Trace.WriteLine(" archive type : {0}", archiveType); Trace.WriteLine(" compression type : {0}", compressionType); Trace.WriteLine(" compression level : {0}", compressionLevel); foreach (string file in files) Trace.WriteLine(" file : \"{0}\"", baseDirectory != null ? file.Substring(baseDirectory.Length + 1) : file); SharpCompressManager sharpCompressManager = new SharpCompressManager(); //sharpCompressManager.Test_Compress_01(compressFile, files, baseDirectory, archiveType, compressionType, compressionLevel); Test_Compress(compressFile, files, baseDirectory, archiveType, compressionType, compressionLevel); var fileInfo = zFile.CreateFileInfo(compressFile); Trace.WriteLine(" compressed file size : {0}", fileInfo.Length); }
public static IArchive Create(ArchiveType type) { switch (type) { case ArchiveType.Zip: { return ZipArchive.Create(); } case ArchiveType.Tar: { return TarArchive.Create(); } default: { throw new NotSupportedException("Cannot create Archives of type: " + type); } } }
protected ArchivingAlgorithm(ArchiveType type) { _type = type; Token = CancellationToken.None; }
public static FileInfo GetInfo(string location, ArchiveType archiveType = ArchiveType.None) { Uri uri = GetRelativeUri(location); // Get full path string fullPath = Path.Combine(AppSettings.Get(typeof(FileManager), "RootPath"), uri.ToString()); string container = fullPath; string innerFile = string.Empty; FileInfo fileInfo = new FileInfo() { Location = uri.ToString(), FullPath = fullPath }; if (fullPath.Length > FileManager.MaxPathLength || !File.Exists(fullPath)) { if (archiveType == ArchiveType.None) { throw new ArgumentException("Specified file path does not exist. If it is an archive, set archiveType parameter.", "location"); } container = Path.GetDirectoryName(fullPath); while (container.Length > 0 && (container.Length > FileManager.MaxPathLength || !File.Exists(container))) { container = Path.GetDirectoryName(container); } innerFile = fullPath.Replace(container + Path.DirectorySeparatorChar, string.Empty); } if (archiveType != ArchiveType.None) { fileInfo.ArchiveLocation = container; fileInfo.ArchiveType = archiveType; } if (!String.IsNullOrEmpty(innerFile)) { if (archiveType == ArchiveType.Zip) { using (ZipFile zipFile = new ZipFile(fileInfo.ArchiveLocation)) { ZipEntry zipEntry = zipFile.GetEntry(innerFile); fileInfo.TotalBytes = zipEntry.Size; fileInfo.FileCreated = zipEntry.DateTime; } } else { throw new NotImplementedException("Only zip archives supported at this time."); } } else { System.IO.FileInfo ioFileInfo = new System.IO.FileInfo(fullPath); fileInfo.FileCreated = ioFileInfo.CreationTime; fileInfo.FileModified = ioFileInfo.LastWriteTime; fileInfo.TotalBytes = ioFileInfo.Length; } return(fileInfo); }
internal AbstractReader(Options options, ArchiveType archiveType) { ArchiveType = archiveType; Options = options; }
/// <summary> /// Returns a list of entries inside a cloaked archive. /// </summary> /// <param name="pattern"></param> /// <returns></returns> public ZipEntry[] GetCloakedEntries(ArchiveType type) { byte[] pattern = new byte[] { }; // Sets the byte pattern based on the supplied archive type switch (type) { case ArchiveType.Zip: pattern = new byte[] { 80, 75, 3, 4 }; // 0x50 0x4B 0x03 0x04 break; case ArchiveType.ZipSFX: pattern = new byte[] { 77, 90, 144 }; // 0x4D 0x5A 0x90 break; case ArchiveType.Rar: pattern = new byte[] { 82, 97, 114, 33 }; // 0x52 0x61 0x72 0x21 break; case ArchiveType.RarSFX: pattern = new byte[] { 77, 90, 80 }; // 0x4D 0x5A 0x50 break; case ArchiveType.GZip: pattern = new byte[] { 31, 139, 8 }; // 0x1F 0x8B 0x08 break; case ArchiveType.SevenZip: pattern = new byte[] { 55, 122, 188, 175, 39, 28 }; // 0x37 0x7A 0xBC 0xAF 0x27 0x1C break; case ArchiveType.Jar: pattern = new byte[] { 95, 39, 168, 137 }; // 0x5F 0x27 0xA8 0x89 break; default: return null; } // Run the GetCloakedFiles method with selected byte pattern return GetCloakedEntries(pattern); }
internal AbstractWritableArchive(ArchiveType type) : base(type) { }
/// <summary> /// Only constructor. Defines the archive type for easy lookup. /// </summary> /// <param name="type"></param> public ArchiveBase(ArchiveType type) { mType = type; }
private dynamic MakeArchiveRecord(string parameter, double value, string unit, DateTime date, ArchiveType type) { dynamic record = new ExpandoObject(); if (type == ArchiveType.Hour) { record.type = "Hour"; } if (type == ArchiveType.Day) { record.type = "Day"; date = date.Date; } record.d1 = value; record.s1 = parameter; record.s2 = unit; record.date = date; record.dt1 = DateTime.Now; return(record); }
protected WriterTests(ArchiveType type) { this.type = type; }
// Open operations // ========================================= /// <summary> /// Opens a file from the specified location. /// </summary> /// <param name="location">Relative location of file in the FileManager system.</param> public static Stream Open(string location, ArchiveType archiveType = ArchiveType.Zip, FileCompression compression = FileCompression.None) { return(Open(GetInfo(location, archiveType), compression)); }
private dynamic GetArchive(byte na, List <byte> chs, DateTime date, ArchiveType type, dynamic units) { TimeSpan span = TimeSpan.FromHours(1); if (type == ArchiveType.Day) { span = TimeSpan.FromDays(1); } DateTime start = date + span; DateTime end = date + span + span; //if (type == ArchiveType.Day) //{ // start = date.AddDays(2); // end = date.AddDays(2); //} //if (type == ArchiveType.Hour) //{ // end = date.AddHours(1); //} dynamic answer = new ExpandoObject(); //answer.isEmpty //answer.msgcode //answer.date var records = new List <dynamic>(); foreach (var ch in chs) { dynamic archive = ReadArchive(na, ch, type, start, end); if (!archive.success) { return(archive); } List <dynamic> archives = archive.archives; if (!archives.Any()) { // dynamic answer = new ExpandoObject(); archive.success = true; archive.isEmpty = true; archive.error = "архив за запрашиваемое время пуст?"; return(archive); } var ret = ParseArchiveResponse(archives.First().body, date, type, units, ch); if (!ret.success || ret.isEmpty) { return(ret); } answer.date = ret.date; records.AddRange(ret.records); } answer.isEmpty = false; answer.records = records; answer.error = ""; answer.success = true; // return(answer); }
private static TestSession CreateTestSession(CommandLineOptions options, Core.Base.Arkade arkade, ArchiveType archiveType) { TestSession testSession; if (File.Exists(options.Archive)) { Log.Debug("File exists"); testSession = arkade.CreateTestSession(ArchiveFile.Read(options.Archive, archiveType)); } else if (Directory.Exists(options.Archive)) { Log.Debug("Directory exists"); testSession = arkade.CreateTestSession(ArchiveDirectory.Read(options.Archive, archiveType)); } else { throw new ArgumentException("Invalid archive path: " + options.Archive); } return(testSession); }
internal AbstractWritableArchive(ArchiveType type, FileInfo fileInfo, ReaderOptions readerFactoryOptions) : base(type, fileInfo, readerFactoryOptions) { }
internal AbstractWritableArchive(ArchiveType type, Stream stream, ReaderOptions readerFactoryOptions) : base(type, stream.AsEnumerable(), readerFactoryOptions) { }
/// <summary> Initializes comparison from any two archives. </summary> /// <param name="left">Left archive.</param> /// <param name="right">Right archive.</param> /// <returns>true if comparison of any two archives by this trait can be performed; false otherwise.</returns> protected override bool InitFromArchives(Archive left, Archive right) { LeftType = left.Type; RightType = right.Type; return true; }
private dynamic ParseArchiveResponse(List <dynamic> parameters, DateTime date, ArchiveType type, dynamic units, byte ch) { dynamic archive = new ExpandoObject(); archive.isEmpty = false; archive.success = true; archive.error = string.Empty; archive.date = date; List <dynamic> records = new List <dynamic>(); //Среднее значение давления P3 records.Add(MakeArchiveRecord(Glossary.P(3), parameters[3], units[Glossary.P(3)], archive.date, type)); //Среднее значение перепада давления ∆Р3 records.Add(MakeArchiveRecord(Glossary.dP(3), parameters[4], units[Glossary.dP(3)], archive.date, type)); //Среднее значение перепада давления ∆Р4 records.Add(MakeArchiveRecord(Glossary.dP(4), parameters[5], units[Glossary.dP(4)], archive.date, type)); //Стандартный объем records.Add(MakeArchiveRecord(Glossary.Vс, parameters[7], "м³", archive.date, type)); //Время интегрирования records.Add(MakeArchiveRecord(Glossary.ВНР, parameters[9], "ч", archive.date, type)); ////Нештатные ситуации //records.Add(MakeArchiveRecord(Glossary.HC, parameters[10], "", archive.date, type)); int offset = 0; if (ch == 0x02) { offset = 8; } //Среднее значение давления по каналу records.Add(MakeArchiveRecord(Glossary.P(ch), parameters[11 + offset], units[Glossary.P(ch)], archive.date, type)); //Среднее значение температуры по каналу records.Add(MakeArchiveRecord(Glossary.T(ch), parameters[12 + offset], "°C", archive.date, type)); //Среднее значение перепада давления по каналу records.Add(MakeArchiveRecord(Glossary.dP(ch), parameters[13 + offset], units[Glossary.dP(ch)], archive.date, type)); //Рабочий объем по каналу records.Add(MakeArchiveRecord(Glossary.Vp(ch), parameters[14 + offset], "м³", archive.date, type)); //Приведенный объем по каналу records.Add(MakeArchiveRecord(Glossary.V(ch), parameters[15 + offset], "м³", archive.date, type)); //Допускаемый перепад давления по каналу records.Add(MakeArchiveRecord(Glossary.dPd(ch), parameters[16 + offset], units[Glossary.dP(ch)], archive.date, type)); //Среднее значение коэффициента сжимаемости по каналу records.Add(MakeArchiveRecord(Glossary.Ksj(ch), parameters[17 + offset], "", archive.date, type)); //Среднее значение коэффициента приведения по каналу records.Add(MakeArchiveRecord(Glossary.Kpr(ch), parameters[18 + offset], "", archive.date, type)); archive.records = records; return(archive); }
private ArchiveFile(FileInfo file, ArchiveType archiveType) { File = file; ArchiveType = archiveType; }
internal AbstractArchive(ArchiveType type, IEnumerable <Stream> streams, Options options) { this.Type = type; lazyVolumes = new LazyReadOnlyCollection <TVolume>(LoadVolumes(streams.Select <Stream, Stream>(CheckStreams), options)); lazyEntries = new LazyReadOnlyCollection <TEntry>(LoadEntries(Volumes)); }
public ArchiveGenerator(ArchiveType type) { _type = type; }
/// <summary> /// Create a log helper /// </summary> /// <param name="sender">Pointer to object, module/subsystem or sytem section responsible for this log. It will be used to determine the log file name</param> /// <param name="archiveType">The type of archiving (daily, hourly, weekly, mounthly or noArchive)</param> /// <param name="ext">The Extension of the log file. De defaulf value if 'log'</param> /// <param name="path">The destinatio ndirectory of the log file. Let empty to use a folder named 'logs' in the root of current assembly.</param> public LogHelper(object sender, ArchiveType archiveType = ArchiveType.mounthly, string ext = "log", string path = "") { this.Initialize(sender.GetType().FullName, archiveType, ext, path); }
public static string MakeId(string requestId, ArchiveType archiveType, int batchNumber) { return($"ArchiveOperations/{(int)archiveType}/{requestId}/{batchNumber}"); }
/// <summary> /// Create a log helper /// </summary> /// <param name="name">A name of module/subsystem or sytem name. This value will be used to compose the log file name</param> /// <param name="archiveType">The type of archiving (daily, hourly, weekly, mounthly or noArchive)</param> /// <param name="ext">The Extension of the log file. De defaulf value if 'log'</param> /// <param name="path">The destinatio ndirectory of the log file. Let empty to use a folder named 'logs' in the root of current assembly.</param> public LogHelper(string name, ArchiveType archiveType = ArchiveType.mounthly, string ext = "log", string path = "") { this.Initialize(name, archiveType, ext, path); }
protected AbstractWriter(ArchiveType type, WriterOptions writerOptions) { WriterType = type; WriterOptions = writerOptions; }
//Letter constructor public MasterArchive(Letter let) : this() { this.type = ArchiveType.Letter; this.letter = let; }
private void ArchiveInformationEvent(string archiveFileName, ArchiveType archiveType, Uuid uuid) { _statusEventHandler.RaiseEventNewArchiveInformation(new ArchiveInformationEventArgs( archiveType.ToString(), uuid.ToString(), archiveFileName)); }
//Message constructor public MasterArchive(string content, GlobalTargetInfo target) : this() { this.type = ArchiveType.Message; this.text = content; this.lookTarget = target; }
protected AbstractWriter(ArchiveType type) { this.WriterType = type; }
/// <summary> Converts archive type to string representation. </summary> /// <param name="type">Archive type.</param> /// <returns>String representation of the given archive type.</returns> public static string TypeToString(ArchiveType type) { Contract.Ensures(Contract.Result<string>() != null); return TypesToNames.GetValue(type)?.ToLowerInvariant() ?? string.Empty; }
public static string MakeId(string requestId, ArchiveType archiveType) { return($"{archiveType}/{requestId}"); }
public static bool Create(ArchiveType format, string[] inFiles, Stream output, bool compress) { // Write the header byte[] header; if (format == ArchiveType.MRG) header = new byte[] { (byte)'M', (byte)'R', (byte)'G', (byte)'0' }; else if (format == ArchiveType.SPK) header = new byte[] { (byte)'S', (byte)'N', (byte)'D', (byte)'0' }; else if (format == ArchiveType.TEX) header = new byte[] { (byte)'T', (byte)'E', (byte)'X', (byte)'0' }; else return false; output.Write(header, 0, 4); // Write the number of files Extensions.WriteInt32(output, inFiles.Length); // Write out the 8 null bytes output.Write(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 8); // Write out the header for the archive uint offset = 0x10 + (uint)(inFiles.Length * 0x30); for (int i = 0; i < inFiles.Length; i++) { int length = (int)(new FileInfo(inFiles[i]).Length); string fname = Path.GetFileNameWithoutExtension(inFiles[i]); string fext = Path.GetExtension(inFiles[i]); if (fext.StartsWith(".")) fext = fext.Substring(1); Extensions.WriteString(output, fext, Encoding.GetEncoding("Shift_JIS"), 4); Extensions.WriteUInt32(output, offset); // Offset Extensions.WriteInt32(output, length); // Length if (format == ArchiveType.MRG) { output.Write(new byte[] { 0, 0, 0, 0 }, 0, 4); Extensions.WriteString(output, fname, Encoding.GetEncoding("Shift_JIS"), 32); } else { Extensions.WriteString(output, fname, Encoding.GetEncoding("Shift_JIS"), 20); } offset += (uint)Extensions.RoundUpTo(length, 16); } // Write out the files for (int i = 0; i < inFiles.Length; i++) { using (FileStream input = File.OpenRead(inFiles[i])) { Extensions.CopyStream(input, output); while (input.Length % 16 != 0) output.WriteByte(0); } } return true; }
public InMemoryArchive(string requestId, ArchiveType archiveType, IDomainEvents domainEvents) { RequestId = requestId; ArchiveType = archiveType; this.domainEvents = domainEvents; }
public static ArchiveFile Read(string archiveFile, ArchiveType archiveType) { return(Read(new FileInfo(archiveFile), archiveType)); }
public static IWriter Open(Stream stream, ArchiveType archiveType, CompressionType compressionType) { CompressionInfo compressionInfo = new CompressionInfo(); compressionInfo.Type = compressionType; return Open(stream, archiveType, compressionInfo); }
protected override void DoOpen() { using (CustomBinaryReader reader = new CustomBinaryReader(new FileStream(ArchivePath, FileMode.Open, FileAccess.Read))) { uint signature = reader.ReadUInt32(); if (signature != 0x58445442) { throw new InvalidDataException("File is not BA2"); } version = reader.ReadUInt32(); if (version > 1) { throw new InvalidDataException("Unsupported archive file version: " + version); } type = (ArchiveType)reader.ReadUInt32(); if (type != ArchiveType.General) { Log.Fine("Skipping archive file which is not the general purpose type."); return; } long baseOffset = reader.BaseStream.Position; uint fileCount = reader.ReadUInt32(); long fileNameTableOffset = reader.ReadInt64(); FileInfo[] files = new FileInfo[fileCount]; for (int i = 0; i < fileCount; i++) { files[i] = new FileInfo() { NameHash = reader.ReadUInt32(), Type = reader.ReadUInt32(), DirectoryNameHash = reader.ReadUInt32(), Unknown1 = reader.ReadUInt32(), DataOffset = reader.ReadInt64(), DataCompressedSize = reader.ReadUInt32(), DataUncompressedSize = reader.ReadUInt32(), Unknown2 = reader.ReadUInt32() }; } reader.BaseStream.Position = fileNameTableOffset; for (int i = 0; i < fileCount; i++) { ushort length = reader.ReadUInt16(); string path = reader.ReadStringFixedLength(length).ToLower(); string dir = Path.GetDirectoryName(path).ToLower(); string filename = Path.GetFileName(path).ToLower(); if (!sorted.ContainsKey(dir)) { sorted.Add(dir, new SortedDictionary<string, FileInfo>()); } sorted[dir].Add(filename, files[i]); } } }
public ArchiveFileTypeAttribute(ArchiveType type) { Type = type; }
public static Tuple <DateTime, IEnumerable <dynamic> > ParseData(byte[] data, ArchiveType archiveType) { if (data == null || data.Length < 6 || !CheckPacket(data)) { return(null); } int toSkip = 6; if (data[data.Length - 1] != 0x16) { toSkip -= 2; } return(Parser.Parse(data.Skip(4).Take(data.Length - toSkip).ToArray(), archiveType)); }
internal AbstractArchive(ArchiveType type) { Type = type; lazyVolumes = new LazyReadOnlyCollection <TVolume>(Enumerable.Empty <TVolume>()); lazyEntries = new LazyReadOnlyCollection <TEntry>(Enumerable.Empty <TEntry>()); }