예제 #1
0
        private EventStruct parseEventWizard()
        {
            EventStruct res = new EventStruct();

            //Проверка, что текущая строка равна "item"
            if (this.linesWizardText[this.lineIndex].Replace("\r", "").Trim() == "item")
            {
                //определение величины отступа
                string strIndent = this.linesWizardText[this.lineIndex].Remove(this.linesWizardText[this.lineIndex].IndexOf("item"));
                while ((!this.linesWizardText[this.lineIndex].StartsWith(strIndent + "end")) && (this.lineIndex < this.linesWizardCount))
                {
                    if (this.linesWizardText[this.lineIndex].StartsWith(strIndent + "  ISBLText = "))
                    {
                        this.lineIndex++;
                        res.text = this.parseISBLText(strIndent);
                    }
                    else
                    if (this.linesWizardText[this.lineIndex].StartsWith(strIndent + "  EventType = "))
                    {
                        string strEventTypeSuffix = "EventType = ";
                        res.name = this.linesWizardText[this.lineIndex].Trim().Remove(0, strEventTypeSuffix.Length);
                        this.lineIndex++;
                    }
                    else
                    {
                        this.lineIndex++;
                    }
                }
            }
            return(res);
        }
예제 #2
0
        private void parseWizardText(string originText, Node wizardNode)
        {
            this.originWizardText = originText;

            /**********************************************************************
            * Структура свойств мастера находится в структуре, похожей на
            * Delphi Form. Все теги расположены в отдельных строках.
            * Значения тегов в формате Unicode. Свойствам мастера присуща
            * Объектная структура. Иерархия соблюдается за счёт табуляции
            * тегов. Если значение тега очень длинное то оно разбивается на
            * несколько строк с указанием в конце строки символа конкатенации(+)
            **********************************************************************/

            /**********************************************************************
            * Сначала идёт три "События мастера":
            *   До выбора
            *   Начало
            *   Завершение
            *
            * Потом идут этапы мастера, например "Этап 1: Запрос параметров совещания"
            *   Этап содержит два события:
            *       Начало
            *       Завершение
            *   А также события:
            *       Previous
            *       Next
            *       Finish
            *       Cancel
            *   Ещё есть событие:
            *       ОК
            **********************************************************************/
            char[] charDelimeters = { '\n' };
            this.linesWizardText  = originWizardText.Split(charDelimeters);
            this.linesWizardCount = linesWizardText.Length;
            this.lineIndex        = 0;
            //Поиск начала секции с событиями маршрута
            while ((this.lineIndex < this.linesWizardCount) && (linesWizardText[this.lineIndex].Replace("\r", "") != "  Events = <"))
            {
                this.lineIndex = this.lineIndex + 1;
            }


            Node wizardEventsNode = new Node();

            wizardEventsNode.Name   = "События мастера";
            wizardEventsNode.Text   = "";
            wizardEventsNode.Parent = wizardNode;
            wizardEventsNode.Nodes  = new List <Node>();
            //Загрузка "События мастера"
            while ((this.lineIndex < this.linesWizardCount) && (linesWizardText[this.lineIndex].Replace("\r", "") != "    end>"))
            {
                //переходим к следующей строке
                this.lineIndex++;
                EventStruct eventInfo           = this.parseEventWizard();
                Node        wizardEventInfoNode = new Node();
                switch (eventInfo.name)
                {
                case "wetWizardBeforeSelection":
                    wizardEventInfoNode.Name = "До выбора";
                    break;

                case "wetWizardStart":
                    wizardEventInfoNode.Name = "Начало";
                    break;

                case "wetWizardFinish":
                    wizardEventInfoNode.Name = "Завершение";
                    break;

                default:
                    wizardEventInfoNode.Name = "Неизвестное событие: " + eventInfo.name;
                    break;
                }
                wizardEventInfoNode.Text   = eventInfo.text;
                wizardEventInfoNode.Parent = wizardEventsNode;
                wizardEventsNode.Nodes.Add(wizardEventInfoNode);
            }
            wizardNode.Nodes.Add(wizardEventsNode);
            //Загрузка этапов мастера
        }