Example #1
0
        public void ShouldThrowWhenUpdatingTwoInstancesOfSameDataAtTheSameTime()
        {
            // Arrange
            IProcessManagerData data1 = new TestData {
                CorrelationId = _correlationId, Name = "TestData1"
            };
            IProcessManagerFinder processManagerFinder = new InMemoryProcessManagerFinder(string.Empty, string.Empty);

            processManagerFinder.InsertData(data1);

            var foundData1 = (MemoryData <TestData>)processManagerFinder.FindData <TestData>(_mapper, new Message(_correlationId));
            var foundData2 = (MemoryData <TestData>)processManagerFinder.FindData <TestData>(_mapper, new Message(_correlationId));

            var foundData1Temp = new MemoryData <IProcessManagerData> {
                Data = foundData1.Data, Version = foundData1.Version
            };
            var foundData2Temp = new MemoryData <IProcessManagerData> {
                Data = foundData2.Data, Version = foundData2.Version
            };

            processManagerFinder.UpdateData(foundData1Temp); // first update should be fine

            // Act / Assert
            Assert.Throws <ArgumentException>(() => processManagerFinder.UpdateData(foundData2Temp)); // second update should fail
        }
 static void S_12(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     cardPool.GetCard("Adv_000").priority = 30;
     cardPool.GetCard("Adv_001").priority = 30;
     cardPool.GetCard("Adv_002").priority = 30;
     cardPool.GetCard("Adv_003").priority = 30;;
 }
 static void S_1(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     cardPool.GetCard("Basic_000").priority = 5;
     cardPool.GetCard("Basic_001").priority = 5;
     cardPool.GetCard("Basic_002").priority = 5;
     cardPool.GetCard("Basic_003").priority = 5;;
 }
Example #4
0
    public void StoreData(float time)
    {
        string     loadedResultsJson = PlayerPrefs.GetString("Result");
        MemoryData loadedMemory      = new MemoryData();

        if (!String.IsNullOrEmpty(loadedResultsJson))
        {
            loadedMemory = JsonUtility.FromJson <MemoryData>(loadedResultsJson);
        }

        string roomName   = SceneManager.GetActiveScene().name;
        string playerName = PlayerPrefs.GetString("PlayerName");

        Data result = new Data();

        result.PlayerName = playerName;
        result.Time       = time;
        result.RoomName   = roomName;

        loadedMemory.resultList.Add(result);

        string resultsJson = JsonUtility.ToJson(loadedMemory);

        PlayerPrefs.SetString("Result", resultsJson);
        PlayerPrefs.Save();
    }
Example #5
0
 internal void CmdRead(int targetNum, MemoryData data)
 {
     if (InfoController.Instance)
     {
         InfoController.Instance.Receive(targetNum, data);
     }
 }
Example #6
0
        private static void LoadSeed()
        {
            MemoryData.Add(
                new User
            {
                UserName  = "******",
                Password  = "******",
                SecretKey = "1qa2ws3ed4rf5tg6yh7uj8il"
            });

            MemoryData.Add(
                new User
            {
                UserName  = "******",
                Password  = "******",
                SecretKey = "2ws3ed4rf5tg6yh7uj8ik9ol"
            });

            MemoryData.Add(
                new User
            {
                UserName  = "******",
                Password  = "******",
                SecretKey = "3ed4rf5tg6yh7uj8ik9ol0pç"
            });

            MemoryData.Add(
                new User
            {
                UserName  = "******",
                Password  = "******",
                SecretKey = "4rf5tg6yh7uj8ik9ol0pç1qa"
            });
        }
