示例#1
0
 public ConfigContainer(ICacheHandler cacheHandler, IConfigStorage storage, IModuleCollection moduleCollection, ILogger <ConfigContainer> logger)
 {
     _cacheHandler     = cacheHandler;
     _storage          = storage;
     _moduleCollection = moduleCollection;
     _logger           = logger;
 }
示例#2
0
        public override void LoadFrom(IConfigStorage from)
        {
            object res = from.ReadVal <string>(Name);

            Value  = res != null ? (string)res :_def;
            _saved = Value;
        }
示例#3
0
 /// <summary>
 /// Loads all currently registered values from a config storage.
 /// </summary>
 public void LoadFrom(IConfigStorage from)
 {
     foreach (ConfValue v in _values)
     {
         v.LoadFrom(from);
     }
 }
示例#4
0
 public void Inject(IContainer container)
 {
     _configStorage         = container.Get <IConfigStorage>();
     _eventManager          = container.Get <IUnityEventManager>();
     _prefabsPoolingService = container.Get <IPrefabsPoolingService>();
     // container.Get<ICharacterManager>().HandleExplosion
 }
 public void Inject(IContainer container)
 {
     _playerTargetingService = container.Get <IPlayerTargetingService>();
     _playerMovementService  = container.Get <IPlayerMovementService>();
     _playerCollisionService = container.Get <IPlayerCollisionService>();
     _gameStateManager       = container.Get <IGameStateManager>();
     _configStorage          = container.Get <IConfigStorage>();
 }
示例#6
0
        /// <summary>
        /// Saves all handled values to a config storage
        /// </summary>
        public void SaveTo(IConfigStorage to)
        {
            foreach (ConfValue v in _values)
            {
                v.SaveTo(to);
            }

            to.Save();
        }
示例#7
0
        public void testSavingThroughEvents()
        {
            AssertEquals(paperCount.Value, 10);
            AssertEquals(lunchType.Value, LunchType.luBreakfast);

            IConfigStorage temp = cfg;

            paperCount.Value = 2;
            lunchType.Value  = LunchType.luMeal;
            ConfValuesManager.GetInstance().SaveTo(temp);
            paperCount.Value = 3;
            lunchType.Value  = LunchType.luDinner;
            ConfValuesManager.GetInstance().LoadFrom(temp);
            AssertEquals(paperCount.Value, 2);
            AssertEquals(lunchType.Value, LunchType.luMeal);


            AssertEquals(bearName.Value, "Teddy");
        }
示例#8
0
        public PCLocalService(IConfigStorage configStorage, ILoggerFactory logfac, VirtualFileSystem fileSystem, string extraWebPath)
        {
            ExtraWebPath = extraWebPath;

            ConfigStorage = configStorage;
            FileSystem    = fileSystem;
            loggerFactory = logfac;
#pragma warning disable CA1062 // Validate arguments of public methods
            logger = loggerFactory.CreateLogger("PCLocalService");
#pragma warning restore CA1062 // Validate arguments of public methods

            KnownNodes                 = new Dictionary <string, NodeInfo>();
            sharedPCs                  = new List <NodeShareInfo>();
            httpclient                 = new HttpClient();
            httpclient.Timeout         = TimeSpan.FromSeconds(10);
            nodeDiscovery              = new NodeDiscovery(logfac);
            nodeDiscovery.OnNodeAdded += NodeDiscovery_OnNodeAdded;
            nodeDiscovery.OnError     += (o, e) => OnError?.Invoke(this, new ServiceErrorEventArgs(e));
            fetchQueue                 = new List <FetchQueueItem>();

            var cfg = LoadConfiguration();
            ServerPort = cfg.Port;
#pragma warning disable CA1305 // Specify IFormatProvider
            NodeId = cfg.Id.ToString("N");
#pragma warning restore CA1305 // Specify IFormatProvider

            LoadPCList();
            foreach (var item in _PersonalClouds)
            {
                item.ResyncClientList();
            }
            fetchCloudInfo = new ActionBlock <NodeInfo>(GetNodeClodeInfo, new ExecutionDataflowBlockOptions()
            {
                MaxDegreeOfParallelism = 3
            });
            InitWebServer();
        }
示例#9
0
 public CustomConfig(ConfigMode mode, IConfigSource defaultSource, IConfigStorage storage)
 {
     _mode    = mode;
     _default = defaultSource;
     _storage = storage;
 }
 public void Inject(IContainer container)
 {
     _gameStateManager = container.Get <IGameStateManager>();
     _configs          = container.Get <IConfigStorage>();
 }
示例#11
0
 public SafeConfigStorage(IConfigStorage origin)
 {
     _origin = origin;
 }
示例#12
0
 public void Inject(IContainer container)
 {
     _configStorage = container.Get <IConfigStorage>();
 }
示例#13
0
 /// <summary>
 /// Implement this method to provide a way to save the value to a IConfigStorage
 /// </summary>
 /// <param name="to">The storage to write this value to </param>
 public abstract void SaveTo(IConfigStorage to);
示例#14
0
 public ConfigContainer(ICacheHandler cacheHandler, IConfigStorage storage)
 {
     _cacheHandler = cacheHandler;
     _storage      = storage;
 }
示例#15
0
 public ValidatedConfigStorage(IConfigStorage origin)
 {
     _origin = origin;
 }
示例#16
0
 /// <summary>
 /// Sets a IConfigStorage instance to use to load values of newly created variables from.
 /// </summary>
 public void SetStorage(IConfigStorage a)
 {
     _savedStorage = a;
 }
示例#17
0
 public void TestInitialize()
 {
     _default = Substitute.For <IConfigSource>();
     _storage = Substitute.For <IConfigStorage>();
 }
示例#18
0
 public override void SaveTo(IConfigStorage to)
 {
     to.WriteVal(Name, val);
     _saved = val;
 }
示例#19
0
 /// <summary>
 /// Implement this method to provide a way to load the value of this class from a storage
 /// </summary>
 /// <param name="from">The storage to read this value from</param>
 public abstract void LoadFrom(IConfigStorage from);
示例#20
0
 public override void SaveTo(IConfigStorage to)
 {
     to.WriteVal(Name, Value);
     _saved = Value;
 }
示例#21
0
 public void Inject(IContainer container)
 {
     _configStorage         = container.Get <IConfigStorage>();
     _eventManager          = container.Get <IUnityEventManager>();
     _prefabsPoolingService = container.Get <IPrefabsPoolingService>();
 }
示例#22
0
 public void TestInitialize()
 {
     _origin = Substitute.For <IConfigStorage>();
 }
示例#23
0
		public MemoryStorage(IConfigStorage parent = null)
		{
			Parent = parent;
		}