Zetbox.API.FileSystemPackageProvider.PutBlob C# (CSharp) Method

PutBlob() public method

public PutBlob ( System.Guid guid, string filename, Stream blob ) : void
guid System.Guid
filename string
blob Stream
return void
        public override void PutBlob(Guid guid, string filename, Stream blob)
        {
            if (blob == null) throw new ArgumentNullException("blob");

            string destName;
            if (!string.IsNullOrEmpty(filename))
            {
                destName = Path.Combine(_blobDir, string.Format("{0} - {1}", guid, filename));
            }
            else
            {
                destName = Path.Combine(_blobDir, string.Format("{0}.blob", guid));
            }
            using (var fs = File.OpenWrite(destName))
            {
                fs.SetLength(0);
                blob.CopyAllTo(fs);
            }
        }