コード例 #1
0
        public SimpleCompilation AddSource(string path)
        {
            FileStreamSource sourceInput = new FileStreamSource(path, writable: false);
            _sources.Add(sourceInput);

            return this;
        }
コード例 #2
0
        public SimpleCompilation AddSource(string path)
        {
            FileStreamSource sourceInput = new FileStreamSource(path, writable: false);

            _sources.Add(sourceInput);

            return(this);
        }
コード例 #3
0
        /// <summary>Initializes the memory-mapped file handle.</summary>
        /// <param name="mapName">The name of the map; may be null.</param>
        /// <param name="fileStream">The underlying file stream; may be null.</param>
        /// <param name="fileStreamSource">The source of the file stream.</param>
        /// <param name="inheritability">The inheritability of the memory-mapped file.</param>
        /// <param name="access">The access for the memory-mapped file.</param>
        /// <param name="options">The options for the memory-mapped file.</param>
        /// <param name="capacity">The capacity of the memory-mapped file.</param>
        internal SafeMemoryMappedFileHandle(
            string mapName,
            FileStream fileStream, FileStreamSource fileStreamSource, HandleInheritability inheritability,
            MemoryMappedFileAccess access, MemoryMappedFileOptions options,
            long capacity)
            : base(new IntPtr(-1), ownsHandle: true)
        {
            // Store the arguments.  We'll actually open the map when the view is created.
            _mapName = mapName;
            _fileStream = fileStream;
            _fileStreamSource = fileStreamSource;
            _inheritability = inheritability;
            _access = access;
            _options = options;
            _capacity = capacity;

            // Fake a unique int handle value > 0.
            int nextHandleValue = (int)((Interlocked.Increment(ref s_counter) % (int.MaxValue - 1)) + 1);
            SetHandle(new IntPtr(nextHandleValue));
        }
コード例 #4
0
        /// <summary>Initializes the memory-mapped file handle.</summary>
        /// <param name="mapName">The name of the map; may be null.</param>
        /// <param name="fileStream">The underlying file stream; may be null.</param>
        /// <param name="fileStreamSource">The source of the file stream.</param>
        /// <param name="inheritability">The inheritability of the memory-mapped file.</param>
        /// <param name="access">The access for the memory-mapped file.</param>
        /// <param name="options">The options for the memory-mapped file.</param>
        /// <param name="capacity">The capacity of the memory-mapped file.</param>
        internal SafeMemoryMappedFileHandle(
            string mapName,
            FileStream fileStream, FileStreamSource fileStreamSource, HandleInheritability inheritability,
            MemoryMappedFileAccess access, MemoryMappedFileOptions options,
            long capacity)
            : base(new IntPtr(-1), ownsHandle: true)
        {
            // Store the arguments.  We'll actually open the map when the view is created.
            _mapName          = mapName;
            _fileStream       = fileStream;
            _fileStreamSource = fileStreamSource;
            _inheritability   = inheritability;
            _access           = access;
            _options          = options;
            _capacity         = capacity;

            // Fake a unique int handle value > 0.
            int nextHandleValue = (int)((Interlocked.Increment(ref s_counter) % (int.MaxValue - 1)) + 1);

            SetHandle(new IntPtr(nextHandleValue));
        }