Пример #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="romName"></param>
        /// <param name="fileSize"></param>
        /// <param name="crc"></param>
        /// <param name="sha1"></param>
        /// <returns></returns>
        public List<ZipFileEntry> SearchForRom(string romName, long fileSize = long.MinValue, int crc = int.MinValue)
        {
            var zipFileEntries = new List<ZipFileEntry>();
            var dt = _zipFileService.QueryDatabase(romName, crc, fileSize);

            foreach(DataRow r in dt.Rows)
            {
                var zfe = new ZipFileEntry(r[0].ToString(), r[1].ToString(), (long)r[2], (int)r[3]);

                bool add = true;

                if(fileSize != long.MinValue)
                {
                    if (zfe.FileSize == fileSize)
                        add = true;
                }

                if (crc != int.MinValue)
                {
                    if (zfe.CRC == crc)
                        add = true;
                }

                if(add)
                {
                    zipFileEntries.Add(zfe);
                }
            }

            return zipFileEntries;
        }
Пример #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="zipFilePath"></param>
        /// <returns></returns>
        public List<ZipFileEntry> GetZipFileContents(string zipFilePath)
        {
            var contents = new List<ZipFileEntry>();

            var zf = _zipFileService.ReadZipFileTOC(zipFilePath);
            foreach (var z in zf)
            {
                var zfe = new ZipFileEntry(zipFilePath, z,
                    _zipFileService.GetFileSize(zipFilePath, z),
                    _zipFileService.GetFileCRC(zipFilePath, z));

                contents.Add(zfe);
            }

            return contents;
        }
Пример #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="entry"></param>
 public void InsertRom(ZipFileEntry entry)
 {
     _zipFileService.WriteToDatabase(entry.ZipFileContainer, entry.FileName, entry.FileSize, entry.CRC);
 }