Пример #1
0
        public void SortChoicePoints(string choicepoints)
        {
            int from = 0;
            int to = 0;
            List<string> subChoicepoints = new List<string>();
            for (int i = 0; i < choicepoints.Length; i++)
            {
                if (choicepoints[i] == '(' && (choicepoints[i - 1] == '[' || choicepoints[i - 1] == ',')) from = i + 1;
                if (choicepoints[i] == ')') to = i;
                if (from != 0 && to != 0)
                {
                    int length = to - from;
                    subChoicepoints.Add(choicepoints.Substring(from, length));
                    from = to = 0;
                }
            }
            foreach (string sub in subChoicepoints)
            {
                ChoicePoint struc = new ChoicePoint();

                struc.id = (int)Char.GetNumericValue(sub[0]);

                //struc.title = sub.Substring(3, sub.IndexOf('"', 4) - 3);
                string fullTitle = sub.Substring(3, sub.IndexOf('"', 4) - 3);
                int firstSlash = fullTitle.IndexOf('/') +2;
                int lastSlash = fullTitle.LastIndexOf('/') -1;
                int length = fullTitle.Length - firstSlash;
                if (fullTitle.IndexOf('/') != fullTitle.LastIndexOf('/'))
                {
                    length = lastSlash - firstSlash;
                }
                struc.title = fullTitle.Substring(firstSlash, length);

                string listOfChoices = sub.Substring(sub.IndexOf("\",[\"") + 4);
                listOfChoices = listOfChoices.Replace("\"]", "");
                string[] stringSeparators = new string[] { "\",\"" };
                //struc.choicelist = listOfChoices.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
                string[] choices = listOfChoices.Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
                if (!choices[0].Contains("agent"))
                {
                    for (int i = 0; i < choices.Length; i++)
                    {
                        choices[i] = choices[i].Remove(0, 10);
                    }
                    struc.choicelist = choices;
                    choicepointsSorted.Add(struc);
                }

            }

            UpdatePanel();
        }
Пример #2
0
 internal Choice(ChoicePoint choice)
 {
     this.choicePoint = choice;
 }
Пример #3
0
		internal Choice (ChoicePoint choice)
		{
			this.choicePoint = choice;
		}