Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        public PACFileInfoUI(PACFileInfoV2 pacFileInfo, uint lastRelativePathIndex, uint totalFileCount, uint currentRelativePathIndex)
        {
            InitializeComponent();
            pacFileInfo.fileFlags |= fileFlagsEnum.hasFileName;
            this.pacFileInfo       = pacFileInfo;
            this.DataContext       = this;
            this.totalFileCount    = totalFileCount;
            bool hasPath = false;

            if (pacFileInfo.filePath != null)
            {
                hasPath = true;
            }
            this.hasPath = hasPath;
            this.lastRelativePathIndex    = lastRelativePathIndex;
            this.currentRelativePathIndex = currentRelativePathIndex;
            patchNoCB.ItemsSource         = Enum.GetValues(typeof(patchNoEnum)).Cast <patchNoEnum>();
            prefixCB.ItemsSource          = Enum.GetValues(typeof(prefixEnum)).Cast <prefixEnum>();
        }