Example #1
0
 private void ParseRev2(PcdbRx2File src)
 {
     ParseRev1(src);
 }
Example #2
0
 private void ParseRev1(PcdbRx2File src)
 {
     var srcGameVersion = src.GetGameVersion();
     var selfGameVersion = Database.GetGameVersion();
     if (srcGameVersion != selfGameVersion)
         return;
     var progress = new Progress(100);
     OnProgressChanged(progress);
     var ids = src.SelectIds(DatabaseTableId.Hash);
     var idCount = ids.Rows.Count;
     OnFoundData(DatabaseTableId.Hash, idCount);
     for (var idIndex = 0; idIndex < idCount; idIndex++)
     {
         if (Cancelled)
             break;
         var id = Convert.ToUInt32(ids.Rows[idIndex][0]);
         var hashRow = src.Select(DatabaseTableId.Hash, id).Rows[0];
         var hash = (string)hashRow.ItemArray[1];
         var info = Convert.ToString(hashRow.ItemArray[2]);
         if (String.IsNullOrEmpty(info))
             Database.InsertHash(hash);
         else
             Database.InsertUpdateHash(hash, info);
         // names
         var names = src.Select(DatabaseTableId.Name, id);
         OnFoundData(DatabaseTableId.Name, names.Rows.Count);
         for (var i = 0; i < names.Rows.Count; i++)
         {
             var nameRow = names.Rows[i];
             var name = (string)nameRow[1];
             Database.InsertName(hash, name, (DateTime)nameRow[2]);
         }
         // ips
         var ips = src.Select(DatabaseTableId.Ip, id);
         OnFoundData(DatabaseTableId.Ip, ips.Rows.Count);
         for (var i = 0; i < ips.Rows.Count; i++)
         {
             var ipRow = ips.Rows[i];
             var ip = (string)ipRow[1];
             Database.InsertIp(hash, ip, (DateTime)ipRow[2]);
         }
         // gsids
         if (srcGameVersion == PcdbGameVersion.COP)
         {
             var gsids = src.Select(DatabaseTableId.Gsid, id);
             OnFoundData(DatabaseTableId.Gsid, gsids.Rows.Count);
             for (var i = 0; i < gsids.Rows.Count; i++)
             {
                 var gsidRow = gsids.Rows[i];
                 var gsid = Convert.ToUInt32(gsidRow[1]);
                 Database.InsertGsid(hash, gsid, (DateTime)gsidRow[2]);
             }
         }
         var newProgress = (uint)Math.Round(100.0*idIndex/idCount);
         if (newProgress > progress.Current)
         {
             progress.Current = newProgress;
             OnProgressChanged(progress);
         }
     }
 }