Пример #1
0
        private void btnShowDif_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(cbFolder.Text))
            {
                MessageBox.Show("Please choose folder");
                return;
            }

            if (lvFiles.SelectedIndices.Count == 0)
            {
                MessageBox.Show("Please choose item");
                return;
            }

            /*
             * if (lsbFiles.SelectedIndex < 0)
             * {
             *  MessageBox.Show("Please choose file");
             *  return;
             * }
             *
             * if (String.IsNullOrEmpty(cbObjects.Text))
             * {
             *  MessageBox.Show("Please choose object");
             *  return;
             * }
             */

            FileWithObjects fo = (FileWithObjects)lvFiles.SelectedItems[0].Tag;

            ShowDif(cbFolder.Text, fo);

            //ShowDif(cbObjects.Text, cbFolder.Text, lsbFiles.SelectedItem.ToString());
        }
Пример #2
0
        /*
         * //Отбор файлов, содержащих объект
         * private async void FilterFiles(string objectName)
         * {
         *  if (lFilterFilesInProgress) return;
         *
         *  if (String.IsNullOrEmpty(objectName)) return;
         *
         *  tbInfo.Text += "Filter files start\r\n";
         *
         *  List<FileWithObjects> result;
         *  progressBar.Show();
         *  try
         *  {
         *      lFilterFilesInProgress = true;
         *      Task<List<FileWithObjects>> searchTask = fo.FilterAsync(objectName);
         *      result = await searchTask;
         *  }
         *  finally
         *  {
         *      lFilterFilesInProgress = false;
         *      progressBar.Hide();
         *  }
         *
         *  tbInfo.Text += "Filter files end\r\n";
         *
         *  lsbFiles.Items.Clear();
         *  //List<FileWithObjects> files = fo.Files;
         *  if (result != null)
         *  {
         *      foreach (FileWithObjects f in result)
         *      {
         *          lsbFiles.Items.Add(f.FileName);
         *      }
         *  }
         * }
         *
         * private void cbObjects_SelectedIndexChanged(object sender, EventArgs e)
         * {
         *
         *  //if (String.IsNullOrEmpty(cbFolder.Text))
         *  //{
         *  //    MessageBox.Show("Please choose folder");
         *  //    return;
         *  //}
         *
         *  if (String.IsNullOrEmpty(cbObjects.Text))
         *  {
         *      MessageBox.Show("Please choose object");
         *      return;
         *  }
         *
         *  FilterFiles(cbObjects.Text);
         * }
         */

        //отображение расхождений
        private void ShowDif(string path, FileWithObjects fo)
        {
            if ((fo == null) || (fo.objects == null))
            {
                return;
            }
            string objectName = fo.objects.First();
            string fileName   = fo.FileName;

            if (String.IsNullOrEmpty(fileName) || String.IsNullOrEmpty(objectName))
            {
                return;
            }
            ShowDif(objectName, path, fileName);
        }