Exemplo n.º 1
0
        /// <summary>
        ///     Applies all changes to the underlying ObjectPropertyList
        /// </summary>
        public void Apply()
        {
            if (Opl == null || _Buffer.Count == 0)
            {
                _Buffer.Clear();
                return;
            }

            while (_Buffer.Count > 0)
            {
                var info = Lookup(Index++);

                if (info == null)
                {
                    break;
                }

                if (!info.HasArgs)
                {
                    continue;
                }

                var final = String.Empty;

                var take = 0;

                for (var i = 0; i < _Buffer.Count; i++)
                {
                    var s = _Buffer[i];

                    if (i > 0)
                    {
                        final += '\n';
                    }

                    if (String.IsNullOrWhiteSpace(s))
                    {
                        s = " ";
                    }

                    final += s;

                    if (++take >= LineBreak || final.Length >= ClilocThreshold)
                    {
                        break;
                    }
                }

                if (take == 0)
                {
                    break;
                }

                _Buffer.RemoveRange(0, take);

                Opl.Add(info.Index, info.ToString(final));
            }

            _Buffer.Clear();
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Applies all changes to the underlying ObjectPropertyList
        /// </summary>
        public void Apply()
        {
            if (Opl == null || Count == 0)
            {
                return;
            }

            for (; _Index < EmptyClilocs.Length + EmptyMultiClilocs.Length; _Index++)
            {
                var range = GetCurrentRange();

                if (range.Count == 0)
                {
                    break;
                }

                if (_Index < EmptyClilocs.Length)
                {
                    Opl.Add(EmptyClilocs[_Index], String.Join("\n", range));
                }
                else
                {
                    int index  = _Index - EmptyClilocs.Length;
                    var args   = new object[EmptyMultiClilocs[index, 1]];
                    var format = new string[args.Length];

                    args.For(
                        i =>
                    {
                        args[i]   = i == 0 ? String.Join("\n", range) : String.Empty;
                        format[i] = "{" + i + "}";
                    });

                    Opl.Add(EmptyMultiClilocs[index, 0], String.Join("\t", format), args);
                }
            }

            _Index = 0;
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Applies all changes to the underlying ObjectPropertyList
        /// </summary>
        public void Apply()
        {
            if (Opl == null || _Buffer.Count == 0)
            {
                _Buffer.Clear();
                return;
            }

            ClilocInfo info;
            string     final;
            int        take;

            while (_Buffer.Count > 0)
            {
                if (!NextEmpty(out info))
                {
                    break;
                }

                if (!info.HasArgs || Opl.Contains(info.Index))
                {
                    continue;
                }

                final = String.Empty;
                take  = 0;

                for (var i = 0; i < _Buffer.Count; i++)
                {
                    var s = _Buffer[i];

                    if (i > 0)
                    {
                        final += '\n';
                    }

                    if (String.IsNullOrWhiteSpace(s))
                    {
                        s = " ";
                    }

                    final += s;

                    if (++take >= LineBreak || final.Length >= ClilocThreshold)
                    {
                        break;
                    }
                }

                if (take == 0)
                {
                    break;
                }

                _Buffer.RemoveRange(0, take);

                Opl.Add(info.Index, info.ToString(final));
            }

            _Buffer.Clear();
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Applies all changes to the underlying ObjectPropertyList
        /// </summary>
        public void Apply()
        {
            if (Opl == null || Count == 0)
            {
                Clear();
                TrimExcess();
                return;
            }

            while (Count > 0)
            {
                if (!EmptyClilocs.InBounds(Index))
                {
                    break;
                }

                var info = Lookup(Index++);

                if (info == null || !info.HasArgs)
                {
                    continue;
                }

                int r = 0, l = 0;

                foreach (var entry in this)
                {
                    if (!String.IsNullOrEmpty(entry))
                    {
                        if (r > 0 && l + entry.Length >= ClilocThreshold)
                        {
                            break;
                        }

                        l += entry.Length;
                    }

                    if (++r >= LineBreak || l >= ClilocThreshold)
                    {
                        break;
                    }
                }

                if (r <= 0)
                {
                    break;
                }

                if (r == 1)
                {
                    Opl.Add(info.Index, info.ToString(Dequeue()));
                    continue;
                }

                var range = new string[Math.Min(r, Count)];

                this.DequeueRange(ref range);

                Opl.Add(info.Index, info.ToString(String.Join("\n", range)));
            }

            Clear();
            TrimExcess();
        }