Example #7
0
    void UpdateInfo(MemoryData data)
    {
        bool isSel = data.scene == 1;

        byte[] p = isSel ? data.sel_p : data.p;

        bool allDead = data.life.All((x) => x == 0);

        for (int i = 0; i < displayNum; i++)
        {
            var info = mgr.Infos[i];

            byte id = p[i];
            info.ChaName.text = Database.datas[id].name;
            info.ChaName.textComponent.color = Database.datas[id].color;
            info.Icon.sprite = Database.datas[id].Icon;
            bool gray = !isSel && !allDead;
            gray &= data.life[i] == 0;
            info.Icon.material.SetFloat("_GrayScale", gray ? 1 : 0);

            if (isSel)
            {
                info.Cash.ChangeText("-");
                info.Bank.ChangeText("-");
            }
            else
            {
                info.Cash.ChangeText(data.cash[i].ToString());
                info.Bank.ChangeText(data.bank[i].ToString());
            }
        }
    }
Example #8
0
        new public async void Invalidate()
        {
            if (MemoryData == null)
            {
                Dispatcher.UIThread.InvokeAsync(() =>
                {
                    MemoryData = new AsyncVirtualizingCollection <MemoryBytesViewModel>(dataProvider, 15, 500);
                });
            }
            else
            {
                Dispatcher.UIThread.InvokeAsync(() =>
                {
                    MemoryData.CleanPagesAround((ulong)selectedIndex);
                });

                var pages = memoryData.Pages.ToList();

                if (debugger != null)
                {
                    foreach (var page in pages)
                    {
                        foreach (var item in page.Value.Items)
                        {
                            if (item.Data != null)
                            {
                                await item.Data.InvalidateAsync(debugger);
                            }
                        }
                    }
                }
            }
        }
