Open() public méthode

Opens a GridFS file with the specified mode.
public Open ( string remoteFileName, FileMode mode ) : MongoGridFSStream
remoteFileName string The remote file name.
mode FileMode The mode.
Résultat MongoGridFSStream
        private void ImportFiles(MongoGridFS fs, IEnumerable<FileInfo> files, string root)
        {
            foreach (var file in files)
            {
                var name = file.FullName;
                if (!string.IsNullOrEmpty(root))
                {
                    name = name.Replace(root, string.Empty);
                }

                if(_unixStyle)
                    name = name.Replace('\\', '/');

                if (_winStyle)
                    name = name.Replace('/', '\\');

                Stream stream;

                if (fs.Exists(name))
                    stream = fs.Open(name, FileMode.Truncate, FileAccess.Write);
                else
                    stream = fs.Create(name);

                var fileStream = file.Open(FileMode.Open, FileAccess.Read);

                fileStream.CopyTo(stream);
                fileStream.Close();
                stream.Close();                
            }
        }