Example #1
0
        /// <summary>
        /// Set supplied string at supplied index
        /// </summary>
        /// <param name="i"></param>
        /// <param name="s"> </param>
        /// <returns></returns>
        internal void At(int i, String s)
        {
            Space newspaceobject = new Space();
            int   counter        = 0;
            int   incrementer    = 0;

            while (true)
            {
                while (Text[incrementer].GetType() == newspaceobject.GetType()) //Find Only the Strings
                {
                    incrementer++;                                              //If position is a space, increment til its a number
                }
                //We Will Get Here When We Have a String
                if (i == counter)
                {
                    i = incrementer; //Location of the String
                    break;
                }
                counter++;     //Next String
                incrementer++; //Move Along One
            }
            object currentobject;

            if (s != " ")
            {
                currentobject = new TextString(s);
            }
            else
            {
                currentobject = new Space();
            }
            Text.Insert(i + 1, currentobject);
        }
Example #2
0
 /// <summary>
 /// Add string to this line subject to overflow constraint.
 /// True if added and hence no new line required.
 /// False if not added to line.
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 internal bool Add(String s)
 {
     try
     {
         if (Overflow(s))
         {
             return(false);
         }
         TextString input = new TextString(s); //Create a Custom String Object with the string
         Text.Add(input);                      //Add it to the Object Collection
         Space space = new Space();
         Text.Add(space);
         return(true);
     }
     catch (Exception)
     {
         return(false); //If We Could Not Add It
     }
 }