コード例 #1
0
            private static int Action(
                out IntPtr stream,
                IntPtr subtransport,
                IntPtr url,
                GitSmartSubtransportAction action)
            {
                stream = IntPtr.Zero;

                SmartSubtransport t           = GCHandle.FromIntPtr(Marshal.ReadIntPtr(subtransport, GitSmartSubtransport.GCHandleOffset)).Target as SmartSubtransport;
                String            urlAsString = LaxUtf8Marshaler.FromNative(url);

                if (null != t &&
                    !String.IsNullOrEmpty(urlAsString))
                {
                    try
                    {
                        stream = t.Action(urlAsString, action).GitSmartTransportStreamPointer;

                        return(0);
                    }
                    catch (Exception ex)
                    {
                        Proxy.git_error_set_str(GitErrorCategory.Net, ex);
                    }
                }

                return((int)GitErrorCode.Error);
            }
コード例 #2
0
            private static void Free(IntPtr subtransport)
            {
                SmartSubtransport t = GCHandle.FromIntPtr(Marshal.ReadIntPtr(subtransport, GitSmartSubtransport.GCHandleOffset)).Target as SmartSubtransport;

                if (null != t)
                {
                    try
                    {
                        t.Dispose();
                    }
                    catch (Exception ex)
                    {
                        Proxy.git_error_set_str(GitErrorCategory.Net, ex);
                    }
                }
            }
コード例 #3
0
            private static int Close(IntPtr subtransport)
            {
                SmartSubtransport t = GCHandle.FromIntPtr(Marshal.ReadIntPtr(subtransport, GitSmartSubtransport.GCHandleOffset)).Target as SmartSubtransport;

                if (null != t)
                {
                    try
                    {
                        t.Close();

                        return(0);
                    }
                    catch (Exception ex)
                    {
                        Proxy.git_error_set_str(GitErrorCategory.Net, ex);
                    }
                }

                return((int)GitErrorCode.Error);
            }
コード例 #4
0
            private static int Action(
                out IntPtr stream,
                IntPtr subtransport,
                IntPtr url,
                GitSmartSubtransportAction action)
            {
                stream = IntPtr.Zero;

                SmartSubtransport t = GCHandle.FromIntPtr(Marshal.ReadIntPtr(subtransport, GitSmartSubtransport.GCHandleOffset)).Target as SmartSubtransport;
                String urlAsString = LaxUtf8Marshaler.FromNative(url);

                if (t == null)
                {
                    Proxy.git_error_set_str(GitErrorCategory.Net, "no subtransport provided");
                    return (int)GitErrorCode.Error;
                }

                if (String.IsNullOrEmpty(urlAsString))
                {
                    urlAsString = t.LastActionUrl;
                }

                if (String.IsNullOrEmpty(urlAsString))
                {
                    Proxy.git_error_set_str(GitErrorCategory.Net, "no url provided");
                    return (int)GitErrorCode.Error;
                }

                try
                {
                    stream = t.Action(urlAsString, action).GitSmartTransportStreamPointer;
                    t.LastActionUrl = urlAsString;
                    return 0;
                }
                catch (Exception ex)
                {
                    Proxy.git_error_set_str(GitErrorCategory.Net, ex);
                    return (int)GitErrorCode.Error;
                }
            }
コード例 #5
0
 /// <summary>
 /// Base constructor for SmartTransportStream. Make sure that your derived class calls this base constructor.
 /// </summary>
 /// <param name="subtransport">The subtransport that this stream represents a connection over.</param>
 protected SmartSubtransportStream(SmartSubtransport subtransport)
 {
     this.subtransport = subtransport;
 }
コード例 #6
0
 /// <summary>
 /// Base constructor for SmartTransportStream. Make sure that your derived class calls this base constructor.
 /// </summary>
 /// <param name="subtransport">The subtransport that this stream represents a connection over.</param>
 protected SmartSubtransportStream(SmartSubtransport subtransport)
 {
     this.subtransport = subtransport;
 }
コード例 #7
0
			public TfsSmartSubtransportStream(SmartSubtransport smartSubtransport) : base(smartSubtransport)
			{
				responseStream = new Lazy<Stream> (CreateResponseStream);
			}