コード例 #1
0
        /// <summary>
        /// Unregisters a previously registered <see cref="SmartSubtransport"/>
        /// as a custom smart-protocol transport with libgit2.
        /// </summary>
        /// <typeparam name="T">The type of SmartSubtransport to register</typeparam>
        /// <param name="registration">The previous registration</param>
        public static void UnregisterSmartSubtransport <T>(SmartSubtransportRegistration <T> registration)
            where T : SmartSubtransport, new()
        {
            Ensure.ArgumentNotNull(registration, "registration");

            Proxy.git_transport_unregister(registration.Scheme);
            registration.Free();
        }
コード例 #2
0
 private static void RegisterSmartSubtransportInternal <T>(SmartSubtransportRegistration <T> registration)
     where T : SmartSubtransport, new()
 {
     try
     {
         Proxy.git_transport_register(registration.Scheme,
                                      registration.FunctionPointer,
                                      registration.RegistrationPointer);
     }
     catch
     {
         registration.Free();
         throw;
     }
 }
コード例 #3
0
        /// <summary>
        /// Registers a new <see cref="SmartSubtransport"/> as a custom
        /// smart-protocol transport with libgit2.  Any Git remote with
        /// the scheme registered will delegate to the given transport
        /// for all communication with the server.  use this transport to communicate
        /// with the server This is not commonly
        /// used: some callers may want to re-use an existing connection to
        /// perform fetch / push operations to a remote.
        ///
        /// Note that this configuration is global to an entire process
        /// and does not honor application domains.
        /// </summary>
        /// <typeparam name="T">The type of SmartSubtransport to register</typeparam>
        /// <param name="scheme">The scheme (eg "http" or "gopher") to register</param>
        public static SmartSubtransportRegistration <T> RegisterSmartSubtransport <T>(string scheme)
            where T : SmartSubtransport, new()
        {
            Ensure.ArgumentNotNull(scheme, "scheme");

            var registration = new SmartSubtransportRegistration <T>(scheme);

            try
            {
                Proxy.git_transport_register(registration.Scheme,
                                             registration.FunctionPointer,
                                             registration.RegistrationPointer);
            }
            catch (Exception)
            {
                registration.Free();
                throw;
            }

            return(registration);
        }
コード例 #4
0
 private static void UnregisterSmartSubtransportInternal <T>(SmartSubtransportRegistration <T> registration)
     where T : SmartSubtransport, new()
 {
     Proxy.git_transport_unregister(registration.Scheme);
     registration.Free();
 }