Ejemplo n.º 1
0
        public bool NextEmpty(out ClilocInfo info)
        {
            info = null;

            if (IsDisposed || Opl == null)
            {
                return(false);
            }

            for (int i = 0, index; i < EmptyClilocs.Length; i++)
            {
                index = EmptyClilocs[i];

                if (!Opl.Contains(index))
                {
                    info = ClilocLNG.NULL.Lookup(index);

                    if (info != null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 2
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();
        }