Example #1
0
 /// <summary>
 /// Continue rng search based on last heal value and current heal value
 /// </summary>
 /// <returns></returns>
 private async Task ContinueAsync()
 {
     await RunCommandAsync(() => IsBusy, async() =>
     {
         // TODO: make all this logic asyncronous.
         int groupIndex_temp      = mGroup.GetIndex();
         int index_temp           = mIndex;
         List <int> healVals_temp = new List <int>(mHealVals);
         CircularBuffer <uint> searchBuff_temp = mSearchBuff.DeepClone();
         IRNG rng_temp = mSearchRng.DeepClone();
         mGroup.IncrimentIndex();
         if (!FindNext(LastHeal))
         {
             mGroup.SetIndex(groupIndex_temp);
             mIndex      = index_temp;
             mHealVals   = healVals_temp;
             mSearchBuff = searchBuff_temp;
             mSearchRng  = rng_temp;
             await mPage.DisplayAlert("Alert", "Impossible Heal Value entered", "OK");
         }
         else
         {
             DisplayRNG(mIndex - mHealVals.Count + 1, mIndex + 1000);
         }
     });
 }
Example #2
0
        private void btnContinue_Click(object sender, EventArgs e)
        {
            // Store all of the information we need to restore our state if we fail
            int groupIndex_temp = _group.GetIndex();
            int index_temp      = _index;
            // We have to Deep Copy this data
            List <int>            healVals_temp   = new List <int>(_healVals);
            CircularBuffer <uint> searchBuff_temp = _searchBuff.DeepClone();
            IRNG rng_temp = _searchRng.DeepClone();

            _group.IncrimentIndex();
            if (!FindNext(int.Parse(tbLastHeal.Text)))
            {
                // Restore state
                _group.SetIndex(groupIndex_temp);
                _index = index_temp;
                // No Deep Copy needed here. We can just re-assign the temps
                // because we won't be touching them again.
                _healVals   = healVals_temp;
                _searchBuff = searchBuff_temp;
                _searchRng  = rng_temp;

                MessageBox.Show("Impossible Heal Value entered.");
                return;
            }

            int numRows = ParseNumRows();

            displayRNG(_index - _healVals.Count + 1, _index + numRows);
        }
Example #3
0
        public void TestCircularBufferDeepClones()
        {
            CircularBuffer <int> original = new CircularBuffer <int>(3);

            original.Add(1);
            original.Add(2);

            CircularBuffer <int> clone = original.DeepClone();

            original.Add(3);
            clone.Add(4);

            Assert.AreEqual(original[0], clone[0]);
            Assert.AreEqual(original[1], clone[1]);
            Assert.AreNotEqual(original[2], clone[2]);
        }