コード例 #1
0
        /// <summary>
        /// Opens a file identified by a URI for read or write.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        /// <param name="archival"></param>
        /// <returns></returns>
        public Stream Open(Uri uri, DataFileMode mode, DataFileCompression compression, DataFileArchival archival)
        {
            this.uri         = uri;
            this.mode        = mode;
            this.compression = compression;
            this.archival    = archival;

            return(Open());
        }
コード例 #2
0
        /// <summary>
        /// Initializes private member variables.
        /// </summary>
        private void InitializeMembers()
        {
            this.uri         = null;
            this.mode        = DataFileMode.Read;
            this.compression = DataFileCompression.Automatic;
            this.archival    = DataFileArchival.Automatic;

            this.userName = null;
            this.password = null;
        }
コード例 #3
0
        public FileFormatDescription GetFileFormatDescription(Uri uri, out string filename, out string extension, out DataFileCompression compression)
        {
            GetExtensionWithoutCompression(uri, out filename, out extension, out compression);

            // FInd file format with the appropriate extensions
            FileFormatDescription format = null;

            foreach (var f in GetFileFormatDescriptions())
            {
                if (StringComparer.InvariantCultureIgnoreCase.Compare(extension, f.Value.DefaultExtension) == 0)
                {
                    format = f.Value;
                    break;
                }
            }

            return(format);
        }
コード例 #4
0
        /// <summary>
        /// Returns the file extension by stripping of the extension of the
        /// compressed file, if any.
        /// </summary>
        protected void GetExtensionWithoutCompression(Uri uri, out string filename, out string extension, out DataFileCompression compressionMethod)
        {
            var path = Util.UriConverter.ToFilePath(uri);    // This isn't always a file path, so it's the safest to do now

            extension = Path.GetExtension(path);

            if (Jhu.Graywulf.IO.Constants.CompressionExtensions.ContainsKey(extension))
            {
                filename          = Path.GetFileNameWithoutExtension(path);
                extension         = Path.GetExtension(path);
                compressionMethod = Jhu.Graywulf.IO.Constants.CompressionExtensions[extension];
            }
            else
            {
                filename          = Path.GetFileName(path);
                extension         = Path.GetExtension(path);
                compressionMethod = DataFileCompression.None;
            }
        }
コード例 #5
0
ファイル: StreamFactory.cs プロジェクト: skyquery/graywulf
        /// <summary>
        /// Initializes private member variables.
        /// </summary>
        private void InitializeMembers()
        {
            this.uri = null;
            this.mode = DataFileMode.Read;
            this.compression = DataFileCompression.Automatic;
            this.archival = DataFileArchival.Automatic;

            this.userName = null;
            this.password = null;
        }
コード例 #6
0
ファイル: StreamFactory.cs プロジェクト: skyquery/graywulf
        /// <summary>
        /// Opens a file identified by a URI for read or write.
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="mode"></param>
        /// <param name="compression"></param>
        /// <param name="archival"></param>
        /// <returns></returns>
        public Stream Open(Uri uri, DataFileMode mode, DataFileCompression compression, DataFileArchival archival)
        {
            this.uri = uri;
            this.mode = mode;
            this.compression = compression;
            this.archival = archival;

            return Open();
        }
コード例 #7
0
        public FileFormatDescription GetFileFormatDescription(Uri uri, out string filename, out string extension, out DataFileCompression compression)
        {
            GetExtensionWithoutCompression(uri, out filename, out extension, out compression);

            // FInd file format with the appropriate extensions
            FileFormatDescription format = null;
            foreach (var f in GetFileFormatDescriptions())
            {
                if (StringComparer.InvariantCultureIgnoreCase.Compare(extension, f.Value.DefaultExtension) == 0)
                {
                    format = f.Value;
                    break;
                }
            }

            return format;
        }
コード例 #8
0
        /// <summary>
        /// Returns the file extension by stripping of the extension of the
        /// compressed file, if any.
        /// </summary>
        protected void GetExtensionWithoutCompression(Uri uri, out string filename, out string extension, out DataFileCompression compressionMethod)
        {
            var path = Util.UriConverter.ToFilePath(uri);    // This isn't always a file path, so it's the safest to do now
            extension = Path.GetExtension(path);

            if (Jhu.Graywulf.IO.Constants.CompressionExtensions.ContainsKey(extension))
            {
                filename = Path.GetFileNameWithoutExtension(path);
                extension = Path.GetExtension(path);
                compressionMethod = Jhu.Graywulf.IO.Constants.CompressionExtensions[extension];
            }
            else
            {
                filename = Path.GetFileName(path);
                extension = Path.GetExtension(path);
                compressionMethod = DataFileCompression.None;
            }
        }