/// <summary>
        /// Retrieves and removes the head of this queue, waiting up to the
        /// specified wait time if necessary for an element to become available.
        /// </summary>
        /// <param name="element">
        /// Set to the head of this queue. <c>default(T)</c> if queue is empty.
        /// </param>
        /// <param name="duration">How long to wait before giving up.</param>
        /// <returns>
        /// <c>false</c> if the queue is still empty after waited for the time
        /// specified by the <paramref name="duration"/>. Otherwise <c>true</c>.
        /// </returns>
        public override bool Poll(TimeSpan duration, out T element)
        {
            DateTime deadline = WaitTime.Deadline(duration);

            using (_lock.LockInterruptibly())
            {
                while (!_wrapped.Poll(out element))
                {
                    if (duration.Ticks <= 0)
                    {
                        element = default(T);
                        return(false);
                    }
                    try
                    {
                        _notEmptyCondition.Await(WaitTime.Cap(duration));
                        duration = deadline.Subtract(DateTime.UtcNow);
                    }
                    catch (ThreadInterruptedException e)
                    {
                        _notEmptyCondition.Signal();
                        throw SystemExtensions.PreserveStackTrace(e);
                    }
                }
                _notFullCondition.Signal();
                return(true);
            }
        }
Exemple #2
0
        public async Task <IHttpActionResult> PostWaitTime(WaitTime item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _db.WaitTimes.Add(item);

            try
            {
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (WaitTimeExists(item.RestaurantId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = item.RestaurantId }, item));
        }
        public override bool Initialise()
        {
            base.Initialise();

            Input.RegisterKey(Settings.UnstackHotkey.Value);

            Settings.Enable.OnValueChanged += (sender, value) => { _SaveSettings(); };
            Settings.PreserveOriginalCursorPosition.OnValueChanged += (sender, value) => { _SaveSettings(); };
            Settings.ReverseMouseButtons.OnValueChanged            += (sender, value) => { _SaveSettings(); };

            Settings.UnstackHotkey.OnValueChanged += () =>
            {
                Input.RegisterKey(Settings.UnstackHotkey);
                _SaveSettings();
            };

            _WaitBetweenClicks = new WaitTime(Clamp(Settings.TimeBetweenClicks.Value, 50, 200));
            Settings.TimeBetweenClicks.OnValueChanged += (sender, i) =>
            {
                _WaitBetweenClicks = new WaitTime(Clamp(Settings.TimeBetweenClicks, 50, 200));
                _SaveSettings();
            };

            return(true);
        }