Example #9
0
        public ActionResult Del_Pages(decimal p_id)
        {
            try
            {
                decimal preturn = 0;
                if (SessionData.CurrentUser == null)
                {
                    return(Redirect("/"));
                }
                var            objBL      = new Sys_Pages_BL();
                Sys_Pages_Info _Info      = new Sys_Pages_Info();
                var            ModifiedBy = SessionData.CurrentUser.Username;
                _Info.Id          = p_id;
                _Info.Modified_By = ModifiedBy;

                preturn = objBL.Sys_Pages_Deleted(_Info);
                if (preturn >= 0)
                {
                    MemoryData.Load_Sys_page();
                }
                return(Json(new { status = preturn }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(View());
            }
        }
Example #10
0
        public ActionResult Edit_Pages(Sys_Pages_Info p_Sys_Pages_Info)
        {
            try
            {
                if (p_Sys_Pages_Info == null)
                {
                    return(Json(new { status = -99 }));
                }

                string language     = AppsCommon.GetCurrentLang();
                var    ModifiedBy   = SessionData.CurrentUser.Username;
                var    ModifiedDate = CommonFuc.CurrentDate();
                if (p_Sys_Pages_Info.pfileLogo != null)
                {
                    p_Sys_Pages_Info.Imageheader = AppLoadHelpers.PushFileToServer(p_Sys_Pages_Info.pfileLogo, AppUpload.Logo);
                }
                p_Sys_Pages_Info.Modified_By = SessionData.CurrentUser.Username;
                var     objBL   = new Sys_Pages_BL();
                decimal preturn = objBL.Sys_Pages_Update(p_Sys_Pages_Info);
                if (preturn >= 0)
                {
                    MemoryData.Load_Sys_page();
                }
                return(Json(new { status = preturn }));
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
                return(View());
            }
        }
Example #11
0
        public MemoryData CreateMemory(GroupData currGroup, string _memoryTitle)
        {
            MemoryData data = currGroup.CraeteMemoryEvent(_memoryTitle);

            SaveGroupData();
            return(data);
        }
Example #12
0
        public void MapToPrizTest()
        {
            var prizExpected        = FirebirdData.Build(1);
            var recruitInfoInMemory = MemoryData.Build(1, 1, _photoExtension);
            var prizActual          = RecruitInfoMapper.Map(recruitInfoInMemory);

            Assert.AreEqual(prizExpected, prizActual);
        }
Example #13
0
        public void MapToRecruitInfoTest()
        {
            var recruitInfoExpected = MemoryData.Build(1, 1, _photoExtension);
            var priz = SQLiteData.Build(1, 1, _photoExtension);
            var recruitInfoActual = RecruitInfoMapper.Map(priz);

            Assert.AreEqual(recruitInfoExpected, recruitInfoActual);
        }
Example #14
0
        /// <summary>
        /// process the response from server and update the properties
        /// </summary>
        protected override bool ProcessResponse(HttpResponse response)
        {
            string json = response.Result;

            // deserialize
            MemoryData = JsonConvert.DeserializeObject <MemoryData>(json);
            return(true);
        }
        public void GetByIdRecruitInfoSQLiteTest()
        {
            var recruitInfo = MemoryData.Build(1, 1, _photoExtension);

            AddRecruitInfo(recruitInfo);

            var first = _recruitInfoRepository.Get(1);

            Assert.IsNotNull(first);
        }
Example #16
0
    public void endFullMemory()
    {
        currentMemory = memories[currentMemoryIndex];
        currentMemoryIndex++;

        if (unpauseEvent != null)
        {
            unpauseEvent();
        }
    }
Example #17
0
    public void AddEvent(MemoryData eventData)
    {
        GameObject eventObj = AssetsCenter.InstantiateGameObject(Constants.eventCellPath, "EventCell");

        eventObj.transform.SetParent(content);
        eventObj.transform.localScale = Vector3.one;
        EventCell eCell = eventObj.GetComponent <EventCell> ();

        eCell.data = eventData;
    }
Example #18
0
        private void Display()
        {
            IGridList <View> gridList = piStatsGrid.Children;

            gridList.Clear();
            int rowIndex = 0;

            if (_piSystem == null)
            {
                AddLabel($"Service {_monitorTopic.Name} is not available at {_monitorTopic.Server}.", gridList, rowIndex++, 0, 5);
                AbortRefresh();
                return;
            }

            HttpResponse response = _piSystem.CpuClient.GetResponse();

            if (!response.Success)
            {
                AddLabel($"Error getting data for {_monitorTopic.Name} at {_monitorTopic.Server}", gridList, rowIndex++, 0, 5);
                GridUtil.AddLabel(response.ErrorMessage, gridList, rowIndex++, 0, 5, 10, Color.Default, false, LayoutOptions.End);
                StopRefresh();
                return;
            }
            _piSystem.MemoryClient.Get();
            CpuData    cpu    = _piSystem.CpuClient.CpuData;
            MemoryData memory = _piSystem.MemoryClient.MemoryData;

            DisplayHeaderAndValueRow("Server Address", _monitorTopic.Server, gridList, rowIndex++, 3);
            DisplayHeaderAndValueRow("CPU Core Temperature", cpu.Temperature.ToString(), gridList, rowIndex++, 3);
            AddLabel("Usage", gridList, rowIndex, 1, 1);
            AddLabel("User", gridList, rowIndex, 2, 1);
            AddLabel("System", gridList, rowIndex, 3, 1);
            AddLabel("Idle", gridList, rowIndex, 4, 1);
            rowIndex++;
            DisplayCpuRow(_monitorTopic.Name, cpu, gridList, rowIndex++);
            if (cpu.Cores != null)
            {
                foreach (var data in cpu.Cores)
                {
                    DisplayCpuRow(data.Key, data.Value, gridList, rowIndex++);
                }
            }
            DisplayHeaderAndValueRow("Total Memory (MB)", memory.Total.ToString(), gridList, rowIndex++, 2);
            DisplayMemoryRow("Used Memory (MB)", memory.Used, memory.Total, gridList, rowIndex++);
            DisplayMemoryRow("Cached Memory (MB)", memory.Cached, memory.Total, gridList, rowIndex++);
            DisplayMemoryRow("Free Memory (MB)", memory.Free, memory.Total, gridList, rowIndex++);
            DisplayMemoryRow("Available Memory (MB)", memory.Available, memory.Total, gridList, rowIndex++);

            if (_hygroThermoSensor != null)
            {
                string json = _hygroThermoSensor.Get();
                DisplayHeaderAndValueRow("Humidity (%)", _hygroThermoSensor.HygroThermoData.Humidity.ToString(), gridList, rowIndex++, 2);
                DisplayHeaderAndValueRow("Temperature (C)", _hygroThermoSensor.HygroThermoData.Temperature.ToString(), gridList, rowIndex++, 2);
            }
        }
Example #19
0
        public static void memoryParser(ManagementObjectSearcher searcher)
        {
            MemoryBanks myList = new MemoryBanks();

            foreach (ManagementObject queryObj in searcher.Get())
            {
                Memory currentItem = new Memory(queryObj);
                myList.banksList.Add(currentItem);
            }
            MemoryData.EventHandler(myList);
        }
Example #20
0
 internal void Receive(int targetNum, MemoryData newData)
 {
     if (data.Comparer(newData))
     {
         DisplayNumUpdate(targetNum);
         UpdateInfo(newData);
         UpdateSubInfo(newData);
         pointPlayer.SetIndex(newData.scene > 1 ? newData.cur : -1);
     }
     data = newData;
 }
Example #21
0
    void UpdateSubInfo(MemoryData data)
    {
        subMgr.CPIText.ChangeText(data.CPI.ToString());
        var date = MemoryTracker.GetDate(data.date);

        subMgr.YearText.ChangeText(date.Year.ToString());
        subMgr.MonText.ChangeText(date.Month.ToString());
        subMgr.DayText.ChangeText(date.Day.ToString());

        subMgr.DisplaySub(data.scene != 1);
    }
        public void AddRecruitInfoSQLiteTest()
        {
            var recruitInfo = MemoryData.Build(1, 1, _photoExtension);

            AddRecruitInfo(recruitInfo);

            var expected = recruitInfo;
            var actual   = _recruitInfoRepository.Get(1);

            Assert.AreEqual(expected, actual);
        }
Example #23
0
        public void IsExpired_WhenInformExpirationAndItIsExpired_ShouldBeTrue()
        {
            var memoryData = new MemoryData <string>("something", TimeSpan.FromMilliseconds(10));

            Thread.Sleep(20);

            memoryData
            .IsExpired()
            .Should()
            .BeTrue();
        }
Example #24
0
        internal void LoadWebAppDataWhenResetPool()
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure();
                Configuration.GetConfigAppSetting();
                EmailHelper.EmailOriginal = new EmailInfo()
                {
                    Host        = CommonFuc.GetConfig("EMailHost"),
                    Port        = Convert.ToInt32(CommonFuc.GetConfig("EmailPost")),
                    EMailFrom   = CommonFuc.GetConfig("EMailFrom"),
                    PassWord    = Configuration.EMailPass,
                    DisplayName = CommonFuc.GetConfig("DisplayName"),
                    IsSsl       = CommonFuc.GetConfig("SSL") == "Y",
                    EmailCC     = CommonFuc.GetConfig("EmailCC"),

                    EMailFrom_Business   = CommonFuc.GetConfig("EMailFrom_Business"),
                    PassWord_Business    = Configuration.EMailPass_Business,
                    DisplayName_Business = CommonFuc.GetConfig("DisplayName_Business")
                };

                CommonVariables.AssemblyVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
                CommonVariables.KnFileLogin     = HttpContext.Current.Server.MapPath(@"~/log/LogInApp" + DateTime.Now.ToString("MMyyyy") + ".log");
                MemoryData.LoadAllMemoryData();

                // lấy thông tin fee
                List <AllCodeInfo> _lstTax = WebApps.CommonFunction.AppsCommon.AllCode_GetBy_CdTypeCdName("BILLING", "TAX");
                if (_lstTax.Count > 0)
                {
                    Common.Tax = Convert.ToDecimal(_lstTax[0].CdVal);
                }

                // thread chuyên load dữ liệu tĩnh khi có sự thay đổi
                Thread _th1 = new Thread(ThreadReloadWhenChangeData);
                _th1.IsBackground = true;
                _th1.Start();

                // tự động change trạng thái của remind
                Thread _th2 = new Thread(ThreadReadTodo4SendEmail);
                _th2.IsBackground = true;
                _th2.Start();

                Thread _th3 = new Thread(ThreadSendEmail);
                _th3.IsBackground = true;
                _th3.Start();

                Logger.Log().Info("Start Application_Start");
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
Example #25
0
    public void LoadResultsFromMemory()
    {
        string resultsJson = PlayerPrefs.GetString("Result");

        if (!String.IsNullOrEmpty(resultsJson))
        {
            MemoryData md = JsonUtility.FromJson <MemoryData>(resultsJson);
            this.resultList = md.resultList;
        }
        leaderBoardPanel.SetActive(true);
        ShowResults(this.listOfRooms[currentListIndex].Name);
    }
Example #26
0
    void RepeadRenderUI()
    {
        if (this.data != null)
        {
            MemoryData mData = this.data as MemoryData;
            this.mName.text = mData.memoryName;

            mData.timeData.Update();

            DateTime startDateTime = TimeUtil.GetTime(mData.timeData.startTime.ToString());
            string   startTimeStr  = startDateTime.GetDateTimeFormats('g') [0].ToString();
            this.txtStartTime.text = startTimeStr;

            int nowTimestamp = TimeUtil.GetTimestamp(DateTime.Now);

            int listIndex = 0;

            foreach (KeyValuePair <int, enTimeState> kv in mData.timeData.timestampDic)
            {
                timeLineProgressList [listIndex].gameObject.SetActive(false);

                if (kv.Value == enTimeState.TIMEOUT)
                {
                    // set background is red
                    timeLineTextList [listIndex].text = kv.Value.ToString();
                    SetTimeLineBgColor(timeLineBgList [listIndex], kv.Key, 0);

                    if (isRemindedTime(kv.Key) == false)
                    {
                        SetRemindedTime(kv.Key);
                        PlayRemindAudio();
                    }
                }
                else if (kv.Value == enTimeState.READY)
                {
                    int hasSeconds = mData.timeData.startTime + kv.Key - nowTimestamp;
                    hasSeconds = Mathf.Clamp(hasSeconds, 0, hasSeconds);
                    //timeLineTextList [listIndex].text = hasSeconds.ToString ();
                    timeLineTextList [listIndex].text = SecondsToStr(hasSeconds);

                    //SetTimeLineBgColor (timeLineBgList [listIndex], kv.Key, hasSeconds);
                    SetProgress(timeLineProgressList [listIndex], kv.Key, hasSeconds);
                }
                else if (kv.Value == enTimeState.CHECKED)
                {
                    timeLineTextList [listIndex].text = kv.Value.ToString();
                    timeLineBgList [listIndex].color  = checkedColor;
                }
                ++listIndex;
            }
        }
    }
Example #27
0
    public bool AddMemory(string memoryContent)
    {
        memoryContent = memoryContent.Trim();
        if (memoryContent.Length == 0)
        {
            return(false);
        }

        MemoryData data = Model.groupProxy.CreateMemory(this.currGroup, memoryContent);

        AddEvent(data);
        return(true);
    }
Example #28
0
    void OnSetChecked(int index, int key)
    {
        if (this.data != null)
        {
            MemoryData mData = this.data as MemoryData;
            if (mData.timeData.CheckTime(key))
            {
                timeLineTextList [index].text = "CHECKED";
                timeLineBgList [index].color  = checkedColor;

                Model.groupProxy.SaveGroupData();
            }
        }
    }
        public void Initialize()
        {
            _dbContextFactory = new DbContextTestFactory("PupaDbContextTest");
            _dbContextCache   = new DbContextCache(_dbContextFactory);

            _unitOfWorkFactory = new UnitOfWorkFactory(_dbContextCache);

            _prizQuery   = new PrizQuery(_dbContextFactory);
            _prizCommand = new PrizCommand(_dbContextCache);

            _recruitInfoRepository = new RecruitInfoRepository(_prizQuery, _prizCommand);

            var priz        = SQLiteData.Build(1, 1, _photoExtension);
            var recruitInfo = MemoryData.Build(1, 1, _photoExtension);
        }
Example #30
0
        public static string ConfigToString()
        {
            var result = string.Empty;

            foreach (var config in ConfigDict)
            {
                result += $"{config.Key}={config.Value}\n";
            }
            if (MemoryData != null)
            {
                result += "\n MemoryData:";
                result += MemoryData.ToString();
            }
            return(result);
        }
Example #31
0
        public void MemoryCache()
        {
            var watch = Stopwatch.StartNew();
            var cache = new MyMemoryCache();
            var data  = new MemoryData()
            {
                Id   = 1,
                Name = "Heo"
            };

            cache.Save(data);
            MemoryData temp;

            Assert.IsTrue(cache.TryGet(data.Id.ToString(), out temp));
            WaitEnd(watch);
        }
        public void GetByRcpConscriptionDateRecruitInfoSQLiteTest()
        {
            var recruitInfo1 = MemoryData.Build(1, 1, _photoExtension);
            var recruitInfo2 = MemoryData.Build(2, 2, _photoExtension);

            using (var unitOfWork = _unitOfWorkFactory.Create())
            {
                _recruitInfoRepository.Add(recruitInfo1);
                _recruitInfoRepository.Add(recruitInfo2);

                unitOfWork.Commit();
            }

            var recruitInfos = _recruitInfoRepository.Get("Барабинский", new DateTime(2017, 1, 1), null);

            Assert.IsTrue(recruitInfos.Count() == 2);
        }
 static bool S_1(int turn, MemoryData memory)
 {
     return true;;
 }
 static bool S_2(int turn, MemoryData memory)
 {
     return memory.Fund>10;;
 }
 static void S_4(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Approval +=5;
     memory.Fear +=5;;
 }
 static void S_7(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Fear = 100;;
 }
 static void S_2(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Fund += 5;
 }
 static void S_3(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Fear += 5;;
 }
        public void ShouldThrowWhenUpdatingTwoInstancesOfSameDataAtTheSameTime()
        {
            // Arrange
            IProcessManagerData data1 = new TestData { CorrelationId = _correlationId, Name = "TestData1" };
            IProcessManagerFinder processManagerFinder = new InMemoryProcessManagerFinder(string.Empty, string.Empty);
            processManagerFinder.InsertData(data1);

            var foundData1 = (MemoryData<TestData>) processManagerFinder.FindData<TestData>(_mapper, new Message(_correlationId));
            var foundData2 = (MemoryData<TestData>) processManagerFinder.FindData<TestData>(_mapper, new Message(_correlationId));

            var foundData1Temp = new MemoryData<IProcessManagerData> { Data = foundData1.Data, Version = foundData1.Version};
            var foundData2Temp = new MemoryData<IProcessManagerData> { Data = foundData2.Data, Version = foundData2.Version };

            processManagerFinder.UpdateData(foundData1Temp); // first update should be fine

            // Act / Assert
            Assert.Throws<ArgumentException>(() => processManagerFinder.UpdateData(foundData2Temp)); // second update should fail
        }
 static bool S_0(int turn, MemoryData memory)
 {
     return Random.Range(0, 100) >= 50;
 }
 static void S_11(int turn, MemoryData memory, CardPool cardPool, GameFlow gameFlow)
 {
     memory.Approval +=10;;
 }
Example #42
0
 public static void SetData(int activityId, MemoryData data)
 {
     if (Dict2.ContainsKey(activityId))
     {
         Dict2[activityId] = data;
     }
     else
     {
         Dict2.Add(activityId, data);
     }
 }