public void InitExamStore() { ExamStore = new BaseStore <IExam> { new ExamTree() { RootPage = new SimilarPageExam(new List <SimilarPageExam>() { new SimilarPageExam(Questions.CHOOSE_SUBJECT, Answers.Subjects.MATH, Answers.Subjects.PHYSICS, 1.15, 0.9), new SimilarPageExam(ExamPages.FROM_WHAT_BEGIN()), new SimilarPageExam(Questions.TRY_TO_CHEAT, Answers.YES, Answers.NO, 0.5, 1.5), }), Type = ExamType.EIT, ExclusionProbability = 0.5 }, new ExamTree() { RootPage = new SimilarPageExam(Questions.CHOOSE_SUBJECT, Answers.Subjects.LITERATURE, Answers.Subjects.SPANISH, 0.75, 0.9, FullExamPages.DoNotKnowAnswersContinueBomb()), Type = ExamType.Universal, ExclusionProbability = 0.5 }, new ExamTree() { RootPage = FullExamPages.MathChemistryAskHelp(), Type = ExamType.EIT, ExclusionProbability = 0.5 }, }; }
public string BuyMeal(BaseStore store, int choice) { return(string.Format("{0} 前往 {1} 點了:{2}" , this.name , store.Name , store.OrderMeal(choice))); }
private BaseStore LoadStore(string path, string type, int statesCacheSize) { BaseStore store = null; if (type == "rocksdb") { try { store = new RocksDBStore.RocksDBStore(path, statesCacheSize: statesCacheSize); Log.Debug("RocksDB is initialized."); } catch (TypeInitializationException e) { Log.Error("RocksDB is not available. DefaultStore will be used. {0}", e); } } else { var message = type is null ? "Storage Type is not specified" : $"Storage Type {type} is not supported"; Log.Debug($"{message}. DefaultStore will be used."); } return(store ?? new DefaultStore( path, flush: false, compress: true, statesCacheSize: statesCacheSize)); }
public void InitStoreDta(BaseStore store) { m_Store = store; m_StoreT = store.GetStoreRow(); ShowText(); CreateItemOBJ(); ShowReflesh(); }
public async Task Should_Throw_If_Store_Null() { // Given BaseStore <TestObjects> fixture = new BaseStore <TestObjects>(null); // When var result = await Record.ExceptionAsync(async() => await fixture.InitializeStore()); // Then result.Message.Should().Contain("Store Service"); }
public void RefreshStore(Hashtable hashTable) { List <int> hashKeys = new List <int>(); List <NewShopList> hashValues = new List <NewShopList>(); foreach (DictionaryEntry item in hashTable) { hashKeys.Add((int)item.Key); hashValues.Add((NewShopList)item.Value); } for (int i = 0; i < hashValues.Count; i++) { NewShopList nsl = hashValues[i]; BaseStore bs; if (m_StoreList.Count < hashValues.Count) { bs = new BaseStore(); m_StoreList.Add(bs); } else { bs = m_StoreList[i]; } bs.MStoreId = hashKeys[i]; bs.MRefreshTime = (int)nsl.lasttime; bs.MRefreshCount = nsl.refreshnum; List <NewShop> temp = nsl.shoplist.ToList <NewShop>(); for (int j = 0; j < temp.Count; j++) { NewShop ns = temp[j]; Goods gs; if (bs.MGoodsList.Count < temp.Count) { gs = new Goods(); bs.MGoodsList.Add(gs); } else { gs = bs.MGoodsList[j]; } gs.MTabelId = ns.itemid; gs.MCosId = ns.costtype; gs.MPrice = ns.price; gs.MNumbar = ns.num; gs.MIsbuy = ns.isbuy; } } }
private void mnuMapWindow_Click(object sender, EventArgs e) { try { if (projectView.SelectedNode.Parent.Text.Trim().Equals("Mapped Objects")) { ToolStripMenuItem sentIt = (ToolStripMenuItem)sender; MapReferences aRef = (MapReferences)projectView.SelectedNode.Tag; Tuple <String, int> parsed = ParseTextLabel(sentIt.Text); BaseStore store = null; Guid mapGuid = Guid.Empty; aRef.LastMap = ConvertMenuToMapType(parsed.Item1); currentMode = aRef.LastMap; if (aRef.LastMap == DataMapType.MethodParameterMap) { aRef.LastMethodMap = (MethodParameterMap)sentIt.Tag; mapGuid = aRef.LastMethodMap.ID; store = MapManager.FindStore(aRef.LastMethodMap.MethodName, mapGuid, aRef.ReferenceInfo); } else { store = MapManager.FindStore(aRef.LastMap.ToString(), mapGuid, aRef.ReferenceInfo); } UIMapper autoMapIt = null; if (store != null && store.GetType().Equals(typeof(RuleStore))) { autoMapIt = new UIMapper(aRef.ViableInfo.TheMap, ((RuleStore)store).Rules, aRef.LastMethodMap, currentMode); } else { autoMapIt = new UIMapper(aRef.ViableInfo.TheMap, aRef.LastMethodMap, currentMode); } //autoMapIt.AutoMap = true; if (autoMapIt.ShowDialog() == DialogResult.OK) { aRef.ViableInfo.TheMap = UIMapper.Result; if (store.GetType().Equals(typeof(RuleStore))) { ((RuleStore)store).Rules = UIMapper.RuleSets; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public LibplanetNodeService( LibplanetNodeServiceProperties <T> properties, IBlockPolicy <T> blockPolicy, Func <BlockChain <T>, Swarm <T>, PrivateKey, CancellationToken, Task> minerLoopAction, Progress <PreloadState> preloadProgress, bool ignoreBootstrapFailure = false ) { _properties = properties; var genesisBlock = LoadGenesisBlock(properties); var iceServers = _properties.IceServers; Store = LoadStore( _properties.StorePath, _properties.StoreType, _properties.StoreStatesCacheSize); var chainIds = Store.ListChainIds().ToList(); Log.Debug($"Number of chain ids: {chainIds.Count()}"); foreach (var chainId in chainIds) { Log.Debug($"chainId: {chainId}"); } BlockChain = new BlockChain <T>(blockPolicy, Store, genesisBlock, _properties.Render); _minerLoopAction = minerLoopAction; Swarm = new Swarm <T>( BlockChain, _properties.PrivateKey, _properties.AppProtocolVersion, trustedAppProtocolVersionSigners: _properties.TrustedAppProtocolVersionSigners, host: _properties.Host, listenPort: _properties.Port, iceServers: iceServers, workers: 50, differentAppProtocolVersionEncountered: _properties.DifferentAppProtocolVersionEncountered ); PreloadEnded = new AsyncManualResetEvent(); BootstrapEnded = new AsyncManualResetEvent(); _preloadProgress = preloadProgress; _ignoreBootstrapFailure = ignoreBootstrapFailure; }
public void InitCheckStore() { CheckStore = new BaseStore <ICheck>() { new BaseCheck() { //CheckChain = new CheckLastClickTime(_context) //{ // MinTimeAfterClick = 2, // ExclusionProbabilityMin = 0.004, // MaxTimeAfterClick = 60, // ExclusionProbabilityMax = 0.002 //} } }; }
public Stores AddStore([FromBody] BaseStore storeInfo)//I could return only new id, but for example I return whole object { using (DB db = new DB()) { Stores store = new Stores(); store.StoreEmail = storeInfo.StoreEmail; store.StoreMgrEmail = storeInfo.StoreMgrEmail; store.StoreMgrFirstName = storeInfo.StoreMgrFirstName; store.StoreMgrLastName = storeInfo.StoreMgrLastName; store.StoreName = storeInfo.StoreName; store.Category = storeInfo.Category; store.CountryCode = storeInfo.CountryCode; var result = db.Stores.Add(store); db.SaveChanges(); return(result.Entity); } }
public override void Close(BaseStore shop) { if (shop != currentlyOpenStore || !isOpen) { Debug.LogWarning("Shop's Close() was called from a different shop."); } if (currentlyOpenStore != null) { currentlyOpenStore.isOpen = false; currentlyOpenStore = null; } isOpen = false; Hide(() => { ResetToDefault(); gameObject.SetActive(false); }); }
/// <summary> /// 创建商店Item /// </summary> private void CreateStoreItem() { ClearStoreOBJ(); List <BaseStore> storeList = ObjectSelf.GetInstance().StoreContainer.GetStoreList(); for (int i = 0; i < storeList.Count; i++) { BaseStore store = storeList[i]; if (store.GetStoreRow().getWhetherDisplay() == 1) { GameObject go = Instantiate(m_Prefab) as GameObject; go.transform.parent = m_Grid; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; UI_StoreItem uiStoreItem = go.GetComponent <UI_StoreItem>(); uiStoreItem.InitItemData(store); } } }
public bool EditStoreInfo([FromRoute] int id, [FromBody] BaseStore storeInfo) { using (DB db = new DB()) { var store = db.Stores.FirstOrDefault(p => p.Id == id); if (store == null) { throw new NotStoredException("Store not found"); } store.StoreEmail = storeInfo.StoreEmail;//regex for valid email format is on db side store.StoreMgrEmail = storeInfo.StoreMgrEmail; store.StoreMgrFirstName = storeInfo.StoreMgrLastName; store.StoreName = storeInfo.StoreName; store.Category = storeInfo.Category; store.CountryCode = storeInfo.CountryCode; db.SaveChanges();//I intentionally not check for nulls because it would be done by database, but if we unsure there could be checks return(true); } }
public override void Open <T>(BaseStore <T> shop, bool forceOpen = false) { if (!forceOpen && isOpen) { Debug.LogError("Shop is already open but Open() was called."); return; } gameObject.SetActive(true); if (!isOpen) { Show(AddShoppingBaskets); } else { AddShoppingBaskets(); } ShopName.text = shop.ShopName; currentlyOpenStore = shop; shop.isOpen = true; isOpen = true; void AddShoppingBaskets() { foreach (var item in shop.Items) { if (!item.ShouldAppearOnShop) { continue; } var newObject = CreateShopItemSlot(); newObject.SetAction(() => MoveItemToBasket(newObject)); newObject.SetItem(item, item.BasePrice); } } }
public void InitItemData(BaseStore store) { m_Store = store; m_StoreT = store.GetStoreRow(); m_StoreIcon.sprite = UIResourceMgr.LoadSprite(common.defaultPath + m_StoreT.getStoreIocn()); m_StoreNameTxt.text = GameUtils.getString(m_StoreT.getStoreName()); m_LockOBJ.SetActive(!SetOpenState()); if (!SetOpenState()) { string str = ""; switch (m_StoreT.getStoreOpen()) { case 1: str = string.Format("", m_StoreT.getConditionalData()); break; case 2: break; case 3: break; case 4: str = string.Format("", m_StoreT.getConditionalData()); break; case 5: break; default: break; } m_OpenDesText.text = str; } }