Exemple #4
0
            private bool Attempt(TimeSpan duration)
            {
                if (_state != 0)
                {
                    return(true);
                }
                if (duration.Ticks <= 0)
                {
                    _state = Cancel;
                    Monitor.Pulse(this);
                    return(false);
                }
                DateTime deadline = WaitTime.Deadline(duration);

                while (true)
                {
                    Monitor.Wait(this, WaitTime.Cap(duration));
                    if (_state != 0)
                    {
                        return(true);
                    }
                    duration = deadline.Subtract(DateTime.UtcNow);
                    if (duration.Ticks <= 0)
                    {
                        _state = Cancel;
                        Monitor.Pulse(this);
                        return(false);
                    }
                }
            }
 /// <param name='operations'>
 /// Reference to the UserClient.IWaitTimes.
 /// </param>
 /// <param name='item'>
 /// Required.
 /// </param>
 public static WaitTime PostWaitTimeByItem(this IWaitTimes operations, WaitTime item)
 {
     return(Task.Factory.StartNew((object s) =>
     {
         return ((IWaitTimes)s).PostWaitTimeByItemAsync(item);
     }
                                  , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }
Exemple #6
0
        public override string ToString()
        {
            string baseString = WaitTime.ToString(CultureInfo.InvariantCulture) + ", " +
                                SpawnInterval.ToString(CultureInfo.InvariantCulture) + ", " +
                                MaxTime.ToString(CultureInfo.InvariantCulture) + ", " + MaxSpawnItems + ", " +
                                SpawnTypeList.ToText();

            return(string.IsNullOrEmpty(ShortName) ? baseString : ShortName + " " + baseString);
        }
 public void Do <TResult>(Action <Func <IWebElement> > seleniumAction,
                          Func <Func <IWebElement>, TResult> expectedConditionAfterAction,
                          int maxRetries    = 10,
                          WaitTime waitTime = WaitTime.Short,
                          [CallerMemberName] string caller = "",
                          string logMessage = null)
 {
     Do(seleniumAction, expectedConditionAfterAction, (Func <IWebDriver, bool>)null, maxRetries, waitTime, caller, logMessage);
 }
Exemple #8
0
        public async Task <WaitTime> GetWaitTimeAsync()
        {
            WaitTime result = new WaitTime
            {
                status   = getStatus(),
                waitTime = getWaitTime()
            };

            return(await Task.FromResult(result));
        }
Exemple #9
0
        public Coroutine(Action action, IYieldBase condition, IPlugin owner, string name = null, bool infinity = true,
                         bool autoStart = true) : this(name, owner)
        {
            Running          = autoStart;
            Started          = DateTime.Now;
            Owner            = owner;
            TimeoutForAction = condition switch
            {
                WaitTime time => time.Milliseconds.ToString(),
                WaitRender render => render.HowManyRenderCountWait.ToString(),
                WaitRandom random => random.Timeout,
                WaitFunction _ => "Function -1",
                         _ => TimeoutForAction
            };

            Action    = action;
            Condition = condition;

            if (infinity)
            {
                IEnumerator CoroutineAction(Action a)
                {
                    yield return(YieldBase.RealWork);

                    while (true)
                    {
                        try
                        {
                            a?.Invoke();
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine($"Coroutine {Name} in {OwnerName} error -> {e}");
                        }

                        Ticks++;
                        yield return(Condition.GetEnumerator());
                    }
                }

                _enumerator = CoroutineAction(action);
            }
            else
            {
                IEnumerator CoroutineAction(Action a)
                {
                    yield return(Condition.GetEnumerator());

                    a?.Invoke();
                    Ticks++;
                }

                _enumerator = CoroutineAction(action);
            }
        }
            public void It_should_return_continue_if_time_has_not_passed()
            {
                var timeMonitor = Substitute.For <ITimeMonitor>();

                timeMonitor.DeltaTime.Returns(0);
                var waitTime = new WaitTime(timeMonitor)
                {
                    time = 1
                };

                Assert.AreEqual(TaskStatus.Continue, waitTime.Update());
            }
            public void It_should_return_success_if_time_has_passed()
            {
                var timeMonitor = Substitute.For <ITimeMonitor>();

                timeMonitor.DeltaTime.Returns(2);
                var waitTime = new WaitTime(timeMonitor)
                {
                    time = 1
                };

                Assert.AreEqual(TaskStatus.Success, waitTime.Update());
            }
Exemple #12
0
        public override bool Initialise()
        {
            base.Initialise();
            Name = "Willplug";

            pickit                 = new Pickit(this.Settings, this);
            mover                  = new Mover(GameController);
            WillBot.Me             = new WillPlayer(this, GameController, pickit, LoadedMonsters);
            WillBot.Mover          = mover;
            WillBot.gameController = GameController;
            WillBot.basePlugin     = this;
            WillBot.KeyboardHelper = new TreeRoutine.DefaultBehaviors.Helpers.KeyboardHelper(GameController);

            Input.RegisterKey(Keys.RButton);
            Input.RegisterKey(Keys.A);
            //Input.RegisterKey(Settings.VaalAttackKey);
            Input.RegisterKey(Settings.TestKey1);
            Input.RegisterKey(Settings.TestKey2);
            Input.RegisterKey(Settings.PauseAbilityUsage);
            Input.RegisterKey(Settings.TryLootNearbykey);
            // Input.RegisterKey(Settings.SmokeMineMacroActivationKey);
            //BuffTree = BuffBehavior.CreateBerserkerBuffTree();
            //BuffTree = NecroBuffs.CreateNecroBuffTree();
            BuffTree = CharacterAbilityTrees.CreateScourgeArrowPfTree();
            Tree     = CreateTree();
            Settings.Enable.OnValueChanged += (sender, b) =>
            {
                if (b)
                {
                    if (Core.ParallelRunner.FindByName(treeroutineName) == null)
                    {
                        InitCoroutine();
                    }
                    TreeCoroutine?.Resume();
                }
                else
                {
                    TreeCoroutine?.Pause();
                }
            };
            InitCoroutine();
            InitBuffRoutine();
            InitAutoLootRoutine();
            #region PickitRelated
            DebugTimer.Reset();
            Settings.MouseSpeed.OnValueChanged += (sender, f) => { Mouse.speedMouse = Settings.MouseSpeed.Value; };
            pickitCoroutineWaitTime             = new WaitTime(Settings.ExtraDelay);
            Settings.ExtraDelay.OnValueChanged += (sender, i) => pickitCoroutineWaitTime = new WaitTime(i);
            pickit.LoadRuleFiles();
            #endregion

            return(true);
        }
Exemple #13
0
        public override IEnumerable <Wait> RoutineDie(Vector2 dir)
        {
            var pos = new Vector2(Tile.X * 16, Tile.Y * 16);

            VisualPosition = Slide(pos, pos + new Vector2(dir.X * 8, dir.Y * 8), LerpHelper.Linear, 20);
            VisualPose     = Static(CreaturePose.Stand);
            VisualColor    = SoftFlash(ColorMatrix.Identity, ColorMatrix.Flat(Color.White), LerpHelper.QuadraticOut, 10);
            DeadWait       = new WaitTime(200);
            yield return(Scheduler.Instance.RunAndWait(RoutineOpenWing(0.8f, 50, LerpHelper.Quadratic)));

            new BossExplosion(World, this, (position, velocity, angle, time) => new FireExplosion(World, position, velocity, angle, time));
        }
        public StepfunctionsJobPollerStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            var submitJobActivity = new Activity(this, "SubmitJob");
            var checkJobActivity  = new Activity(this, "CheckJob");

            var submitJob = new StepFunctionsInvokeActivity(this, "Submit Job", new StepFunctionsInvokeActivityProps
            {
                Activity   = submitJobActivity,
                ResultPath = "$.guid"
            });

            var waitX = new Wait(this, "Wait X Seconds", new WaitProps
            {
                Time = WaitTime.SecondsPath("$.wait_time")
            });

            var getStatus = new StepFunctionsInvokeActivity(this, "Get Job Status", new StepFunctionsInvokeActivityProps
            {
                Activity   = checkJobActivity,
                InputPath  = "$.guid",
                ResultPath = "$.status"
            });

            var isComplete = new Choice(this, "Job Complete?");

            var jobFailed = new Fail(this, "Job Failed", new FailProps
            {
                Cause = "AWS Batch Job Failed",
                Error = "DescribeJob returned FAILED"
            });

            var finalStatus = new StepFunctionsInvokeActivity(this, "Get Final Job Status", new StepFunctionsInvokeActivityProps
            {
                Activity  = checkJobActivity,
                InputPath = "$.guid"
            });

            var chain = Chain
                        .Start(submitJob)
                        .Next(waitX)
                        .Next(getStatus)
                        .Next(isComplete
                              .When(Condition.StringEquals("$.status", "FAILED"), jobFailed)
                              .When(Condition.StringEquals("$.status", "SUCCEEDED"), finalStatus)
                              .Otherwise(waitX));

            new StateMachine(this, "StateMachine", new StateMachineProps
            {
                Definition = chain,
                Timeout    = Duration.Seconds(30)
            });
        }
Exemple #15
0
 public override bool Initialise()
 {
     pickItCoroutine = new Coroutine(MainWorkCoroutine(), this, "Pick It");
     Core.ParallelRunner.Run(pickItCoroutine);
     pickItCoroutine.Pause();
     DebugTimer.Reset();
     Settings.MouseSpeed.OnValueChanged += (sender, f) => { Mouse.speedMouse = Settings.MouseSpeed.Value; };
     _workCoroutine = new WaitTime(Settings.ExtraDelay);
     Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);
     LoadRuleFiles();
     //LoadCustomItems();
     return(true);
 }
