private void SaveImplementationDirs() { var allImplDirs = listBoxImplDirs.Items.Cast <string>(); var userImplDirs = allImplDirs.Except(_lockedImplDirs); StoreConfig.SetUserImplementationDirs(userImplDirs); }
public void Buy() { RoleInfo ri = ArkCrossEngine.LobbyClient.Instance.CurrentRole; StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(exchangedId); if (ri != null && sc != null) { int nowcurrency = 0; if (sc.m_Currency == ItemConfigProvider.Instance.GetGoldId()) { nowcurrency = ri.Money; } else if (sc.m_Currency == ItemConfigProvider.Instance.GetDiamondId()) { nowcurrency = ri.Gold; } else { nowcurrency = ri.ExchangeCurrency; } if (nowcurrency < exchangeCurrency) { GfxSystem.PublishGfxEvent("ge_screen_tip", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(163), UIScreenTipPosEnum.AlignCenter, UnityEngine.Vector3.zero); } else { GfxSystem.PublishGfxEvent("ge_ui_connect_hint", "ui", false, true); ArkCrossEngine.LogicSystem.PublishLogicEvent("ge_exchange_goods", "lobby", exchangedId, false); } UIManager.Instance.HideWindowByName("ItemProperty"); signforExchange = false; } }
void AddItem(int storeid, int buytimes) { StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(storeid); if (sc != null) { if (storeDic.ContainsKey(storeid)) { storeInfo si = storeDic[storeid]; if (si != null) { SetGameObjectInfo(si.go, sc, sc.m_HaveDayLimit ? sc.m_DayLimit - buytimes : 1); si.ChangeTimes(sc.m_HaveDayLimit ? sc.m_DayLimit - buytimes : 1); } } else { UnityEngine.GameObject go = GetAGameObject(); NGUITools.SetActive(go, true); if (go != null) { go.transform.name = string.Format("{0:D5}", storeid); UIEventListener.Get(go).onClick = StoreItemClick; SetGameObjectInfo(go, sc, sc.m_HaveDayLimit ? sc.m_DayLimit - buytimes : 1); storeDic.Add(storeid, new storeInfo(sc.m_HaveDayLimit ? sc.m_DayLimit - buytimes : 1, storeid, go)); } } } }
public PersonStore(IOptions <StoreConfig> storeConfig) { _storeConfig = storeConfig.Value; CloudStorageAccount storageAccount; storageAccount = CloudStorageAccount.Parse(_storeConfig.ConnectionString); _tableClient = storageAccount.CreateCloudTableClient(); _tableNamePrefix = _storeConfig.TableNamePrefix; }
private void LoadImplementationDirs() { var allImplDirs = StoreConfig.GetImplementationDirs().ToList(); listBoxImplDirs.Items.AddRange(allImplDirs.Cast <object>().ToArray()); var userImplDirs = StoreConfig.GetUserImplementationDirs(); _lockedImplDirs = allImplDirs.Except(userImplDirs).ToList(); }
public EventReceiver(IStoreProcesor storeProcessor, Checkpoint checkpoint, StoreConfig storeConfig, ILogger <EventReceiver> logger) { _completions = new ConcurrentDictionary <string, TaskCompletionSource <bool> >(); _logger = logger; _checkpoint = checkpoint; _storeProcessor = storeProcessor; _storeConfig = storeConfig; _eventCount = 0; }
/// <summary> /// Creates the store to provide to clients as a service. /// </summary> /// <exception cref="IOException">A cache directory could not be created or the underlying filesystem can not store file-changed times accurate to the second.</exception> /// <exception cref="UnauthorizedAccessException">Creating a cache directory is not permitted.</exception> private MarshalByRefObject CreateStore() { var identity = WindowsIdentity.GetCurrent(); Debug.Assert(identity != null); var paths = StoreConfig.GetImplementationDirs(serviceMode: true); var stores = paths.Select(path => new SecureStore(path, identity, eventLog)).Cast <IStore>(); return(new CompositeStore(stores)); }
protected void SetImplementationDirs([NotNull] IEnumerable <string> paths) { if (MachineWide) { StoreConfig.SetMachineWideImplementationDirs(paths); } else { StoreConfig.SetUserImplementationDirs(paths); } }
/// <summary> /// Load from file /// </summary> public static void Load() { try { CurrentStoreConfig = StoreHelper.Load(); //CurrentToolConfig = StoreHelper.ConvertToToolConfig(CurrentStoreConfig); } catch (Exception ex) { Trace.Fail(ex.Message + ex.StackTrace); } }
public EventSender(EventReceiver receiver, Checkpoint checkpoint, StoreConfig storeConfig) { _storeReceiver = receiver; _checkpoint = checkpoint; _storeConfig = storeConfig; if (_storeConfig.ReplicationIsActive) { _eventHubClient = EventHubClient.CreateFromConnectionString(_storeConfig.EventHubConnectionString); _ = this.StartListeners(); _ = _storeReceiver.LogCount(); } }
public void Create_Model_With_OneProvider() { var config = new StoreConfig().AddModelProvider(new FakeStoreModelProvider()); var model = config.GetStoreModel(); Assert.Single(model.GetStoreEntities()); var entityType = model.GetStoreEntities().First(); Assert.Single(entityType.GetQueryFilters()); Assert.Equal("FakeEntityA", ((StoreEntityType)entityType).Name); }
protected BaseStore( StoreConfig config, ILogger log) { if (config == null) { throw new ArgumentNullException(nameof(config)); } _connString = config.ConnectionString; Log = log ?? throw new ArgumentNullException(nameof(log)); }
public void Can_Remove_StoreEntity() { var config = new StoreConfig(); config.AddModelProvider(new FakeStoreModelProvider()); var model = config.GetStoreModel(); Assert.Single(model.GetStoreEntities()); model.RemoveStoreEntity(typeof(FakeEntityA)); Assert.Empty(model.GetStoreEntities()); }
public EventSender(IQueueContainer queueContainer, EventReceiver storeReceiver, Checkpoint checkpoint, StoreConfig storeConfig) { _storeReceiver = storeReceiver; _queueContainer = queueContainer; _checkpoint = checkpoint; _storeConfig = storeConfig; if (_storeConfig.ReplicationIsActive) { _eventHubClient = EventHubClient.CreateFromConnectionString(_storeConfig.EventHubConnectionString); _ = StartListeners(); _active = true; } }
public void Create_Model_With_TwoProvider_ConfigSameEntity() { var config = new StoreConfig(); config.AddModelProvider(new FakeStoreModelProvider()); config.AddModelProvider(new FakeStoreModelProvider2()); var model = config.GetStoreModel(); Assert.Single(model.GetStoreEntities()); var entityType = model.GetStoreEntities().First(); Assert.Single(entityType.GetQueryFilters()); Assert.Single(entityType.GetIgnoredMembers()); }
/// <summary> /// Internal for testing purposes only /// </summary> internal static ICredentialStore GetStoreForOS(StoreConfig config) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(new Win32CredentialStore()); } #if !WINDOWS_ONLY_BUILD else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(new OSXCredentialStore()); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { return(new LinuxCredentialStore(config)); } #endif throw new InvalidOperationException("Platform not currently supported"); }
internal void ResetByCurrency(int currency) { List <int> removelist = new List <int>(); StoreConfig sc = null; foreach (int key in GoodsBuyData.Keys) { sc = StoreConfigProvider.Instance.GetDataById(key); if (sc != null && sc.m_Currency == currency) { removelist.Add(key); } } foreach (int remove in removelist) { int item; GoodsBuyData.TryRemove(remove, out item); } removelist.Clear(); }
public void Create_Model_With_TwoProvider_ConfigDifferentEntity() { var config = new StoreConfig(); config.AddModelProvider(new FakeStoreModelProvider()); config.AddModelProvider(new FakeStoreModelProvider3()); var model = config.GetStoreModel(); Assert.Equal(2, model.GetStoreEntities().Count()); var entityType = model.FindStoreEntity(typeof(FakeEntityA)); Assert.NotNull(entityType); Assert.Single(entityType.GetQueryFilters()); var entityTypeB = model.FindStoreEntity(typeof(FakeEntityB)); Assert.NotNull(entityTypeB); Assert.Single(entityTypeB.GetIgnoredMembers()); }
public void WhenPassedNewOrder_ShouldBindProperly() { // Arrange var theJson = base.GetJsonFromResource("SampleOrder.json"); var jr = new JsonTextReader(new StringReader(theJson)); var theOrder = JsonSerializer.Create().Deserialize <PixelBot.Relay.Models.Order>(jr); var config = new StoreConfig { Shopify = new List <ShopifyStore> { new ShopifyStore { Key = "testkey_notereal", Name = "test shop" } } }; var options = _Mockery.Create <IOptions <StoreConfig> >(); options.SetupGet(o => o.Value).Returns(config); // Act var sut = new ShopifyController(options.Object, null, null); var result = sut.Post(theOrder); }
/// <summary> /// 生成默认配置 /// </summary> /// <returns></returns> private static StoreConfig GetDefaultConfig() { var cfg = new StoreConfig() { YourName = "Your Name", CompanyName = "Your Company", }; cfg.Configs = new List <StoreItemConfig>(); var it = new StoreItemConfig() { Key = "*.*", }; it.Content = @"//=================================================== // Copyright @ @company @year // 作者:@yourname // 时间:@time // 说明: //=================================================== "; cfg.Configs.Add(it); return(cfg); }
public HomeController(IOptionsSnapshot <StoreConfig> config, StoreContext context) { _config = config.Value; _context = context; }
public static void RunTest(int appCount, int deviceCount, int devicePropertyCount, int sendCount, int senderThreadCount, bool tryOptimizeRocks) { Console.WriteLine("Creating Messages"); var apps = new List <string>(appCount); var deviceIds = new List <string>(deviceCount); var devicePropertyNames = new List <string>(devicePropertyCount); var tasks = new List <Task>(); var sendQueue = new ConcurrentQueue <StoreEvent>(); while (apps.Count < appCount) { apps.Add(Guid.NewGuid().ToString()); } while (deviceIds.Count < deviceCount) { deviceIds.Add(Guid.NewGuid().ToString()); } while (devicePropertyNames.Count < devicePropertyCount) { devicePropertyNames.Add(Guid.NewGuid().ToString()); } using (var testFolder = new TestFolder()) { var factory = LoggerFactory.Create(builder => builder.AddConsole()); var logger = factory.CreateLogger <RocksGraphProvider>(); var storeLogger = factory.CreateLogger <StoreProcessor>(); var dbOptions = new DbOptions(); var provider = !tryOptimizeRocks ? new RocksGraphProvider(logger, testFolder) : new RocksGraphProvider(logger, testFolder, dbOptions.SetCreateIfMissing(true) .SetAllowConcurrentMemtableWrite(true) //.SetAllowMmapReads(true) //.SetAllowMmapWrites(true) //.SetUseFsync(0) .IncreaseParallelism(Environment.ProcessorCount) .SetMaxBackgroundCompactions(Environment.ProcessorCount) .SetMaxBackgroundFlushes(Environment.ProcessorCount)); var storeProvider = new SetProvider(provider); var storeProcessor = new StoreProcessor(storeProvider, new Reasoner(), storeLogger); var storeConfig = new StoreConfig(); var storeError = new StoreError(); var eventReceiver = new EventReceiver(storeProcessor, null, storeConfig, factory.CreateLogger <EventReceiver>()); var queueContainer = new QueueContainer(eventReceiver, factory.CreateLogger <QueueContainer>(), storeError, 1_000_000); var eventSender = new EventSender(queueContainer, null, null, storeConfig); for (var i = 0; i < sendCount; i++) { foreach (var id in deviceIds) { foreach (var app in apps) { var points = GetPropertyValues(devicePropertyNames, _random); var e = new StoreEvent { Operation = EventType.PATCH_JSON, Data = JsonGenerator.GenerateTelemetry(id, points), PartitionId = id, StoreId = app }; sendQueue.Enqueue(e); } } } Console.WriteLine($"Starting send of {sendQueue.Count} messages"); var timer = Stopwatch.StartNew(); for (var i = 0; i < senderThreadCount; i++) { tasks.Add(Task.Run(() => RunSender(eventSender, sendQueue))); } Task.WhenAll(tasks).Wait(); Console.WriteLine($"Completed writing to queues in {timer.Elapsed}"); while (queueContainer.Count() > 0) { Thread.Sleep(1000); } Console.WriteLine($"Completed writing to storage in {timer.Elapsed}"); } }
/// <summary> /// 保存到配置文件 /// </summary> /// <param name="cfg"></param> public static void Save(StoreConfig cfg) { SerializeHelper.ToXmlFile(cfg, Constants.ConfigFilePath); }
public ConvenientStoreRepository(IOptions <StoreConfig> config) { _storeConfig = config.Value; }
/// <summary> /// Internal for testing purposes only /// </summary> internal CredentialService(ICredentialStore store, StoreConfig config) { this.credStore = store != null ? store : GetStoreForOS(config); }
void ManageExchangeGoods(int currency, bool refresh, ArkCrossEngine.Network.GeneralOperationResult result, int exchangeid, int exchangenum) { try { GfxSystem.PublishGfxEvent("ge_ui_connect_hint", "ui", false, false); if (currency != currencyId && currency != 0) { return; } if (refresh) { if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Succeed) { DataDictionaryMgr <StoreConfig> storedata = ArkCrossEngine.StoreConfigProvider.Instance.StoreDictionaryMgr; if (storedata != null) { MyDictionary <int, object> storedic = storedata.GetData(); if (storedic != null) { StoreConfig sc = null; foreach (KeyValuePair <int, object> pair in storedic) { sc = pair.Value as StoreConfig; if (sc != null) { if (sc.m_Currency == currencyId || (currency == 0 && sc.m_Currency == currencyId)) { AddItem(pair.Key, 0); } } } } } } else if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_CostError) { ArkCrossEngine.LogicSystem.EventChannelForGfx.Publish("ge_show_dialog", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(123), ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(140), null, null, null, false); } } else { if (result == ArkCrossEngine.Network.GeneralOperationResult.LC_Succeed) { AddItem(exchangeid, exchangenum); ArkCrossEngine.StoreConfig sc = ArkCrossEngine.StoreConfigProvider.Instance.GetDataById(exchangeid); if (sc != null) { ArkCrossEngine.ItemConfig ic = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(sc.m_ItemId); if (ic != null) { GfxSystem.PublishGfxEvent("ge_screen_tip", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(1005) + ic.m_ItemName + "X" + sc.m_ItemNum, UIScreenTipPosEnum.AlignCenter, UnityEngine.Vector3.zero); } } } else { //提示 int sign = 1003; switch (result) { case ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_CostError: sign = 1000; break; case ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_Overflow: sign = 1001; break; case ArkCrossEngine.Network.GeneralOperationResult.LC_Failure_LevelError: sign = 1002; break; default: sign = 1003; break; } GfxSystem.PublishGfxEvent("ge_screen_tip", "ui", ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(sign), UIScreenTipPosEnum.AlignCenter, UnityEngine.Vector3.zero); } } UIGrid ug = gridGo.GetComponent <UIGrid>(); if (ug != null) { ug.repositionNow = true; } } catch (Exception ex) { ArkCrossEngine.LogicSystem.LogFromGfx("[Error]:Exception:{0}\n{1}", ex.Message, ex.StackTrace); } }
public SigningKeyStore( StoreConfig config, ILogger <SigningKeyStore> log) : base(config, log) { }
public PersistedGrantStore( StoreConfig config, ILogger <PersistedGrantStore> log) : base(config, log) { }
/// <summary> /// Creates a DataStore instance. /// <p> /// Subclasses can override this method to provide a specific DataStore implementation /// such as DynamicDataStore and IndexedDataStore or provide a specific SegmentFactory /// such as ChannelSegmentFactory, MappedSegmentFactory and WriteBufferSegment. /// </summary> /// <param name="homeDir">the home directory of DataStore.</param> /// <param name="initialCapacity">the initial capacity of DataStore.</param> /// <returns>The data store</returns> protected StaticDataStore CreateDataStore(File homeDir, int initialCapacity) { var config = new StoreConfig(homeDir, initialCapacity); config.setSegmentFactory(new MemorySegmentFactory()); config.setSegmentFileSizeMB(32); return StoreFactory.createStaticDataStore(config); }
void SetGameObjectInfo(UnityEngine.GameObject goc, StoreConfig sc, int remaintimes) { if (goc != null && sc != null) { ItemConfig ic = ArkCrossEngine.ItemConfigProvider.Instance.GetDataById(sc.m_ItemId); if (ic != null) { UnityEngine.Transform tf = goc.transform.Find("name"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { ul.text = ic.m_ItemName; UnityEngine.Color col = new UnityEngine.Color(); switch (ic.m_PropertyRank) { case 1: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; case 2: col = new UnityEngine.Color(0x00 / 255f, 0xfb / 255f, 0x4a / 255f); break; case 3: col = new UnityEngine.Color(0x41 / 255f, 0xc0 / 255f, 0xff / 255f); break; case 4: col = new UnityEngine.Color(0xff / 255f, 0x00 / 255f, 0xff / 255f); break; case 5: col = new UnityEngine.Color(0xff / 255f, 0xa3 / 255f, 0x00 / 255f); break; default: col = new UnityEngine.Color(1.0f, 1.0f, 1.0f); break; } ul.color = col; } } //if (sc.m_HaveDayLimit) { DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Store_item, goc, sc.m_ItemId, sc.m_ItemNum); // } else { // DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Store_item, goc, sc.m_ItemId); // } // tf = goc.transform.Find("kuang"); // if (tf != null) { // UISprite us = tf.gameObject.GetComponent<UISprite>(); // if (us != null) { // us.spriteName = "SEquipFrame" + ic.m_PropertyRank; // } // } // tf = tf.Find("UnityEngine.Texture"); // if (tf != null) { // UITexture ut = tf.gameObject.GetComponent<UITexture>(); // if (ut != null) { // UnityEngine.Texture tt = GamePokeyManager.GetTextureByPicName(ic.m_ItemTrueName); // if (tt != null) { // ut.mainTexture = tt; // } // } // } //// tf = goc.transform.Find("kuang/number"); //// if (tf != null) { //// UILabel ul = tf.gameObject.GetComponent<UILabel>(); //// if (ul != null) { //// ul.text = sc.m_ItemNum.ToString(); //// } //// } // tf = goc.transform.Find("kuang/Limit"); // if (tf != null) { // UILabel ul = tf.gameObject.GetComponent<UILabel>(); // if (ul != null) { //if (sc.m_HaveDayLimit) { // ul.text = "" + remaintimes/* + "/" + sc.m_DayLimit*/; //} else { // ul.text = "" /*+ ArkCrossEngine.StrDictionaryProvider.Instance.GetDictString(1004)*/; //} // } // } tf = goc.transform.Find("Price/Label"); if (tf != null) { UILabel ul = tf.gameObject.GetComponent <UILabel>(); if (ul != null) { int price = 0; if (sc.m_HaveDayLimit) { if (sc.m_Price.Count > (sc.m_DayLimit - remaintimes)) { price = sc.m_Price[sc.m_DayLimit - remaintimes]; } if (sc.m_Price.Count == (sc.m_DayLimit - remaintimes)) { price = sc.m_Price[sc.m_Price.Count - 1]; } } else { price = sc.m_Price[0]; } ul.text = price.ToString(); if (lastcurrency < price) { ul.color = UnityEngine.Color.red; } else { ul.color = new UnityEngine.Color(131 / 255f, 67 / 255f, 0f); } } } tf = goc.transform.Find("SellOut"); if (tf != null) { if (sc.m_HaveDayLimit && remaintimes <= 0) { NGUITools.SetActive(tf.gameObject, true); } else { NGUITools.SetActive(tf.gameObject, false); } } tf = goc.transform.Find("Matte"); if (tf != null) { if (sc.m_HaveDayLimit && remaintimes <= 0) { NGUITools.SetActive(tf.gameObject, true); } else { NGUITools.SetActive(tf.gameObject, false); } } tf = goc.transform.Find("Price/Currency"); if (tf != null) { UISprite us = tf.gameObject.GetComponent <UISprite>(); if (us != null) { us.spriteName = currencySprite; } } } } }
internal GeneralOperationResult CheckOKBuy(int id, StoreConfig sc, int exchangecurrency, out int currency) { currency = 0; if (sc != null) { if (sc.m_HaveDayLimit) { int val; if (GoodsBuyData.TryGetValue(id, out val)) { if (sc.m_DayLimit > val) { if (sc.m_Price.Count > val) { if (exchangecurrency >= sc.m_Price[val]) { currency = sc.m_Price[val]; return(GeneralOperationResult.LC_Succeed); } else { return(GeneralOperationResult.LC_Failure_CostError); } } else { return(GeneralOperationResult.LC_Failure_LevelError); } } else { return(GeneralOperationResult.LC_Failure_Overflow); } } else { if (exchangecurrency >= sc.m_Price[0]) { currency = sc.m_Price[0]; return(GeneralOperationResult.LC_Succeed); } else { return(GeneralOperationResult.LC_Failure_CostError); } } } else { if (exchangecurrency >= sc.m_Price[0]) { currency = sc.m_Price[0]; return(GeneralOperationResult.LC_Succeed); } else { return(GeneralOperationResult.LC_Failure_CostError); } } } else { return(GeneralOperationResult.LC_Failure_Unknown); } }