Exemplo n.º 1
0
        public bool Compare(TADFileEntry tadFileEntry)
        {
            if (FileSize > 0)
            {
                /*
                 * if (FirstHash == tadFileEntry.FirstHash &&
                 * FileSize == tadFileEntry.FileSize) return true;
                 */

                //unsafe
                if (FirstHash == tadFileEntry.FirstHash)
                {
                    return(true);
                }
            }
            else
            {
                if (FirstHash == tadFileEntry.FirstHash &&
                    SecondHash == tadFileEntry.SecondHash)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 public static string GetFilename(TADFileEntry tadFileEntry)
 {
     foreach (FilenameDatabaseEntry entry in Entries)
     {
         if (entry.Compare(tadFileEntry))
         {
             return(entry.Filename);
         }
     }
     return("");
 }
Exemplo n.º 3
0
 public void MapDescriptionToTADInstance(TADFile tadFile)
 {
     DescriptionChanged(this, new DescriptionChangedArgs("Mapping descriptions to TAD..."));
     for (int i = 0; i < tadFile.FileEntries.Count; i++)
     {
         ProgressChanged(this, new ProgressChangedArgs(i, tadFile.FileEntries.Count));
         TADFileEntry entry = tadFile.FileEntries[i];
         foreach (DescriptionDatabaseEntry e in Entries)
         {
             if (entry.Filename.Contains(e.ID) || (!String.IsNullOrEmpty(e.ModelID) && entry.Filename.Contains(e.ModelID)))
             {
                 entry.Description = e.Name;
                 continue;
             }
         }
     }
     Finished(this, new FinishedArgs(true));
 }
Exemplo n.º 4
0
 public void MapFilenamesToTADInstance(CacheFile cacheFile)
 {
     DescriptionChanged(this, new DescriptionChangedArgs("Mapping filenames to TAD..."));
     for (int i = 0; i < cacheFile.TADFile.FileEntries.Count; i++)
     {
         ProgressChanged(this, new ProgressChangedArgs(i, cacheFile.TADFile.FileEntries.Count));
         TADFileEntry          entry   = cacheFile.TADFile.FileEntries[i];
         FilenameDatabaseEntry dbEntry = null;
         foreach (FilenameDatabaseEntry e in Entries)
         {
             if (e.Compare(entry))
             {
                 dbEntry = e;
                 break; //always use first match
             }
         }
         entry.RenameAndMoveFile(cacheFile, dbEntry);
     }
     Finished(this, new FinishedArgs(true));
 }
Exemplo n.º 5
0
        private void dataGridView_TAD_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
            {
                return;
            }
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            this.dataGridView_TAD.CurrentCell = this.dataGridView_TAD.Rows[e.RowIndex].Cells[e.ColumnIndex];
            TADFileEntry entry    = m_entriesView[e.RowIndex];
            string       filename = Path.GetDirectoryName(m_cacheFile.Filename) + m_cacheFile.Header.RelativeOutputFolder + "\\" + entry.RelativePath;

            ShellContextMenu ctxMnu = new ShellContextMenu();

            FileInfo[] arrFI = new FileInfo[1];
            arrFI[0] = new FileInfo(filename);
            ctxMnu.ShowContextMenu(arrFI, Cursor.Position);
        }
Exemplo n.º 6
0
 private void dataGridView_TAD_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Space)
     {
         if (m_suspendSpacebar)
         {
             return;
         }
         if (dataGridView_TAD.SelectedRows.Count < 1)
         {
             return;
         }
         bool firstSelectedEntryValue = m_entriesView[dataGridView_TAD.SelectedRows[0].Index].Export;
         for (int i = 0; i < dataGridView_TAD.SelectedRows.Count; i++)
         {
             TADFileEntry entry = m_entriesView[dataGridView_TAD.SelectedRows[i].Index];
             entry.Export = !firstSelectedEntryValue;
         }
         dataGridView_TAD.Refresh();
     }
 }