Exemple #16
0
 /// <summary>
 /// Retrieves and removes the head of this queue, waiting if necessary
 /// until an element with an expired delay is available on this queue,
 /// or the specified wait time expires.
 /// </summary>
 /// <param name="duration">How long to wait before giving up.</param>
 /// <param name="element">
 /// Set to the head of this queue, or <c>default(T)</c> if the specified
 /// waiting time elapses before an element with an expired delay becomes
 /// available
 /// </param>
 /// <returns>
 /// <c>false</c> if the specified waiting time elapses before an element
 /// is available. Otherwise <c>true</c>.
 /// </returns>
 public override bool Poll(TimeSpan duration, out T element)
 {
     lock (_lock)
     {
         DateTime deadline = WaitTime.Deadline(duration);
         for (; ;)
         {
             T first;
             if (!_queue.Peek(out first))
             {
                 if (duration.Ticks <= 0)
                 {
                     element = default(T);
                     return(false);
                 }
                 Monitor.Wait(_lock, WaitTime.Cap(duration));
                 duration = deadline.Subtract(DateTime.UtcNow);
             }
             else
             {
                 TimeSpan delay = first.GetRemainingDelay();
                 if (delay.Ticks > 0)
                 {
                     if (duration.Ticks <= 0)
                     {
                         element = default(T);
                         return(false);
                     }
                     if (delay > duration)
                     {
                         delay = duration;
                     }
                     Monitor.Wait(_lock, WaitTime.Cap(delay));
                     duration = deadline.Subtract(DateTime.UtcNow);
                 }
                 else
                 {
                     T    x;
                     bool hasOne = _queue.Poll(out x);
                     Debug.Assert(hasOne);
                     if (_queue.Count != 0)
                     {
                         Monitor.PulseAll(_lock);
                     }
                     element = x;
                     return(true);
                 }
             }
         }
     }
 }
