コード例 #1
0
ファイル: webRequestBlock.cs プロジェクト: gorangrubic/imbACE
        /// <summary>
        /// Pokreze izvrsavanje bloka
        /// </summary>
        /// <param name="settings">Podesavanja webLoader-a</param>
        /// <param name="__syncMode">mod sinhronizacije</param>
        /// <returns>Referencu prema webResultBlock-u</returns>
        public webResultBlock executeBlock(webLoaderSettings settings, executionSyncMode __syncMode,
                                           webRequestBlockEvent __onFinished = null,
                                           webRequestBlockEvent __onAborted  = null,
                                           webRequestBlockEvent __onProgress = null)
        {
            __settings = settings;

            deploySettings(settings, __onFinished, __onAborted, __onProgress);

            if (__syncMode != executionSyncMode.unknown)
            {
                executeSyncMode = __syncMode;
            }
            output.Clear();


            if (executeSyncMode == executionSyncMode.synced)
            {
                startExecution(settings);
            }
            else
            {
                executeThread = new Thread(startExecution);
                executeThread.Start(settings);
            }

            return(output);
        }
コード例 #2
0
ファイル: webRequest.cs プロジェクト: gorangrubic/imbACE
        protected webResult _executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                            webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                            webRequestEvent __onRetry)
        {
            deploySettings(settings, __onExecutedOk, __onError, __onRetry);



            if (settings.doUseCache && webCacheSystem.hasCache(url))
            {
                status = webRequestEventType.executing;
                Thread lc = new Thread(loadCache);
                lc.Start();
                syncWaitingLoop(settings, __syncMode);
                if (status == webRequestEventType.executedOk)
                {
                    return(result);
                }
                else
                {
                }
                lc.Abort();
            }


            status = webRequestEventType.executing;
            executeBegin(settings);
            syncWaitingLoop(settings, __syncMode);

            if (doLogNewLoad)
            {
                aceLog.log("Load: " + url + " (" + status.toString() + ")");
            }
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// Izvrsavanje
        /// </summary>
        /// <param name="settings">Podesavanja loadera</param>
        /// <param name="__syncMode">Tip izvrsavanja</param>
        /// <param name="__onExecutedOk">kada je executedOk</param>
        /// <param name="__onError">za sve vrste gresaka</param>
        /// <param name="__onRetry">kada se desi retry</param>
        public override webResult executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                                 webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                                 webRequestEvent __onRetry)
        {
            url          = imbUrlOps.getStandardizedUrl(url, urlShema.http);
            settings.url = url;

            return(_executeRequest(settings, __syncMode, __onExecutedOk, __onError, __onRetry));
        }
コード例 #4
0
        public List <webResultBlock> executeAllBlocks(executionSyncMode __syncMode)
        {
            List <webResultBlock> output = new List <webResultBlock>();

            foreach (webRequestBlock wRB in requestBlocks)
            {
                output.Add(wRB.executeBlock(settings, __syncMode, callRequestBlockFinished, callRequestBlockAborted,
                                            callExecutionProgress));
            }
            return(output);
        }
コード例 #5
0
        /// <summary>
        /// Omogućava ad-hoc izvršavanje webRequest-a
        /// </summary>
        /// <param name="__url"></param>
        /// <param name="__syncMode"></param>
        /// <param name="__action"></param>
        /// <param name="__type"></param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraća dobijeni rezultat</returns>
        public webResult executeRequest(String __url, executionSyncMode __syncMode,
                                        webRequestActionType __action = webRequestActionType.openUrl,
                                        webRequestType __type         = webRequestType.unknown, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }
            webRequestBlock blck    = getCurrentBlock();
            webRequest      request = addNewRequest(__url, __action, __type);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
コード例 #6
0
        /// <summary>
        /// Izvrsava jedan request
        /// </summary>
        /// <param name="request">Zahtev koji treba da se izvrsi</param>
        /// <param name="__syncMode">Rezim izvrsavanja</param>
        /// <param name="purge">Da li da obrise sve ranije izvrsene Blokove i Zahteve ?</param>
        /// <returns>Vraca objekat sa rezultatom</returns>
        public webResult executeRequest(webRequest request, executionSyncMode __syncMode, Boolean purge = true)
        {
            if (purge)
            {
                purgeExecutedBlocksAndRequests(true);
            }

            webRequestBlock blck = getCurrentBlock();

            blck.Add(request);

            webResultBlock wRB = executeCurrentBlock(__syncMode);

            return(request.result);
        }
コード例 #7
0
        /// <summary>
        /// Trenutni rezultat requesta
        /// </summary>
        protected void syncWaitingLoop(webLoaderSettings settings, executionSyncMode __syncMode)
        {
            DateTime start = DateTime.Now;

            if (__syncMode == executionSyncMode.synced)
            {
                while (isActive)
                {
                    Thread.Sleep(settings.tickDuration);

                    TimeSpan ts = DateTime.Now.Subtract(start);
                    if (ts.TotalMilliseconds > settings.timeout)
                    {
                        aceLog.saveAllLogs(true);
                        abortRequest(settings);
                    }

                    checkRequest(settings);
                }
            }
        }
コード例 #8
0
 /// <summary>
 /// Izvrsavanje
 /// </summary>
 /// <param name="settings">Podesavanja loadera</param>
 /// <param name="__syncMode">Tip izvrsavanja</param>
 /// <param name="__onExecutedOk">kada je executedOk</param>
 /// <param name="__onError">za sve vrste gresaka</param>
 /// <param name="__onRetry">kada se desi retry</param>
 public override webResult executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                          webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                          webRequestEvent __onRetry)
 {
     return(_executeRequest(settings, __syncMode, __onExecutedOk, __onError, __onRetry));
 }
コード例 #9
0
 public webResultBlock executeCurrentBlock(executionSyncMode __syncMode)
 {
     return(requestBlock.executeBlock(settings, __syncMode, callRequestBlockFinished, callRequestBlockAborted,
                                      callExecutionProgress));
 }
コード例 #10
0
ファイル: webRequestBase.cs プロジェクト: gorangrubic/imbACE
 public abstract webResult executeRequest(webLoaderSettings settings, executionSyncMode __syncMode,
                                          webRequestEvent __onExecutedOk, webRequestEvent __onError,
                                          webRequestEvent __onRetry);