Example #1
0
        /// <summary>
        /// Converts a given cell to a String; no alignment considered.
        /// </summary>
        /// <param name="matrix"></param>
        /// <param name="index"></param>
        /// <param name="formatter"></param>
        /// <returns></returns>
        protected String Form(ObjectMatrix1D matrix, int index, Former formatter)
        {
            Object value = matrix[index];

            if (value == null)
            {
                return("");
            }
            return(value.ValueOf());
        }
        /// <summary>
        /// Returns a string representations of all cells; no alignment considered.
        /// </summary>
        /// <param name="vector">
        /// The vector.
        /// </param>
        /// <returns>
        /// A string representations of all cells.
        /// </returns>
        protected string[] FormatRow(AbstractMatrix1D vector)
        {
            Former formatter = null;

            formatter = factory.Create(formatString);
            int s = vector.Size;

            String[] strings = new String[s];
            for (int i = 0; i < s; i++)
            {
                strings[i] = Form(vector, i, formatter);
            }
            return(strings);
        }
        /**
         * Constructs and returns a new format instance.
         * @param s the format string following printf conventions.
         * The string has a prefix, a format code and a suffixd The prefix and suffix
         * become part of the formatted outputd The format code directs the
         * formatting of the (single) parameter to be formattedd The code has the
         * following structure
         * <ul>
         * <li> a % (required)
         * <li> a modifier (optional)
         * <dl>
         * <dt> + <dd> forces display of + for positive numbers
         * <dt> 0 <dd> show leading zeroes
         * <dt> - <dd> align left in the field
         * <dt> space <dd> prepend a space in front of positive numbers
         * <dt> # <dd> use "alternate" formatd Add 0 or 0x for octal or hexadecimal numbersd Don't suppress trailing zeroes in general floating point format.
         * </dl>
         * <li> an int denoting field width (optional)
         * <li> a period followed by an int denoting precision (optional)
         * <li> a format descriptor (required)
         * <dl>
         * <dt>f <dd> floating point number in fixed format
         * <dt>e, E <dd> floating point number in exponential notation (scientific format)d The E format results in an uppercase E for the exponent (1.14130E+003), the e format in a lowercase e.
         * <dt>g, G <dd> floating point number in general format (fixed format for small numbers, exponential format for large numbers)d Trailing zeroes are suppressedd The G format results in an uppercase E for the exponent (if any), the g format in a lowercase e.
         * <dt>d, i <dd> int in decimal
         * <dt>x <dd> int in hexadecimal
         * <dt>o <dd> int in octal
         * <dt>s <dd> string
         * <dt>c <dd> character
         * </dl>
         * </ul>
         * @exception ArgumentException if bad format
         */
        public Former Create(String format)
        {
            var former = new Former(format);

            former.form = new Former.formdlg((s) =>
            {
                if (format == "" || s == Double.PositiveInfinity || s == Double.NegativeInfinity)
                {
                    return(s.ToString());
                }
                return(s.ToString(format));
            });

            return(former);
        }
Example #4
0
        public static AbstractPerson Create(string typeOfPerson)
        {
            AbstractPerson personResult;

            if (typeOfPerson == typeof(LeadFormer).Name)
            {
                personResult = new LeadFormer();
            }
            else if (typeOfPerson == typeof(Former).Name)
            {
                personResult = new Former();
            }
            else
            {
                personResult = new Student();
            }

            return(personResult);
        }
 /// <summary>
 /// Converts a given cell to a String; no alignment considered.
 /// </summary>
 protected abstract String Form(AbstractMatrix1D matrix, int index, Former formatter);
Example #6
0
 public NewTexture(Former parent)
 {
     this.parent = parent;
     InitializeComponent();
 }
Example #7
0
        private void ReadData()
        {
            if (!File.Exists(KeyFile()))
            {
                using (File.Create(KeyFile())) { }
                password = ""; respo = "";
                //Supposed To Run Intro Form Here
                try { Application.OpenForms["Splash"].Invoke(new MethodInvoker(delegate { Splash.frm.Hide(); })); }
                catch (Exception)
                {
                }
                Debug.WriteLine("### KeyFile Found But Empty , Start Intro ###");
                string all = new Former().OPenIntro();
                Write(all.Split('%')[0], all.Split('%')[1]);
                Environment.Exit(0);
                return;
            }
            else
            {
                try
                {
                    FileStream fs = new FileStream(KeyFile(), FileMode.OpenOrCreate);
                    fs.Close();
                    Debug.WriteLine(KeyFile());

                    var text = File.ReadAllText(KeyFile());
                    text = StringCipher.ReGenerateName(text);
                    Debug.WriteLine(text);

                    if (text != "")
                    {
                        var p  = text.Remove(text.IndexOf("#"), text.Length - text.IndexOf("#"));
                        var pp = text.Remove(0, text.IndexOf("#"));
                        var px = pp.Replace("$", "").Replace("#", "");

                        password  = p;
                        respo     = px;
                        RespoPath = px;

                        //TODO ; REMOVE THIS
#if Debugging
                        if (password != "" && RespoPath != "")
                        {
                            Debug.WriteLine
                                ("#### " + password + "  Is Readed [" + respo + "] ###");
                        }
                        else
                        {
                            Debug.WriteLine
                                ("#### MetaFile Is Readed [empty] ###");
                        }
#endif
                    }
                    else
                    {
                        password = ""; RespoPath = "";
                    }
                }
                catch (Exception)
                {
                    File.Delete(KeyFile());
                    ReadData();
                }
            }
        }
Example #8
0
 /// <summary>
 /// Converts a given cell to a String; no alignment considered.
 /// <summary>
 protected override String Form(AbstractMatrix1D matrix, int index, Former formatter)
 {
     return(this.Form((DoubleMatrix1D)matrix, index, formatter));
 }
Example #9
0
 /// <summary>
 /// Converts a given cell to a String; no alignment considered.
 /// <summary>
 protected String Form(DoubleMatrix1D matrix, int index, Former formatter)
 {
     return(formatter.form(matrix[index]));
 }