public void Store(CurveIndex record)
        {
            if (record == null)
            {
                return;
            }
            if (fileStream != null)
            {
                byte[] data = record.GetBytes();

                try
                {
                    fileStream.Position = record.Index * CurveIndex.IndexSize;
                    fileStream.Write(data, 0, data.Length);
                    fileStream.Flush();
                }
                catch (Exception) { }
            }
        }
Exemple #2
0
        public void Store(CurveIndex indexRecord, float[] points)
        {
            if (fileStream != null)
            {
                int ptNum = indexRecord.CurvePoint;

                List <byte> list = new List <byte>();
                list.AddRange(indexRecord.GetBytes());

                for (int i = 0; i < ptNum; i++)
                {
                    list.AddRange(BitConverter.GetBytes(points[i]));
                }

                int leftNum = this.RecordSize - list.Count;
                for (int i = 0; i < leftNum; i++)
                {
                    list.Add(0);
                }

                byte[] buffer = list.ToArray();
                try
                {
                    int offset = indexRecord.CurveFileIndex * this.RecordSize;
                    if (fileStream.Length <= offset)
                    {
                        fileStream.SetLength(fileStream.Length + IncreaseSize);
                    }
                    fileStream.Position = indexRecord.CurveFileIndex * this.RecordSize;

                    fileStream.Write(buffer, 0, this.RecordSize);
                    fileStream.Flush();
                }
                catch (Exception)
                {
                }
            }
        }
        public void Store(CurveIndex indexRecord, float[] points)
        {
            if (fileStream != null)
            {
                int ptNum = indexRecord.CurvePoint;

                List<byte> list = new List<byte>();
                list.AddRange(indexRecord.GetBytes());

                for (int i = 0; i < ptNum; i++)
                {
                    list.AddRange(BitConverter.GetBytes(points[i]));
                }

                int leftNum = this.RecordSize - list.Count;
                for (int i = 0; i < leftNum; i++)
                {
                    list.Add(0);
                }

                byte[] buffer = list.ToArray();
                try
                {
                    int offset=indexRecord.CurveFileIndex * this.RecordSize;
                    if (fileStream.Length <= offset)
                    {
                        fileStream.SetLength(fileStream.Length + IncreaseSize);
                    }
                    fileStream.Position = indexRecord.CurveFileIndex * this.RecordSize;

                    fileStream.Write(buffer, 0, this.RecordSize);
                    fileStream.Flush();
                }
                catch (Exception)
                {

                }
            }
        }
        public void Store(CurveIndex record)
        {
            if (record == null) return;
            if (fileStream != null)
            {
                byte[] data = record.GetBytes();

                try
                {
                    fileStream.Position = record.Index * CurveIndex.IndexSize;
                    fileStream.Write(data, 0, data.Length);
                    fileStream.Flush();
                }
                catch (Exception) { }
            }
        }