internal string ToQueryString()
        {
            var queryParams = new List <string>();

            if (KeepNull != null)
            {
                queryParams.Add("keepNull=" + KeepNull.ToString().ToLower());
            }
            if (MergeObjects != null)
            {
                queryParams.Add("mergeObjects=" + MergeObjects.ToString().ToLower());
            }
            if (WaitForSync != null)
            {
                queryParams.Add("waitForSync=" + WaitForSync.ToString().ToLower());
            }
            if (IgnoreRevs != null)
            {
                queryParams.Add("ignoreRevs=" + IgnoreRevs.ToString().ToLower());
            }
            if (ReturnOld != null)
            {
                queryParams.Add("returnOld=" + ReturnOld.ToString().ToLower());
            }
            if (ReturnNew != null)
            {
                queryParams.Add("returnNew=" + ReturnNew.ToString().ToLower());
            }
            return(string.Join("&", queryParams));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the set of options in a format suited to a URL query string.
        /// </summary>
        /// <returns></returns>
        internal string ToQueryString()
        {
            List <string> query = new List <string>();

            if (WaitForSync != null)
            {
                query.Add("waitForSync=" + WaitForSync.ToString().ToLower());
            }
            if (ReturnNew != null)
            {
                query.Add("returnNew=" + ReturnNew.ToString().ToLower());
            }
            if (ReturnOld != null)
            {
                query.Add("returnOld=" + ReturnOld.ToString().ToLower());
            }
            if (Silent != null)
            {
                query.Add("silent=" + Silent.ToString().ToLower());
            }
            if (Overwrite != null)
            {
                query.Add("overwrite=" + Overwrite.ToString().ToLower());
            }
            return(string.Join("&", query));
        }
        /// <summary>
        /// Get the set of options in a format suited to a URL query string.
        /// </summary>
        /// <returns></returns>
        internal string ToQueryString()
        {
            var query = new List <string>();

            if (WaitForSync != null)
            {
                query.Add("waitForSync=" + WaitForSync.ToString().ToLower());
            }
            if (ReturnNew != null)
            {
                query.Add("returnNew=" + ReturnNew.ToString().ToLower());
            }
            if (ReturnOld != null)
            {
                query.Add("returnOld=" + ReturnOld.ToString().ToLower());
            }
            if (IgnoreRevs != null)
            {
                query.Add("ignoreRevs=" + IgnoreRevs.ToString().ToLower());
            }
            if (Silent != null)
            {
                query.Add("silent=" + Silent.ToString().ToLower());
            }
            return(string.Join("&", query));
        }
Exemplo n.º 4
0
 public override void Dispose(bool force)
 {
     base.Dispose(force);
     Unsetup();
     LoopCTS?.Dispose();
     LoopCTS = null;
     IsSynchronizable?.Dispose();
     IsSynchronizable = null;
     WaitForSync?.Dispose();
     WaitForSync = null;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Cancels Sync State request and releases from the sync state, if in that state.
 /// </summary>
 public void CancelSyncState()
 {
     //if this program is in its sync state, release it
     lock (SyncStateRequestLock)
     {
         if (IsSyncStateRequested)
         {
             WaitForSync.Fire(null, null);
         }
         IsSyncStateRequested = false;
     }
 }
Exemplo n.º 6
0
 public Dictionary <string, string> GetUrlParameters()
 {
     return(new Dictionary <string, string>
     {
         { "database", Database },
         { "type", Type.ToString().ToLower() },
         { "waitForSync", WaitForSync.ToString() },
         { "complete", Complete.ToString() },
         { "details", Details.ToString() },
         { "collection", Collection },
         { "createCollection", CreateCollection.ToString() },
     });
 }
        internal string ToQueryString()
        {
            List <string> query = new List <string>();

            if (WaitForSync != null)
            {
                query.Add("waitForSync=" + WaitForSync.ToString().ToLower());
            }
            if (DropCollections != null)
            {
                query.Add("dropCollections=" + DropCollections.ToString().ToLower());
            }
            return(string.Join("&", query));
        }
Exemplo n.º 8
0
        internal string ToQueryString()
        {
            List <string> query = new List <string>();

            if (ReturnOld != null)
            {
                query.Add("returnOld=" + ReturnOld.ToString().ToLower());
            }
            if (WaitForSync != null)
            {
                query.Add("waitForSync=" + WaitForSync.ToString().ToLower());
            }
            return(string.Join("&", query));
        }
Exemplo n.º 9
0
        internal string ToQueryString()
        {
            var queryParams = new List <string>();

            if (WaitForSync != null)
            {
                queryParams.Add("waitForSync=" + WaitForSync.ToString().ToLower());
            }
            if (ReturnOld != null)
            {
                queryParams.Add("returnOld=" + ReturnOld.ToString().ToLower());
            }
            if (Silent != null)
            {
                queryParams.Add("silent=" + Silent.ToString().ToLower());
            }
            return(string.Join("&", queryParams));
        }
Exemplo n.º 10
0
        private void SetupRunProgramTask()
        {
            LoopCTS.Dispose();
            LoopCTS = new CancellationTokenSource();
            try
            {
                LoopingTask?.Dispose();
            }
            catch (Exception ex)
            { }
            LoopingTask = new Task(() =>
            {
                try
                {
                    RunProgramThread = Thread.CurrentThread;
                    while (true)
                    {
                        //if sync is requested, go into synchronizable state
                        if (SyncContext != null)
                        {
                            lock (SyncStateRequestLock)
                            {
                                if (IsSyncStateRequested)
                                {
                                    DebugTools.AddEvent("LoopingZoneProgram.LoopingTask", "Entering Sync-State: " + Name);
                                    IsSynchronizable.Fire(this, null);
                                    DebugTools.AddEvent("LoopingZoneProgram.LoopingTask",
                                                        "In Sync-State - Waiting for Signal from SyncContext: " + Name);
                                    WaitForSync.WaitForFire();
                                    DebugTools.AddEvent("LoopingZoneProgram.LoopingTask", "Leaving Sync-State: " + Name);
                                    IsSyncStateRequested = false;
                                    DebugTools.AddEvent("LoopingZoneProgram.LoopingTask", "IsSyncStateRequested = false: " + Name);
                                }
                            }
                        }

                        //this is currently not doing anything
                        LeftSyncTrigger.Fire(this, null);

                        DebugTools.AddEvent("LoopingZoneProgram.LoopingTask", "Starting Loop: " + Name);
                        //start loop
                        Loop();
                        DebugTools.AddEvent("LoopingZoneProgram.LoopingTask", "Finished Loop: " + Name);

                        //if cancellation is requested, break out of loop after setting notification parameters for the consumer
                        if (LoopCTS.IsCancellationRequested)
                        {
                            Running = false;
                            StopTrigger.Fire(this, null);
                            break;
                        }

                        //this makes the CPU consumption way lesser
                        Thread.Sleep(LoopWaitTime);
                    }
                }
                catch (ThreadAbortException ex)
                {
                    //DebugTools.AddEvent("LoopingZoneProgram.LoopingTask.Method", "LoopingTask thread aborted");
                    //DebugTools.AddEvent("LoopingZoneProgram.Stop", "START Setting Running = false");
                    Running = false;
                    StopTrigger.Fire(this, null);
                    //DebugTools.AddEvent("LoopingZoneProgram.Stop", "END Setting Running = false");
                }
                catch (Exception ex)
                {
                    Running = false;
                    StopTrigger.Fire(this, null);
                    DebugTools.AddEvent("LoopingZoneProgram.LoopingTask.Method",
                                        "Unexpected exception in LoopingTask: " + ex.Message + " | StackTrace: " + ex.StackTrace);
                }
            }, LoopCTS.Token);
        }