Esempio n. 1
0
 public void Add(double sum)
 {
     if (handler != null)
     {
         Sum += Sum;
         handler.Invoke("вы внесли " + sum);
     }
 }
 public static void fileSeeker(object state)
 {
     FileSeekFunc.timer     = DateTime.Now;
     FileSeekFunc.fileCount = 0;
     Notify += NotifyDisplayMessage;
     #region проверка правописания маски файла
     string file_mask = Program.F1.textBox2.Text;
     foreach (Char invalid_char in Path.GetInvalidFileNameChars())
     {
         if (invalid_char != '?' && invalid_char != '*')
         {
             file_mask = file_mask.Replace(invalid_char.ToString(), "");
         }
     }
     Dispatcher.Invoke(Program.F1, () =>
     {
         Program.F1.textBox2.Text = file_mask;
     });
     #endregion
     ManualResetEvent MRE = (ManualResetEvent)state;
     MRE.WaitOne();
     List <List <string> > myfileheap = new List <List <string> >();
     //добавил чтобы просто была коллекция файлов и их можно было куда то еще деть\обработать, можно убрать
     try
     {
         dirseeker(Program.F1.textBox1.Text, myfileheap);
     }
     catch
     {
         //MessageBox.Show(excpt.Message, "Error", MessageBoxButtons.YesNo);
     }
     Notify?.Invoke(FileSeekFunc.fileCount, "Поиск Окончен");
     //MessageBox.Show("jr", "Error", MessageBoxButtons.YesNo);
 }
        public static void inDirFileSeek(string rootdir, List <List <string> > myfileheap)
        {
            #region поиск файлов в папке

            string maska = (Program.F1.textBox2.Text == "")?"*.*" : Program.F1.textBox2.Text;
            //foreach (string f in GetFilesSafe(rootdir, maska))

            foreach (string f in Directory.GetFiles(rootdir, maska, SearchOption.AllDirectories))
            {
                //ОТОБРАЖАЕМ ФАЙЛ В ДЕРЕВО
                Notify?.Invoke(FileSeekFunc.fileCount, f);
                FileSeekFunc.fileCount++;

                if (Program.F1.textBox3.Text == "" || fileContainsString(f))  //если файл содержит строку, добавляем его в дерево
                {
                    treeViewAddElement(f);

                    /*List<string> file = new List<string>();
                     * file.Add(f);
                     * file.Add(rootdir);
                     * myfileheap.Add(file);*/
                }
            }
            #endregion
        }
Esempio n. 4
0
        public void BuildingBlock(string[] massline, ProductMenager workFile, ParserSetup parser, AccountHandler Notify)
        {
            string[,] mainmass = new string[countLine, countColumns];
            int LineNumber   = 0;
            int ColumnNumber = 0;

            try
            {
                if (massline.Any(x => x == null) == true)
                {
                    return;
                }
                for (int i = 0; i < massline.Length; i++)
                {
                    if (ColumnNumber != Convert.ToInt32(countColumns))
                    {
                        StringConversion(massline[i], LineNumber, ColumnNumber, mainmass);
                        if (LineNumber == Convert.ToInt32(countLine) - 1)
                        {
                            LineNumber = 0;
                            ColumnNumber++;
                        }
                        else
                        {
                            LineNumber++;
                        }
                    }
                    else
                    {
                        LineNumber   = 0;
                        ColumnNumber = 0;
                    }
                }

                string[] finmass = new string[mainmass.GetLength(0)];
                for (int j = 0; j < mainmass.GetLength(0); j++)
                {
                    for (int z = 0; z < mainmass.GetLength(1); z++)
                    {
                        finmass[j] += mainmass[j, z];
                        if (mainmass.GetLength(1) - 1 != z)
                        {
                            finmass[j] += "|";
                        }
                        finmass[j] += "   ";
                    }
                }
                lock (lockerW)
                {
                    workFile.WriteTitle();
                    workFile.WriteLineMass(finmass);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.StackTrace);
                Notify?.Invoke();
            }
        }