예제 #1
0
        public static void WordActions(stringint word, RichTextBox tbox)
        {
            if (word == null)
            {
                return;
            }
            var boolcolor = EvaluateIfColouredandgetColour.IsColouredandColor(word.Thestring);

            if (boolcolor.Thebool)
            {
                ColourSth.Colour_FromTo(
                    GetRangeWithstringint.GetRangeWithstringintSpaces(
                        word,
                        tbox.Text.Split(PublicStuff.Splitters)),
                    tbox,
                    boolcolor.Thecolor);
            }
            else
            {
                ColourSth.Colour_FromTo(
                    GetRangeWithstringint.GetRangeWithstringintSpaces(
                        word,
                        tbox.Text.Split(PublicStuff.Splitters)),
                    tbox,
                    boolcolor.Thecolor);
            }
        }
예제 #2
0
        public static intint GetRangeWithstringintSpaces(stringint that, IReadOnlyList <string> strings)
        {
            var start = 0;

            for (var i = 0; i < that.Theint; i++)
            {
                start += strings[i].Length + 1;
            }
            return(new intint(start, start + strings[that.Theint].Length));
        }
예제 #3
0
 private static void CharActions(stringint cchar, RichTextBox tbox)
 {
     if (cchar?.Thestring == null || cchar.Thestring.Length <= 0)
     {
         return;
     }
     if (PublicStuff.Splitters.Contains(cchar.Thestring[0]))
     {
         ColourSth.Colour_FromTo(
             new intint(cchar.Theint, tbox.SelectionStart),
             tbox,
             PublicStuff.SplitterColor);
     }
 }
예제 #4
0
    public void DivideData(string dataType, string value, out object valueData)
    {
        valueData = null;

        char divch = ',';

        string[] divres  = value.Split(divch);
        int      recount = divres.Length;

        switch (dataType)
        {
        case "int":
        {
            List <int> resultList = new List <int>();
            for (int i = 0; i < recount; i++)
            {
                string cleardata = divres[i].Replace('[', ' ').Trim();
                cleardata = cleardata.Replace(']', ' ').Trim();
                int elem = 0;
                int.TryParse(cleardata, out elem);
                resultList.Add(elem);
            }
            valueData = (object)resultList;
        }
        break;

        case "long":
        {
            List <long> resultList = new List <long>();
            for (int i = 0; i < recount; i++)
            {
                string cleardata = divres[i].Replace('[', ' ').Trim();
                cleardata = cleardata.Replace(']', ' ').Trim();
                long elem = 0;
                long.TryParse(cleardata, out elem);
                resultList.Add(elem);
            }
            valueData = (object)resultList;
        }
        break;

        case "bool":
        {
            List <bool> resultList = new List <bool>();
            for (int i = 0; i < recount; i++)
            {
                string cleardata = divres[i].Replace('[', ' ').Trim();
                cleardata = cleardata.Replace(']', ' ').Trim();
                bool elem = false;
                bool.TryParse(cleardata, out elem);
                resultList.Add(elem);
            }
            valueData = (object)resultList;
        }
        break;

        case "string":
        {
            List <string> resultList = new List <string>();
            for (int i = 0; i < recount; i++)
            {
                string cleardata = divres[i].Replace('[', ' ').Trim();
                cleardata = cleardata.Replace(']', ' ').Trim();
                resultList.Add(cleardata);
            }
            valueData = (object)resultList;
        }
        break;

        case "stringint":
        {
            List <stringint> resultList = new List <stringint>();
            List <string>    listElem   = GetElementDivide(value);
            for (int i = 0; i < listElem.Count; i++)
            {
                stringint elemt      = new stringint();
                string[]  elemDivres = listElem[i].Split(divch);

                if (elemDivres[0] == null)
                {
                    continue;
                }

                string cleardata1 = elemDivres[0].Replace('[', ' ').Trim();
                cleardata1 = cleardata1.Replace(']', ' ').Trim();

                if (elemDivres.Length <= 1)
                {
                    continue;
                }

                string cleardata2 = elemDivres[1].Replace('[', ' ').Trim();
                cleardata2 = cleardata2.Replace(']', ' ').Trim();

                elemt.strEvent = cleardata1;
                int.TryParse(cleardata2, out elemt.nValue);

                resultList.Add(elemt);
            }

            valueData = (object)resultList;
        }
        break;

        case "longint":
        {
            List <longint> resultList = new List <longint>();

            List <string> listElem = GetElementDivide(value);
            for (int i = 0; i < listElem.Count; i++)
            {
                longint  elemt      = new longint();
                string[] elemDivres = listElem[i].Split(divch);

                if (elemDivres[0] == null)
                {
                    continue;
                }

                string cleardata1 = elemDivres[0].Replace('[', ' ').Trim();
                cleardata1 = cleardata1.Replace(']', ' ').Trim();

                if (elemDivres.Length <= 1)
                {
                    continue;
                }

                string cleardata2 = elemDivres[1].Replace('[', ' ').Trim();
                cleardata2 = cleardata2.Replace(']', ' ').Trim();

                long.TryParse(cleardata1, out elemt.lValue);
                int.TryParse(cleardata2, out elemt.nValue);

                resultList.Add(elemt);
            }

            valueData = (object)resultList;
        }
        break;
        }
    }