public HRESULT SetSize(ULARGE_INTEGER libNewSize)
 {
     return(((delegate * unmanaged <IStream *, ULARGE_INTEGER, int>)(lpVtbl[6]))((IStream *)Unsafe.AsPointer(ref this), libNewSize));
 }
 public int get_UpdateSequenceNumber(ULARGE_INTEGER[] puliUSN)
 {
     IVsProjectCfg projCfg = _innerCfg as IVsProjectCfg;
     if (projCfg != null)
     {
         return projCfg.get_UpdateSequenceNumber(puliUSN);
     }
     return VSConstants.E_NOTIMPL;
 }
Beispiel #3
0
 public override long Seek(long offset, SeekOrigin origin)
 {
     var l = new LARGE_INTEGER();
     var ul = new ULARGE_INTEGER[1];
     ul[0] = new ULARGE_INTEGER();
     l.QuadPart = offset;
     comStream.Seek(l, (uint)origin, ul);
     return (long)ul[0].QuadPart;
 }
Beispiel #4
0
 void IStream.CopyTo(IStream pstm, ULARGE_INTEGER cb, ULARGE_INTEGER[] pcbRead, ULARGE_INTEGER[] pcbWritten)
 {
     throw new NotImplementedException();
 }
Beispiel #5
0
 void IStream.SetSize(ULARGE_INTEGER libNewSize)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public override void SetLength(long value)
 {
     ULARGE_INTEGER ularge_integer1 = new ULARGE_INTEGER();
     ularge_integer1.QuadPart = (ulong) value;
     this.comStream.SetSize(ularge_integer1);
 }
 /// <summary>
 /// Sets the length of the stream.
 /// </summary>
 /// <param name="value">The new lenght.</param>
 public override void SetLength(long value)
 {
     ULARGE_INTEGER ul = new ULARGE_INTEGER();
     ul.QuadPart = (ulong)value;
     comStream.SetSize(ul);
 }