Exemple #17
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (WaitTime != 0)
            {
                hash ^= WaitTime.GetHashCode();
            }
            if (Status != 0)
            {
                hash ^= Status.GetHashCode();
            }
            return(hash);
        }
        public static TimeSpan ToTimeSpan(this WaitTime waitTime)
        {
            // TODO: make wait time configurable
            if (waitTime == WaitTime.Short)
            {
                return(TimeSpan.FromSeconds(0.5));
            }
            else if (waitTime == WaitTime.Long)
            {
                return(TimeSpan.FromSeconds(5));
            }

            throw new NotSupportedException(waitTime.ToString());
        }
Exemple #19
0
 public override bool Initialise()
 {
     buildDate       = new DateTime(2000, 1, 1).AddDays(Version.Build).AddSeconds(Version.Revision * 2);
     PluginVersion   = $"{Version}";
     pickItCoroutine = new Coroutine(MainWorkCoroutine(), this, "Pick It");
     Core.ParallelRunner.Run(pickItCoroutine);
     pickItCoroutine.Pause();
     DebugTimer.Reset();
     Settings.MouseSpeed.OnValueChanged += (sender, f) => { Mouse.speedMouse = Settings.MouseSpeed.Value; };
     _workCoroutine = new WaitTime(Settings.ExtraDelay);
     Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);
     LoadRuleFiles();
     return(true);
 }
