コード例 #1
0
        public SimpleTree LoadBIN(string path)
        {
            SimpleTree st = new SimpleTree();
            double     result;

            using (BinaryReader br = new BinaryReader(File.Open(path, FileMode.Open)))
            {
                int    numberOfByte = br.ReadInt32();
                byte[] array        = br.ReadBytes(numberOfByte);
                string s            = ByteArrayToString(array);
                if (!(double.TryParse(s, out result)))
                {
                    throw new Exception("Diese Datei besitzt leider nicht das richtige Format!");
                }
                st.Add(double.Parse(s));
            }
            return(st);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            SimpleTree s = new SimpleTree();

            s = s.Load("Lines.txt");
            try
            {
                s.Add(6);
            }
            catch (Exception Ex)
            { Console.WriteLine(Ex.Message); }

            s.search(222);

            List <double> liste = s.printall();

            foreach (double l in liste)
            {
                Console.Write(l + " ");
            }
        }
コード例 #3
0
        public SimpleTree LoadCSV(string path)
        {
            StreamReader Reader = new StreamReader(path);
            double       result;
            string       line    = Reader.ReadLine();
            SimpleTree   AllData = new SimpleTree();

            while (line != null)
            {
                if (!(double.TryParse(line, out result)))
                {
                    throw new Exception("Diese Datei besitzt leider nicht das richtige Format!");
                }
                else
                {
                    AllData.Add(double.Parse(line));
                    line = Reader.ReadLine();
                }
            }
            return(AllData);
        }