コード例 #1
0
        private void Edit_File_Button_Click(object sender, RoutedEventArgs e)
        {
            var           item                  = ((sender as Button)?.Tag as ListViewItem)?.DataContext;
            var           itemId                = (item as PACFileInfoV2)?.nameHash;
            int           index                 = tocFileInfo.allFiles.FindIndex(s => s.nameHash == itemId);
            PACFileInfoV2 selectedInfo          = tocFileInfo.allFiles[index];
            PACFileInfoV2 backupInfo            = (PACFileInfoV2)selectedInfo.Clone();
            uint          lastRelativePathIndex = (uint)tocFileInfo.allFiles.Count();
            uint          totalFileCount        = tocFileInfo.totalFileEntries;
            PACFileInfoUI PACFileInfoEdit       = new PACFileInfoUI(selectedInfo, lastRelativePathIndex, totalFileCount, (uint)index);
            bool?         save                  = PACFileInfoEdit.ShowDialog();

            if (save == false)
            {
                tocFileInfo.allFiles[index] = backupInfo;
            }
            else
            {
                if (selectedInfo.fileInfoIndex > totalFileCount - 1)
                {
                    tocFileInfo.totalFileEntries++;
                }

                tocFileInfo.allFiles[index] = selectedInfo;
            }

            psarcInfolv.Items.Refresh();
        }
コード例 #2
0
        private void Add_File_Button_Click(object sender, RoutedEventArgs e)
        {
            PACFileInfoV2 newInfo = new PACFileInfoV2();
            uint          lastRelativePathIndex = (uint)tocFileInfo.allFiles.Count(); //tocFileInfo.allFiles.Where(s => s.fileFlags.HasFlag(PACFileInfo.fileFlagsEnum.hasFileName)).Last().relativePathIndex;
            uint          totalFileCount        = tocFileInfo.totalFileEntries;
            PACFileInfoUI PACFileInfoEdit       = new PACFileInfoUI(newInfo, lastRelativePathIndex, totalFileCount, lastRelativePathIndex);
            bool?         save = PACFileInfoEdit.ShowDialog();

            if (save == true)
            {
                tocFileInfo.allFiles.Add(newInfo);

                if (newInfo.fileInfoIndex > totalFileCount - 1)
                {
                    tocFileInfo.totalFileEntries++;
                }
            }
            psarcInfolv.Items.Refresh();
        }