コード例 #1
0
        /// <summary>
        /// запуск нарезки файла
        /// </summary>
        private void Button_Click_Start(object sender, RoutedEventArgs e)
        {
            if (DestinationFolderTextBox.Text.Trim().Length == 0 || !Directory.Exists(DestinationFolderTextBox.Text))
            {
                System.Windows.MessageBox.Show(g.Dict["MessSpecifyDestinationFolder"].ToString(), g.Dict["MessError"].ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                DestinationFolderTextBox.Focus();
                return;
            }

            string DestinationFolderTextBoxText = DestinationFolderTextBox.Text;

            ProgressBarSplitFile.Value = 0;
            if (myOptions[OptionsEnum.Mode].ToLower(CultureInfo.CurrentCulture) == "size")
            {
                new SplitFileOfSizeDelegate(g.FileManager.SplitFile).BeginInvoke(DestinationFolderTextBox.Text, Convert.ToInt64(myOptions[OptionsEnum.extMode], CultureInfo.CurrentCulture), Convert.ToInt32(dimension_group.Text, CultureInfo.CurrentCulture), delegate { g.OpenFolder(DestinationFolderTextBoxText); }, null);
            }
            else
            {
                g.FileManager.Scanner.ClearMatchUnits();
                if (((UcSplit)this.Tag).currentFormatResult.ToLower(CultureInfo.CurrentCulture) == "hex")
                {
                    g.FileManager.Scanner.AddMatchUnit(new MatchUnitBytes(AdapterFileReader.HexToByte(myOptions[OptionsEnum.extMode])));
                }
                else
                {
                    g.FileManager.Scanner.AddMatchUnit(new MatchUnitText(myOptions[OptionsEnum.extMode], true));
                }

                g.FileManager.ProgressValueChange += FileManager_ProgressValueChange;
                new SplitFileOfDataDelegate(g.FileManager.SplitFile).BeginInvoke(DestinationFolderTextBox.Text, Convert.ToInt32(dimension_group.Text, CultureInfo.CurrentCulture), delegate { g.OpenFolder(DestinationFolderTextBoxText); }, null);
            }
        }
コード例 #2
0
        /// <summary>
        /// Событие [найти следующее вхождение в файле]
        /// </summary>
        private void MenuItemFindPointCutText_Click(object sender, RoutedEventArgs e)
        {
            g.FileManager.Scanner.ClearMatchUnits();

            if (currentFormatResult.ToLower(CultureInfo.CurrentCulture) == "hex")
            {
                g.FileManager.Scanner.AddMatchUnit(new MatchUnitBytes(AdapterFileReader.HexToByte(CutTextBox.Text)));
            }
            else
            {
                g.FileManager.Scanner.AddMatchUnit(new MatchUnitText(CutTextBox.Text, false)); //searchData = AdapterFileReader.StringToSearchBytes(CutTextBox.Text);
            }
            long index_detect_find_data;

            if (SliderSizeManage.Tag is null)
            {
                index_detect_find_data = g.FileManager.FindPositionData((long)SliderSizeManage.Value);
            }
            else
            {
                index_detect_find_data = (long)SliderSizeManage.Tag;
                index_detect_find_data = g.FileManager.FindPositionData(index_detect_find_data + 1);
            }

            if (index_detect_find_data < 0 || index_detect_find_data + g.FileManager.Scanner.MinDataLengthBytes >= g.FileManager.Length)
            {
                MessageBox.Show("End of file", "End of file", MessageBoxButton.OK, MessageBoxImage.Asterisk);
            }
            else
            {
                SliderSizeManage.Value = index_detect_find_data;

                if (index_detect_find_data > -1)
                {
                    SliderSizeManage.Tag = index_detect_find_data;
                }
            }
        }