Beispiel #8
0
        /// <summary>
        /// When overridden in a derived class, sets the length of the current stream.
        /// </summary>
        /// <param name="value">The desired length of the current stream in bytes.</param>
        /// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
        /// <exception cref="T:System.NotSupportedException">The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. </exception>
        /// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
        public override void SetLength(long value)
        {
            if (_disposed)
                throw new ObjectDisposedException("ComStreamWrapper");
            else if (!CanWrite)
                throw new InvalidOperationException();

            ULARGE_INTEGER ul = new ULARGE_INTEGER();
            ul.QuadPart = (ulong)value;
            _comStream.SetSize(ul);
        }
        public void TestOpenCloseControlled()
        {
            const string strProviderName = "Sample Source Control Provider:{B0BAC05D-2000-41D1-A6C3-704E6C1A3DE2}";
            const string strSolutionPersistanceKey = "SampleSourceControlProviderSolutionProperties";
            const string strSolutionUserOptionsKey = "SampleSourceControlProvider";

            int result = 0;

            // Create a solution
            SccProviderService target = GetSccProviderServiceInstance;
            solution.SolutionFile = Path.GetTempFileName();
            MockIVsProject project = new MockIVsProject(Path.GetTempFileName());
            solution.AddProject(project);

            // Check solution props
            VSQUERYSAVESLNPROPS[] saveSolnProps = new VSQUERYSAVESLNPROPS[1];
            result = sccProvider.QuerySaveSolutionProps(null, saveSolnProps);
            Assert.AreEqual(VSConstants.S_OK, result);
            Assert.AreEqual<VSQUERYSAVESLNPROPS>(VSQUERYSAVESLNPROPS.QSP_HasNoProps, saveSolnProps[0]);

            // Add the solution to source control.
            Hashtable uncontrolled = new Hashtable();
            uncontrolled[project as IVsSccProject2] = true;
            target.AddProjectsToSourceControl(ref uncontrolled, true);

            // Solution should be dirty now
            result = sccProvider.QuerySaveSolutionProps(null, saveSolnProps);
            Assert.AreEqual(VSConstants.S_OK, result);
            Assert.AreEqual<VSQUERYSAVESLNPROPS>(VSQUERYSAVESLNPROPS.QSP_HasDirtyProps, saveSolnProps[0]);

            // Set the project offline so we'll have something to save in the "suo" stream
            target.ToggleOfflineStatus(project);

            // Force the provider to write the solution info into a stream
            IStream pOptionsStream = new ComStreamFromDataStream(new MemoryStream()) as IStream;
            sccProvider.WriteUserOptions(pOptionsStream, strSolutionUserOptionsKey);
            // Move the stream position to the beginning
            LARGE_INTEGER liOffset;
            liOffset.QuadPart = 0;
            ULARGE_INTEGER[] ulPosition = new ULARGE_INTEGER[1];
            pOptionsStream.Seek(liOffset, 0, ulPosition);

            // Write solution props
            BaseMock propertyBag = MockPropertyBagProvider.GetWritePropertyBag();
            sccProvider.WriteSolutionProps(null, strSolutionPersistanceKey, propertyBag as IPropertyBag);

            // Close the solution to clean up the scc status
            int pfCancel = 0;
            target.OnQueryCloseProject(project, 0, ref pfCancel);
            target.OnQueryCloseSolution(null, ref pfCancel);
            Assert.AreEqual(pfCancel, 0, "Solution close was canceled");
            target.OnBeforeCloseProject(project, 0);
            // Theoretically the project should have called this, but especially after an add to scc, some projects forget to call it
            // target.UnregisterSccProject(project);
            target.OnBeforeCloseSolution(null);
            target.OnAfterCloseSolution(null);

            // Now attempt the "reopen"
            // The solution reads the solution properties
            propertyBag = MockPropertyBagProvider.GetReadPropertyBag();
            sccProvider.ReadSolutionProps(null, null, null, strSolutionPersistanceKey, 1, propertyBag as IPropertyBag);
            // The solution reads the user options from the stream where they were written before
            sccProvider.ReadUserOptions(pOptionsStream, strSolutionUserOptionsKey);
            // Then the projects are opened and register with the provider
            target.RegisterSccProject(project, "Project's location", "AuxPath", Path.GetDirectoryName(project.ProjectFile), strProviderName);
            // solution event fired for this project
            target.OnAfterOpenProject(project, 0);
            // Then solution completes opening
            target.OnAfterOpenSolution(null, 0);

            Assert.IsTrue(target.IsProjectControlled(null), "The solution's controlled status was not correctly persisted or read from property bag");
            Assert.IsTrue(target.IsProjectControlled(project), "The project's controlled status was not correctly set");
            Assert.IsTrue(target.IsProjectOffline(project), "The project's offline status was incorrectly persisted or read from suo stream");
        }
 public HRESULT UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, [NativeTypeName("DWORD")] uint dwLockType)
 {
     return(((delegate * unmanaged <IStreamInterleave *, ULARGE_INTEGER, ULARGE_INTEGER, uint, int>)(lpVtbl[11]))((IStreamInterleave *)Unsafe.AsPointer(ref this), libOffset, cb, dwLockType));
 }
Beispiel #11
0
        /// <summary>
        /// When overridden in a derived class, sets the position within the current stream.
        /// </summary>
        /// <param name="offset">A byte offset relative to the <paramref name="origin"/> parameter.</param>
        /// <param name="origin">A value of type <see cref="T:System.IO.SeekOrigin"/> indicating the reference point used to obtain the new position.</param>
        /// <returns>
        /// The new position within the current stream.
        /// </returns>
        /// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
        /// <exception cref="T:System.NotSupportedException">The stream does not support seeking, such as if the stream is constructed from a pipe or console output. </exception>
        /// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
        public override long Seek(long offset, SeekOrigin origin)
        {
            if (_disposed)
                throw new ObjectDisposedException("ComStreamWrapper");

            LARGE_INTEGER l = new LARGE_INTEGER();
            ULARGE_INTEGER[] ul = new ULARGE_INTEGER[1];
            ul[0] = new ULARGE_INTEGER();
            l.QuadPart = offset;
            _comStream.Seek(l, (uint)origin, ul);
            return (long)ul[0].QuadPart;
        }
