Exemplo n.º 1
0
        public static Table Load(Stream stream, char delimiter)
        {
            var gZip = IsGzip(stream);
            stream.Seek(0, SeekOrigin.Begin);
            if (gZip)
            {
                stream = new GZipStream(stream, CompressionMode.Decompress);
            }

            var table = new Table();
            table.Delimiter = delimiter;

            var sr = new StreamReader(stream);

            if (sr.Peek() >= 0)
            {
                var headerLine = sr.ReadLine();
                table.Rows.Clear();
                table.Header = UiTools.SplitString(headerLine, delimiter);
            }
            else
            {
                table.Header = new string[0];
            }

            var count = 0;
            while (sr.Peek() >= 0)
            {
                var line = sr.ReadLine();
                var rowData = UiTools.SplitString(line, delimiter);
                if (rowData.Length < 2)
                {
                    break;
                }
                table.Rows.Add(rowData);
                count++;
            }
            return table;
        }
        public void LoadFromString(string data, bool isUpdate, bool purgeOld, bool purgeAll, bool hasHeader)
        {
            if (!isUpdate )
            {
                table = new Table();
            }
            table.Lock();
            table.LoadFromString(data, isUpdate, purgeAll, hasHeader);
            if (!isUpdate)
            {
                GuessHeaderAssignments();
            }

            if (astronomical && lngColumn > -1)
            {
                var max = GetMaxValue(lngColumn);
                if (max > 24)
                {
                    RaUnits = RAUnits.Degrees;
                }
            }

            if (purgeOld)
            {
                PurgeByTime();
            }
            table.Unlock();
        }
        public override void LoadData(string path)
        {
            table = Table.Load(path, '\t');
            ComputeDateDomainRange(-1, -1);

            if (DynamicData && AutoUpdate)
            {
                DynamicUpdate();
            }
        }