Exemple #20
0
 public override bool Initialise()
 {
     Controller      = this;
     pickItCoroutine = new Coroutine(MainWorkCoroutine(), this, "Pick It");
     Core.ParallelRunner.Run(pickItCoroutine);
     pickItCoroutine.Pause();
     DebugTimer.Reset();
     Settings.MouseSpeed.OnValueChanged += (sender, f) => { Mouse.speedMouse = Settings.MouseSpeed.Value; };
     _workCoroutine = new WaitTime(Settings.ExtraDelay);
     Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);
     UpdateCacheList = new TimeCache <List <CustomItem> >(UpdateLabelComponent, 200);
     LoadRuleFiles();
     //LoadCustomItems();
     return(true);
 }
            public void It_should_reset_time()
            {
                var timeMonitor = Substitute.For <ITimeMonitor>();
                var waitTime    = new WaitTime(timeMonitor)
                {
                    time = 1
                };

                timeMonitor.DeltaTime.Returns(2);
                waitTime.Update();
                waitTime.Reset();
                timeMonitor.DeltaTime.Returns(0);

                Assert.AreEqual(TaskStatus.Continue, waitTime.Update());
            }
        /// <summary>
        /// Inserts the specified element into this queue, waiting up to the
        /// specified wait time if necessary for space to become available.
        /// </summary>
        /// <param name="element">the element to add</param>
        /// <param name="duration">how long to wait before giving up</param>
        /// <returns> <c>true</c> if successful, or <c>false</c> if
        /// the specified waiting time elapses before space is available
        /// </returns>
        /// <exception cref="System.InvalidOperationException">
        /// If the element cannot be added at this time due to capacity restrictions.
        /// </exception>
        /// <exception cref="ThreadInterruptedException">
        /// if interrupted while waiting.
        /// </exception>
        public override bool Offer(T element, TimeSpan duration)
        {
            var deadline = WaitTime.Deadline(duration);
            int tempCount;

            lock (_putLock)
            {
                for (;;)
                {
                    if (_isBroken)
                    {
                        return(false);
                    }
                    if (_activeCount < _capacity)
                    {
                        Insert(element);
                        lock (this)
                        {
                            tempCount = _activeCount++;
                        }
                        if (tempCount + 1 < _capacity)
                        {
                            Monitor.Pulse(_putLock);
                        }
                        break;
                    }
                    if (duration.Ticks <= 0)
                    {
                        return(false);
                    }
                    try
                    {
                        Monitor.Wait(_putLock, WaitTime.Cap(duration));
                        duration = deadline.Subtract(DateTime.UtcNow);
                    }
                    catch (ThreadInterruptedException e)
                    {
                        Monitor.Pulse(_putLock);
                        throw e.PreserveStackTrace();
                    }
                }
            }
            if (tempCount == 0)
            {
                SignalNotEmpty();
            }
            return(true);
        }
        /// <summary>
        /// Retrieves and removes the head of this queue, waiting up to the
        /// specified wait time if necessary for an element to become available.
        /// </summary>
        /// <param name="element">
        /// Set to the head of this queue. <c>default(T)</c> if queue is empty.
        /// </param>
        /// <param name="duration">How long to wait before giving up.</param>
        /// <returns>
        /// <c>false</c> if the queue is still empty after waited for the time
        /// specified by the <paramref name="duration"/>. Otherwise <c>true</c>.
        /// </returns>
        public override bool Poll(TimeSpan duration, out T element)
        {
            var deadline = WaitTime.Deadline(duration);
            T   x;
            int c;

            lock (_takeLock)
            {
                for (;;)
                {
                    if (_activeCount > 0)
                    {
                        x = Extract();
                        lock (this)
                        {
                            c = _activeCount--;
                        }
                        if (c > 1)
                        {
                            Monitor.Pulse(_takeLock);
                        }
                        break;
                    }
                    if (duration.Ticks <= 0 || _isBroken)
                    {
                        element = default(T);
                        return(false);
                    }
                    try
                    {
                        Monitor.Wait(_takeLock, WaitTime.Cap(duration));
                        duration = deadline.Subtract(DateTime.UtcNow);
                    }
                    catch (ThreadInterruptedException e)
                    {
                        Monitor.Pulse(_takeLock);
                        throw e.PreserveStackTrace();
                    }
                }
            }
            if (c == _capacity)
            {
                SignalNotFull();
            }
            element = x;
            return(true);
        }
        public void Do <TResult1, TResult2>(Action <Func <IWebElement> > seleniumAction,
                                            Func <Func <IWebElement>, TResult1> expectedConditionAfterAction,
                                            Func <IWebDriver, TResult2> errorWaitCondition = null,
                                            int maxRetries    = 10,
                                            WaitTime waitTime = WaitTime.Short,
                                            [CallerMemberName] string caller = "",
                                            string logMessage = null)
        {
            var fullLogMessage = $"{caller} - {_selector}";

            if (logMessage != null)
            {
                fullLogMessage += " - " + logMessage;
            }

            Do(_browser, () => Element, seleniumAction, expectedConditionAfterAction, errorWaitCondition, maxRetries, waitTime, caller, _configuration, fullLogMessage);
        }