Beispiel #12
0
    public virtual void get_UpdateSequenceNumber(ULARGE_INTEGER[] li){

      CCITracing.TraceCall();

      li[0] = new ULARGE_INTEGER();
      li[0].QuadPart = 0;
    }
 int IVsProjectCfg.get_UpdateSequenceNumber(ULARGE_INTEGER[] puliUSN)
 {
     // The documentation says this is obsolete, so don't do anything.
     if (puliUSN != null)
     {
         puliUSN[0] = new ULARGE_INTEGER();
         puliUSN[0].QuadPart = 0;
     }
     return NativeMethods.E_NOTIMPL;
 }
 public HRESULT CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten)
 {
     return(((delegate * unmanaged <IStream *, IStream *, ULARGE_INTEGER, ULARGE_INTEGER *, ULARGE_INTEGER *, int>)(lpVtbl[7]))((IStream *)Unsafe.AsPointer(ref this), pstm, cb, pcbRead, pcbWritten));
 }
 public virtual void CopyTo(IStream pstm, ULARGE_INTEGER cb, ULARGE_INTEGER[] pcbRead, ULARGE_INTEGER[] pcbWritten)
 {
     long[] pcblRead = new long[1];
     pcbWritten[0].QuadPart = (ulong)CopyTo(pstm, (long)cb.QuadPart, pcblRead);
     pcbRead[0].QuadPart = (ulong)pcblRead[0];
 }
 public override long Seek(long offset, SeekOrigin origin)
 {
     LARGE_INTEGER li = new LARGE_INTEGER();
     ULARGE_INTEGER[] ul = new ULARGE_INTEGER[1];
     ul[0] = new ULARGE_INTEGER();
     li.QuadPart = offset;
     _comStream.Seek(li, (uint)origin, ul);
     return (long)ul[0].QuadPart;
 }
Beispiel #17
0
 public override long Seek(long offset, SeekOrigin origin)
 {
     LARGE_INTEGER large_integer1 = new LARGE_INTEGER();
     ULARGE_INTEGER[] ularge_integerArray1 = new ULARGE_INTEGER[] { new ULARGE_INTEGER() };
     large_integer1.QuadPart = offset;
     this.comStream.Seek(large_integer1, (uint) origin, ularge_integerArray1);
     return (long) ularge_integerArray1[0].QuadPart;
 }
Beispiel #18
0
        private static byte[] GetBufferFromIStream(IStream comStream)
        {
            LARGE_INTEGER zeroPos;
            zeroPos.QuadPart = 0;
            ULARGE_INTEGER[] streamPosition = new ULARGE_INTEGER[1];
            comStream.Seek(zeroPos, (uint)STREAM_SEEK.STREAM_SEEK_CUR, streamPosition);
            comStream.Seek(zeroPos, (uint)STREAM_SEEK.STREAM_SEEK_SET, null);

            Microsoft.VisualStudio.OLE.Interop.STATSTG[] stat = new Microsoft.VisualStudio.OLE.Interop.STATSTG[1];
            comStream.Stat(stat, (uint)STATFLAG.STATFLAG_NONAME);

            int bufferLength = (int)stat[0].cbSize.QuadPart;
            byte[] buffer = new byte[bufferLength];
            uint bytesRead = 0;
            comStream.Read(buffer, (uint)buffer.Length, out bytesRead);

            // return the stream to its previous location
            LARGE_INTEGER newPos;
            newPos.QuadPart = (long)streamPosition[0].QuadPart;
            comStream.Seek(newPos, (uint)STREAM_SEEK.STREAM_SEEK_SET, null);

            return buffer;
        }
