コード例 #1
0
 public TransferProxySettingsAction(HTTPHelper.ProxyStyle style, string address, int port, int timeout, bool bypassLocal, bool suppressHistory)
     : base(null, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, Messages.ACTION_TRANSFER_HEALTHCHECK_SETTINGS, suppressHistory)
 {
     proxyStyle = style;
     proxyAddress = address;
     proxyPort = port;
     timeOut = timeout;
     bypassForLocal = bypassLocal;
 }
コード例 #2
0
ファイル: Blob.cs プロジェクト: ywscr/xenadmin
        public Stream Load()
        {
            Session session = Connection.Session;

            if (session == null)
            {
                throw new IOException();
            }
            UriBuilder uri = new UriBuilder();

            uri.Scheme = Connection.UriScheme;
            uri.Host   = Connection.Hostname;
            uri.Port   = Connection.Port;
            uri.Path   = BLOB_URI;
            uri.Query  = String.Format("ref={0}&session_id={1}",
                                       opaque_ref, Uri.EscapeDataString(session.opaque_ref));

            return(HTTPHelper.GET(uri.Uri, Connection, true));
        }
コード例 #3
0
ファイル: Blob.cs プロジェクト: ywscr/xenadmin
        public void Save(Stream inStream, Session session)
        {
            if (session == null)
            {
                throw new IOException();
            }
            UriBuilder uri = new UriBuilder();

            uri.Scheme = Connection.UriScheme;
            uri.Host   = Connection.Hostname;
            uri.Port   = Connection.Port;
            uri.Path   = BLOB_URI;
            uri.Query  = String.Format("ref={0}&session_id={1}",
                                       opaque_ref, Uri.EscapeDataString(session.opaque_ref));

            using (Stream outStream = HTTPHelper.PUT(uri.Uri, inStream.Length, true))
            {
                HTTP.CopyStream(inStream, outStream, null, () => XenAdminConfigManager.Provider.ForcedExiting);
            }
        }
コード例 #4
0
ファイル: HTTPHelper.cs プロジェクト: ywwseu/xenadmin
        /// <summary>
        /// HTTP GET file from HTTP action f, saving it to path (via a temporary file).
        /// </summary>
        /// <param name="action">Action on which to update the progress</param>
        /// <param name="timeout">Whether to apply a timeout</param>
        /// <param name="dataRxDelegate">Delegate called every 500ms with the data transferred</param>
        /// <param name="path">Path to save file to.</param>
        /// <returns>Result of the task used to GET the file</returns>
        public static String Get(AsyncAction action, bool timeout, HTTP.DataCopiedDelegate dataRxDelegate, string path, string hostname, Delegate f, params object[] p)
        {
            Session session = action.Session;
            action.RelatedTask = XenAPI.Task.create(session, "downloadTask", hostname);

            try
            {
                HTTP.UpdateProgressDelegate progressDelegate = delegate(int percent)
                    {
                        action.Tick(percent, action.Description);
                    };

                return HTTPHelper.Get(progressDelegate, action.GetCancelling, timeout, dataRxDelegate, action.Connection,
                    action.RelatedTask, ref session, path, hostname, f, p);
            }
            finally
            {
                action.Session = session;
                Task.destroy(session, action.RelatedTask);
            }
        }