Exemple #1
0
        public static void removeByMatch(ArrayList collection)
        {
            TextProcessor tempObjectMSW   = new MicrosoftWord(new string[0]);        // создаем экземпляр пустышку, в который вносим искомый текст SourceCode
            TextProcessor tempObjectMSW98 = new MicrosoftWord98(new string[0]);      // создаем экземпляр пустышку, в который вносим искомый текст SourceCode
            TextProcessor tempObjectLOW   = new LibreOfficeWriter(new string[0], 1); // создаем экземпляр пустышку, в который вносим искомый текст SourceCode

            tempObjectMSW.SourceCode   = Helper.readKeysSearchCode();
            tempObjectMSW98.SourceCode = tempObjectMSW.SourceCode;
            tempObjectLOW.SourceCode   = tempObjectMSW.SourceCode;
            foreach (TextProcessor element in collection)
            {
                if (tempObjectMSW.Equals(element))
                {
                    collection.Remove(element);
                    break;
                }
                if (tempObjectMSW98.Equals(element))
                {
                    collection.Remove(element);
                    break;
                }
                if (tempObjectLOW.Equals(element))
                {
                    collection.Remove(element);
                    break;
                }
            }
        }
Exemple #2
0
        public static void findLastMatch(ArrayList collection)
        {
            TextProcessor tempObjectMSW   = new MicrosoftWord(new string[0]);        // создаем экземпляр пустышку, в который вносим искомый текст SourceCode
            TextProcessor tempObjectMSW98 = new MicrosoftWord98(new string[0]);      // создаем экземпляр пустышку, в который вносим искомый текст SourceCode
            TextProcessor tempObjectLOW   = new LibreOfficeWriter(new string[0], 1); // создаем экземпляр пустышку, в который вносим искомый текст SourceCode

            tempObjectMSW.SourceCode   = Helper.readKeysSearchCode();
            tempObjectMSW98.SourceCode = tempObjectMSW.SourceCode;
            tempObjectLOW.SourceCode   = tempObjectMSW.SourceCode;
            for (int i = collection.Count - 1; i >= 0; i--)
            {
                if (tempObjectMSW.Equals(collection[i]))
                {
                    Console.WriteLine("Найдено первое сопадение: ");
                    ((TextProcessor)collection[i]).print();
                    break;
                }
                if (tempObjectMSW98.Equals(collection[i]))
                {
                    Console.WriteLine("Найдено первое сопадение: ");
                    ((TextProcessor)collection[i]).print();
                    break;
                }
                if (tempObjectLOW.Equals(collection[i]))
                {
                    Console.WriteLine("Найдено первое сопадение: ");
                    ((TextProcessor)collection[i]).print();
                    break;
                }
            }
        }
Exemple #3
0
        public static void findFirstMatch(List <TextProcessor> collection)
        {
            TextProcessor tempObjectMSW   = new MicrosoftWord(new string[0]);        // создаем экземпляр пустышку, в который вносим искомый текст SourceCode
            TextProcessor tempObjectMSW98 = new MicrosoftWord98(new string[0]);      // создаем экземпляр пустышку, в который вносим искомый текст SourceCode
            TextProcessor tempObjectLOW   = new LibreOfficeWriter(new string[0], 1); // создаем экземпляр пустышку, в который вносим искомый текст SourceCode

            tempObjectMSW.SourceCode   = Helper.readKeysSearchCode();
            tempObjectMSW98.SourceCode = tempObjectMSW.SourceCode;
            tempObjectLOW.SourceCode   = tempObjectMSW.SourceCode;
            foreach (TextProcessor element in collection)
            {
                if (tempObjectMSW.Equals(element))
                {
                    Console.WriteLine("Найдено первое сопадение: ");
                    element.print();
                    break;
                }
                if (tempObjectMSW98.Equals(element))
                {
                    Console.WriteLine("Найдено первое сопадение: ");
                    element.print();
                    break;
                }
                if (tempObjectLOW.Equals(element))
                {
                    Console.WriteLine("Найдено первое сопадение: ");
                    element.print();
                    break;
                }
            }
        }