Beispiel #1
0
        /// <summary>
        /// Transform a text file(given as a stream).
        /// </summary>
        /// <param name="fileyo"></param>
        /// <returns>Representation of text file separated into pieces less than 1024 bytes long</returns>
        public static TextTransformCollection PrepareCollectionFromLargeText(System.IO.Stream fileyo)
        {
            byte[]                  q   = new byte[900];
            List <byte[]>           tik = new List <byte[]>();
            TextTransformCollection e   = new TextTransformCollection();
            string                  funny;
            int w = 0;

            while (fileyo.Position > fileyo.Length)
            {
                if (fileyo.Length - (fileyo.Position + 900) >= 0)
                {
                    fileyo.Read(q, 0, 900);
                    funny = System.Text.Encoding.ASCII.GetChars(q).ToString();
                }
                else
                {
                    fileyo.Read(q, 0, (int)(fileyo.Length - fileyo.Position));
                    funny = System.Text.Encoding.ASCII.GetChars(q).ToString();
                    //replace the nulls on the string with spaces
                    int y = funny.IndexOf('\0');
                }
                e.Add(new TextTransformActor(funny, w));
            }
            return(e);
        }
Beispiel #2
0
        /// <summary>
        /// add text transformation for the "cut" operation
        /// </summary>
        /// <param name="selectionstart">Selection where the text was cut from</param>
        /// <param name="selectionend">Selection where the cut ended.</param>
        public void CutAdd(int selectionstart, int selectionend)
        {
            TextTransformActor t = new TextTransformActor(selectionstart, selectionend);

            queue.Add(t);
            this.thingy.Enqueue(t);
        }