AdvancedLauncher.SDK.Management.FileSystemManager._WriteStream C# (CSharp) Метод

_WriteStream() приватный Метод

Writes stream to archive.
private _WriteStream ( Stream SourceStream, uint entryId ) : bool
SourceStream Stream Source stream
entryId uint ID of destination file
Результат bool
        private bool _WriteStream(Stream SourceStream, uint entryId)
        {
            if (LogManager != null) {
                LogManager.DebugFormat("Writing stream: entryId=\"{0}\"", entryId);
            }
            if (!_IsOpened && !(Access == FileAccess.ReadWrite || Access == FileAccess.Write)) {
                if (LogManager != null) {
                    LogManager.Error("Writing stream failed: Archieve not opened or no write access");
                }
                return false;
            }

            int entryIndex = GetEntryIndex(entryId);
            FileEntry entry;

            if (entryIndex > 0) {
                ArchiveEntries[entryIndex].SizeCurrent = (uint)SourceStream.Length;
                if (SourceStream.Length > ArchiveEntries[entryIndex].SizeAvailable) {
                    ArchiveEntries[entryIndex].Offset = ArchiveStream.Length;
                    ArchiveEntries[entryIndex].SizeAvailable = (uint)SourceStream.Length;
                }
                entry = ArchiveEntries[entryIndex];
            } else {
                entry = new FileEntry();
                entry.Id = entryId;
                entry.SizeCurrent = (uint)SourceStream.Length;
                entry.SizeAvailable = (uint)SourceStream.Length;
                entry.Offset = ArchiveStream.Length;
                ArchiveEntries.Add(entry);
            }
            ArchiveStream.Seek(entry.Offset, SeekOrigin.Begin);
            SourceStream.CopyTo(ArchiveStream);
            return true;
        }