Exemple #25
0
        public override bool Initialise()
        {
            _currentLabels = new TimeCache <List <CustomItem> >(UpdateCurrentLabels, 500);

            #region Register keys

            Settings.PickUpKey.OnValueChanged += () => Input.RegisterKey(Settings.PickUpKey);
            Input.RegisterKey(Settings.PickUpKey);
            Input.RegisterKey(Keys.Escape);

            #endregion

            _pickItCoroutine = new Coroutine(MainWorkCoroutine(), this, "Pick It");
            Core.ParallelRunner.Run(_pickItCoroutine);
            _pickItCoroutine.Pause();
            _debugTimer.Reset();
            _workCoroutine = new WaitTime(Settings.ExtraDelay);
            Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);
            return(true);
        }
Exemple #26
0
    IEnumerator GetWaitTimeApi(string city)
    {
        using (UnityWebRequest www = UnityWebRequest.Get(string.Format("https://waittime-qa.api.aero/waittime/v1/current/{0}", city)))
        {
            www.SetRequestHeader("X-apiKey", "8e2cff00ff9c6b3f448294736de5908a");
            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                // text.text = www.error.ToString();
            }
            else
            {
                WaitTime w = JsonUtility.FromJson <WaitTime>(www.downloadHandler.text.ToString());
                foreach (WaitTimeQueue queue in w.current)
                {
                    string WaitTimeString = string.Format("Queue: {0} -  {1} minutes\n", queue.queueName, Int32.Parse(queue.projectedWaitTime) / 60);
                }
            }
        }
    }
Exemple #27
0
        public string FormatforQAD()
        {
            const char MFLD = '\u0001';
            string     mstr = RoutingCode + "\v" + "S" + MFLD;

            mstr = mstr + Operation.ToString() + "\v" + "I" + MFLD;
            mstr = mstr + StartDate.ToString() + "\v" + "D" + MFLD;
            mstr = mstr + EndDate.ToString() + "\v" + "D" + MFLD;
            mstr = mstr + StandOp + "\v" + "S" + MFLD;
            mstr = mstr + WorkCenter + "\v" + "S" + MFLD;
            mstr = mstr + Machine + "\v" + "S" + MFLD;
            mstr = mstr + Description + "\v" + "S" + MFLD;
            mstr = mstr + MachPerOp.ToString() + "\v" + "I" + MFLD;
            mstr = mstr + OverlapUnits.ToString() + "\v" + "I" + MFLD;
            mstr = mstr + QueueTime.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + WaitTime.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + "yes" + "\v" + "L" + MFLD;
            mstr = mstr + SubcontractLT.ToString() + "\v" + "I" + MFLD;
            mstr = mstr + SetupCrew.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + RunCrew.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + SetupTime.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + RunTime.ToString() + "\v" + "F" + MFLD;
            mstr = mstr + MoveTime.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + YieldPerc.ToString("000") + "\v" + "E" + MFLD;
            mstr = mstr + ToolCode + "\v" + "S" + MFLD;
            mstr = mstr + Supplier + "\v" + "S" + MFLD;
            mstr = mstr + InvValue.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + SubCost.ToString() + "\v" + "G" + MFLD;
            mstr = mstr + Comments + "\v" + "X" + MFLD;
            mstr = mstr + WIP + "\v" + "S" + MFLD;
            mstr = mstr + PurchaseOrder + "\v" + "S" + MFLD;
            mstr = mstr + Line.ToString() + "\v" + "I" + MFLD;
            mstr = mstr + "yes" + "\v" + "L" + MFLD;
            mstr = mstr + "no" + "\v" + "L" + MFLD;
            mstr = mstr + OrigStartDate.ToString() + "\v" + "D" + MFLD;
            mstr = mstr + '\u0014';
            return(mstr);
        }
