コード例 #1
0
        private static List <string> SplitInSubLists(string valueToSplit, int splitCounter)
        {
            var _result = new List <string>();

            var _length = valueToSplit.Length;
            var _half   = _length / 2;

            if (_half > 1)
            {
                var _left  = valueToSplit.Substring(0, _half);
                var _right = valueToSplit.Substring(_half);

                if (splitCounter >= 0)
                {
                    _result.AddRange(GandingSecurity.SplitInSubLists(_left, splitCounter - 1));
                    _result.AddRange(GandingSecurity.SplitInSubLists(_right, splitCounter - 1));
                }
                else
                {
                    _result.Add(_left);
                    _result.Add(_right);
                }
            }
            else
            {
                _result.Add(valueToSplit);
            }

            return(_result);
        }
コード例 #2
0
        private static List <List <string> > SplitSplit(string stream, int firstSplit)
        {
            var _splitted       = GandingSecurity.SplitInSubLists(stream, firstSplit);
            var _listSplittered = new List <List <string> >();
            var _listsBerQuat   = _splitted.Count / 4;

            for (var _i = 0; _i < 4; _i++)
            {
                var _partList = new List <string>();
                _listSplittered.Add(_partList);
                var _toElements = System.Math.Min((_i + 1) * _listsBerQuat, _splitted.Count);
                for (var _y = _i * _listsBerQuat; _y < _toElements; _y++)
                {
                    _partList.Add(_splitted[_y]);
                }
            }

            //Rotation der Sub-Sub Listen
            var _pl000 = _listSplittered[0];
            var _pl001 = _listSplittered[1];
            var _pl002 = _listSplittered[2];
            var _pl003 = _listSplittered[3];

            RotateLists(ref _pl000, ref _pl002);
            RotateLists(ref _pl001, ref _pl003);
            _listSplittered[0] = _pl000;
            _listSplittered[1] = _pl001;
            _listSplittered[2] = _pl002;
            _listSplittered[3] = _pl003;

            //Rotation der Sub Listen
            _listSplittered[0] = GandingSecurity.RotateInList(_pl000);
            _listSplittered[1] = GandingSecurity.RotateInList(_pl001);
            _listSplittered[2] = GandingSecurity.RotateInList(_pl002);
            _listSplittered[3] = GandingSecurity.RotateInList(_pl003);

            return(_listSplittered);
        }