Ejemplo n.º 1
0
        static BufferManager()
        {
            c_id = IdentityManager.AcquireIdentity(typeof(BufferManager).Name);

            c_availableBuffersBySize = new Dictionary <int, Stack <BufferInstance> >();
            c_availableBuffersBySize.Add(BUFFER_SIZE_BYTES, new Stack <BufferInstance>());
            c_bufferMapping = new Dictionary <byte[], BufferInstance>();
            c_usedBuffers   = new Dictionary <BufferInstance, Identity>();
        }
Ejemplo n.º 2
0
        public FileStreamUnbufferedSequentialRead(string path, long startPosition)
        {
            m_path            = path;
            m_id              = IdentityManager.AcquireIdentity(string.Format("{0}:{1}", GetType().Name, m_path));
            m_buffer          = BufferManager.AcquireBuffer(m_id, true);
            m_sectorSize      = PathUtil.GetDriveSectorSize(m_path);
            m_bufferValidSize = m_buffer.Length;

            const FileMode    mode    = FileMode.Open;
            const FileAccess  access  = FileAccess.Read;
            const FileShare   share   = FileShare.Read;
            const FileOptions options = (FileFlagNoBuffering | FileOptions.WriteThrough | FileOptions.SequentialScan);

            m_stream    = new FileStream(m_path, mode, access, share, BUFFER_SIZE, options);
            m_streamEnd = new FileStream(m_path, mode, access, share, BUFFER_SIZE, FileOptions.WriteThrough);

            Seek(startPosition);
        }
Ejemplo n.º 3
0
        public ProgressManagerProcess(ProgressManager progressManager, ProgressManagerProcess parent, string name)
        {
            m_progressManager = progressManager;
            m_id        = IdentityManager.AcquireIdentity(name, IdentityType.Process);
            m_stopwatch = new Stopwatch();

            m_parent   = parent;
            m_children = new List <ProgressManagerProcess>();

            m_progressManager.Update(0.0f);
            m_stopwatch.Start();

            int i = 0;
            ProgressManagerProcess proc = this;

            while ((proc = proc.Parent) != null)
            {
                i++;
            }

            //Context.WriteLine(string.Format("{0}{1} -> Start", string.Empty.PadRight(2 * i), m_id));
            //Context.WriteLine("{0}{1} {2}", string.Empty.PadRight(2 * i), m_id, "{");
            ContextManager.WriteLine("{0}{1}", string.Empty.PadRight(2 * i), m_id);
        }