Exemple #28
0
        public override bool Initialise()
        {
            LogMessage("****** Initialise started", 1);

            _networkHelper = new NetworkHelper(Settings);

            _windowRectangle = GameController.Window.GetWindowRectangleReal();
            _windowSize      = new Size2F(_windowRectangle.Width / 2560, _windowRectangle.Height / 1600);
            //_lastTimeMovementSkillUsed = DateTime.UtcNow;
            //_lastTimeNetworkActivityPropagateWorkingChanged = DateTime.UtcNow;
            //_lastTimeAggressivenessModePropagated = DateTime.UtcNow;
            _lastTimeEnterInstanceUsed = ((DateTimeOffset)_lastTimeEnterInstancePropagated).ToUnixTimeMilliseconds();
            _enterInstanceValue        = ((DateTimeOffset)_lastTimeEnterInstancePropagated).ToUnixTimeMilliseconds();

            GameController.LeftPanel.WantUse(() => true);

            _serverCoroutine          = new Coroutine(MainServerCoroutine(), this, "Follower Server");
            _followerCoroutine        = new Coroutine(MainFollowerCoroutine(), this, "Follower");
            _networkActivityCoroutine =
                new Coroutine(MainNetworkActivityCoroutine(), this, "Follower Network Activity");

            Core.ParallelRunner.Run(_serverCoroutine);
            Core.ParallelRunner.Run(_followerCoroutine);
            Core.ParallelRunner.Run(_networkActivityCoroutine);

            _followerCoroutine.Pause();
            _networkActivityCoroutine.Pause();

            _debugTimer.Reset();

            Settings.MouseSpeed.OnValueChanged += (sender, f) => { Mouse.speedMouse = Settings.MouseSpeed.Value; };
            _workCoroutine = new WaitTime(Settings.ExtraDelay);
            Settings.ExtraDelay.OnValueChanged += (sender, i) => _workCoroutine = new WaitTime(i);

            return(true);
        }
Exemple #29
0
        public override string ToString()
        {
            var builder = new System.Text.StringBuilder();

            builder.AppendFormat("{0} {{", nameof(SessionInfo)).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(Version), Version.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(MessageSessionIndex), MessageSessionIndex.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(ServerSessionIndex), ServerSessionIndex.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(SessionCount), SessionCount.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(ServerName), ServerName.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(TrackName), TrackName.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(TrackLayout), TrackLayout.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(SessionName), SessionName.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(SessionType), SessionType.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(SessionLengthLaps), SessionLengthLaps.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(SessionLengthMinutes), SessionLengthMinutes.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(WaitTime), WaitTime.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(AmbientTemperature), AmbientTemperature.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(RoadTemperature), RoadTemperature.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(Weather), Weather.ToString()).AppendLine();
            builder.AppendFormat("    {0} = {1}", nameof(Elapsed), Elapsed.ToString()).AppendLine();
            builder.AppendFormat("}}").AppendLine();
            return(builder.ToString());
        }
Exemple #30
0
        public override XmlNode Save(XmlDocument doc)
        {
            XmlNode nameNode = doc.CreateElement("phdguiding");

            nameNode.Attributes.Append(ScriptManager.CreateAttribute(doc, "waittime", WaitTime.ToString()));
            nameNode.Attributes.Append(ScriptManager.CreateAttribute(doc, "movetype", MoveType));
            return(nameNode);
        }