Esempio n. 1
0
        // **********************************************************************

        public static QshReader Open(string path)
        {
            FileStream fs = null;

            try
            {
                fs = new FileStream(path, FileMode.Open, FileAccess.Read);

                Stream ds      = QshFile.GetDataStream(fs);
                int    version = ds.ReadByte();

                switch (version)
                {
                case 4: return(new V4.QshReaderImpl(fs, ds));

                default:
                    throw new FormatException("Неподдерживаемая версия файла (" + version + ")");
                }
            }
            catch
            {
                if (fs != null)
                {
                    fs.Dispose();
                }

                throw;
            }
        }
Esempio n. 2
0
        // **********************************************************************

        public QshWriter(string path, bool compress, string appName,
                         string comment, DateTime recDateTime, int streamCount)
        {
            if (streamCount < 0)
            {
                throw new ArgumentOutOfRangeException("streamCount");
            }

            if (streamCount > byte.MaxValue)
            {
                throw new OverflowException("Слишком много потоков для записи");
            }

            fs = QshFile.Create(path, compress, fileVersion);
            dw = new DataWriter(fs, recDateTime, streamCount > 1);

            dw.Write(appName);
            dw.Write(comment);
            dw.Write(recDateTime.Ticks);
            dw.Write((byte)streamCount);
        }