Beispiel #19
0
        public virtual int get_UpdateSequenceNumber(ULARGE_INTEGER[] li)
        {
            if (li == null)
            {
                throw new ArgumentNullException("li");
            }

            CCITracing.TraceCall();
            li[0] = new ULARGE_INTEGER();
            li[0].QuadPart = 0;
            return VSConstants.S_OK;
        }
 int IVsProjectCfg.get_UpdateSequenceNumber(ULARGE_INTEGER[] puliUSN)
 {
     throw new NotImplementedException();
 }
Beispiel #21
0
        public virtual int get_UpdateSequenceNumber(ULARGE_INTEGER[] li) {
            Utilities.ArgumentNotNull("li", li);

            li[0] = new ULARGE_INTEGER();
            li[0].QuadPart = 0;
            return VSConstants.S_OK;
        }
        private IStream SaveDocumentWindowPositions(IVsUIShellDocumentWindowMgr windowsMgr)
        {
            if (windowsMgr == null)
            {
                Debug.Assert(false, "IVsUIShellDocumentWindowMgr", String.Empty, 0);
                return null;
            }
            IStream stream;
            NativeMethods.CreateStreamOnHGlobal(IntPtr.Zero, true, out stream);
            if (stream == null)
            {
                Debug.Assert(false, "CreateStreamOnHGlobal", String.Empty, 0);
                return null;
            }
            int hr = windowsMgr.SaveDocumentWindowPositions(0, stream);
            if (hr != VSConstants.S_OK)
            {
                Debug.Assert(false, "SaveDocumentWindowPositions", String.Empty, hr);
                return null;
            }

            // Move to the beginning of the stream
            // In preparation for reading
            LARGE_INTEGER l = new LARGE_INTEGER();
            ULARGE_INTEGER[] ul = new ULARGE_INTEGER[1];
            ul[0] = new ULARGE_INTEGER();
            l.QuadPart = 0;
            //Seek to the beginning of the stream
            stream.Seek(l, 0, ul);
            return stream;
        }
Beispiel #23
0
 void IStream.Seek(LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER[] plibNewPosition)
 {
     var pos = base.Seek(dlibMove.QuadPart, (SeekOrigin)dwOrigin);
     plibNewPosition[0].QuadPart = (ulong)pos;
 }
 public virtual void Seek(LARGE_INTEGER offset, uint origin, ULARGE_INTEGER[] newPosition)
 {
     newPosition[0].QuadPart = (ulong)Seek((long)offset.QuadPart, (int)origin);
 }
Beispiel #25
0
 void IStream.UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType)
 {
     throw new NotImplementedException();
 }
 public virtual void SetSize(ULARGE_INTEGER value)
 {
     dataStream.SetLength((long)value.QuadPart);
 }
Beispiel #27
0
 public override void SetLength(long value)
 {
     var ul = new ULARGE_INTEGER { QuadPart = ((ulong)value) };
     comStream.SetSize(ul);
 }
 public virtual void UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType)
 {
 }
Beispiel #29
0
 public virtual int get_UpdateSequenceNumber(ULARGE_INTEGER[] li)
 {
     CCITracing.TraceCall();
     li[0] = new ULARGE_INTEGER();
     li[0].QuadPart = 0;
     return VSConstants.S_OK;
 }
Beispiel #30
0
        private const int FAILURE = 1;         /* for return value from main() */

        /*---------------------------------------------------------------------------
        *  main (args.Length, args)
        *
        *  The main program. Takes the command line arguments, copies the source file
        *  to the destination file.
        *
        *  Parameters
        *  args.Length
        *        Count of command-line arguments, including the name of the program.
        *  args
        *        Array of pointers to strings that contain individual command-line
        *        arguments.
        *
        *  Returns
        *  Zero if program executed successfully, non-zero otherwise.
        *  ---------------------------------------------------------------------------*/
        private static int Main(string[] args)
        {
            var            fResult = FAILURE;
            ulong          liBytesRemaining;
            ULARGE_INTEGER liSrcFileSize = default, liMapSize, liOffset;