Ejemplo n.º 1
0
 protected ResourceBase(JournaledSystem journaledSystem, long id, string name, IStoreData data)
 {
     JournaledSystem = journaledSystem;
     this.id         = id;
     Name            = name;
     Data            = data;
 }
Ejemplo n.º 2
0
 protected ResourceBase(JournaledSystem journaledSystem, long id, string name, IStoreData data)
 {
     JournaledSystem = journaledSystem;
     this.id = id;
     Name = name;
     Data = data;
 }
Ejemplo n.º 3
0
        public QueryDataStore(IStoreData<object> dataStore)
        {
            if (dataStore == null)
            {
                throw new ArgumentNullException("dataStore");
            }

            this.dataStore = dataStore;
        }
Ejemplo n.º 4
0
    void Start()
    {
        _storeData    = GetStoreData();
        _gamePassport = new GamePassport(_storeData);
        _gamePassport.ResetProgress();
        Debug.Log($"Current Level: {_gamePassport.GetLevel()}");
        _levelProvider = new LevelProvider(_gamePassport);

        ShowMenu();
    }
Ejemplo n.º 5
0
 public ItemService(IConfig config,
                    IVendorData vendorData,
                    IStoreData storeData,
                    IItemData itemData)
 {
     _config     = config;
     _vendorData = vendorData;
     _storeData  = storeData;
     _itemData   = itemData;
 }
 public VendorService(IVendorData vendorData,
                      IItemData itemData,
                      IStoreData storeData,
                      IConfig config)
 {
     _vendorData = vendorData;
     _itemData   = itemData;
     _storeData  = storeData;
     _config     = config;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JournaledResource"/> class having a
        /// unique given name, unique identifier and an object that provides access to
        /// the backing data of the resource.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="id">The identifier.</param>
        /// <param name="storeData">The store data.</param>
        /// <exception cref="System.ArgumentNullException">
        /// storeData
        /// or
        /// name
        /// </exception>
        protected JournaledResource(string name, long id, IStoreData storeData)
        {
            if (storeData == null)
                throw new ArgumentNullException("storeData");
            if (String.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            Name = name;
            Id = id;
            StoreData = storeData;
        }
Ejemplo n.º 8
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (Data != null)
                {
                    Data.Dispose();
                }
            }

            Data = null;
        }
        public StoreDataServiceTests()
        {
            runner = MongoDbRunner.Start();
            var mongoService = new MongoService(
                new MongoClient(runner.ConnectionString),
                Options.Create(new MongoDBConfiguration()
            {
                DatabaseName    = "TestMachine",
                EventCollection = "TestEvents"
            }),
                LoggerUtilsMoq.Logger <MongoService>()
                );

            storeData = new StoreDataService(mongoService, LoggerUtilsMoq.Logger <StoreDataService>());
        }
Ejemplo n.º 10
0
        private PasswordStore(IStoreData storeData)
        {
            _disposed  = false;
            _storeData = storeData;
            _userInfos = _storeData.Load <List <UserInfo> >(_connectionString);
            if (_userInfos == null)
            {
                _userInfos = new List <UserInfo>();
                _nextId    = 1000;
                return;
            }

            _nextId = _userInfos
                      .FindLast(u => u != null)
                      .Id;
        }
 public WebStoreRobustConnector(IConfigSource config, IHttpServer server, string configName)
     : base(config, server, configName)
 {
     if (configName != string.Empty)
     {
         m_ConfigName = configName;
     }
     IConfig config2 = config.Configs["WebStore"];
     if (config2 == null)
     {
         this.m_Enabled = false;
         WebStoreRobustConnector.m_log.DebugFormat("[Web.Store.Robust.Connector]: Configuration Error Not Enabled", new object[0]);
         return;
     }
     this.m_Enabled = true;
     string @string = config2.GetString("StorageProvider", string.Empty);
     string string2 = config2.GetString("ConnectionString", string.Empty);
     string string3 = config2.GetString("Realm", "store_transactions");
     string string4 = config2.GetString("GridService", string.Empty);
     string string5 = config2.GetString("UserAccountService", string.Empty);
     string string6 = config2.GetString("PresenceService", string.Empty);
     if (@string == string.Empty || string2 == string.Empty || string4 == string.Empty || string5 == string.Empty || string6 == string.Empty)
     {
         this.m_Enabled = false;
         WebStoreRobustConnector.m_log.ErrorFormat("[Web.Store.Robust.Connector]: missing service specifications Not Enabled", new object[0]);
         return;
     }
     object[] args = new object[]
     {
         config
     };
     this.m_GridService = ServerUtils.LoadPlugin<IGridService>(string4, args);
     this.m_UserAccountService = ServerUtils.LoadPlugin<IUserAccountService>(string5, args);
     this.m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(string6, args);
     this.m_Database = ServerUtils.LoadPlugin<IStoreData>(@string, new object[]
     {
         string2,
         string3
     });
     this.m_Funcs = new Functions();
     WebStoreRobustConnector.m_log.DebugFormat("[Web.Store.Robust.Connector]: Initialzing", new object[0]);
     if (MainConsole.Instance != null)
     {
         MainConsole.Instance.Commands.AddCommand("Debug", false, "Web Store Debug", "Web Store Debug <true|false>", "This setting turns on Web Store Debug", new CommandDelegate(this.HandleDebugStoreVerbose));
     }
     server.AddXmlRPCHandler("ProcessTransaction", new XmlRpcMethod(this.ProcessTransaction));
 }
Ejemplo n.º 12
0
    //TODO Make the special class for that
    private IStoreData GetStoreData()
    {
        string     json      = PlayerPrefs.GetString("GAME_DATA");
        IStoreData storeData = JsonUtility.FromJson <StoreDataPrefs>(json);

        if (storeData == null)
        {
            storeData = new StoreDataPrefs();
        }
        storeData.Init(
            () =>
        {
            string jsn = JsonUtility.ToJson(storeData);
            PlayerPrefs.SetString("GAME_DATA", jsn);
        });
        return(storeData);
    }
 /// <summary>
 /// Constructor used by the DI
 /// </summary>
 /// <param name="storeEvents">The service used to store the data</param>
 /// <param name="optionsWebScoket">The IOptions that contains the web socket configurations</param>
 /// <param name="logger">The injected logger</param>
 public WebSocketService(IStoreData storeEvents, IOptions <WebSocketConfiguration> optionsWebScoket, ILogger <WebSocketService> logger)
 {
     this.logger            = logger;
     webSocketConfiguration = optionsWebScoket.Value;
     //with these options the socket will never go over the 60 seconds timeout
     socketOptions = new PureWebSocketOptions()
     {
         DebugMode           = webSocketConfiguration.DebugMode,
         SendDelay           = webSocketConfiguration.SendDelay,
         MyReconnectStrategy = new ReconnectStrategy(
             webSocketConfiguration.MinReconnectInterval,
             webSocketConfiguration.MaxReconnectInterval,
             null
             )
     };
     this.storeEvents = storeEvents;
 }
Ejemplo n.º 14
0
            public LoggingResource(JournalingSystem system, string name, long id, IStoreData storeData)
                : base(system, name, id, storeData)
            {
                journalEntries = new JournalEntry[257];
                dataOpen = false;
                dataExists = storeData.Exists;
                dataDeleted = false;

                if (dataExists) {
                    try {
                        size = storeData.Length;
                    } catch (IOException e) {
                        throw new Exception("Error getting size of resource: " + e.Message, e);
                    }
                }

                isOpen = false;
            }
        public ConsignmentShop(IStoreData storeData,
                               IVendorData vendorData,
                               IItemData itemData,
                               IConfig config,
                               IItemService itemService,
                               ItemMaintFormFactory itemMaintFormFactory,
                               VendorMaintFormFactory vendorMaintFormFactory)
        {
            InitializeComponent();

            _storeData              = storeData;
            _vendorData             = vendorData;
            _itemData               = itemData;
            _config                 = config;
            _itemService            = itemService;
            _itemMaintFormFactory   = itemMaintFormFactory;
            _vendorMaintFormFactory = vendorMaintFormFactory;
        }
Ejemplo n.º 16
0
        public LoggingResource(JournaledSystem journaledSystem, long id, string name, IStoreData data)
            : base(journaledSystem, id, name, data)
        {
            journalMap = new JournalEntry[257];
            dataOpen = false;
            dataExists = data.Exists;
            dataDeleted = false;

            if (dataExists) {
                try {
                    size = data.Length;
                } catch (IOException e) {
                    throw new Exception("Error getting size of resource: " + e.Message);
                }
            }

            reallyOpen = false;
            pageBuffer = new byte[journaledSystem.PageSize];
        }
Ejemplo n.º 17
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            DateTime now = DateTime.Now;

            if (PLC.Module != null && PLC.Module.Pelecek.IsConnected == true)
            {
                bool temp = Convert.ToBoolean(PLC.Module.ReadModule(windowData.CommunicationBit));
                PLC.Module.WriteToPLC(windowData.CommunicationBit, !temp);

                if (!temp == Convert.ToBoolean(PLC.Module.ReadModule(windowData.CommunicationBit)))
                {
                    windowData.ConnectionString = "Connected";
                }
                else
                {
                    windowData.ConnectionString = "Connection lost... Reconnecting.";
                    timer.Stop();
                    connectButton_Click("Reconnect", new RoutedEventArgs());
                    return;
                }
            }


            if (windowData.ExecuteIntProgram)
            {
                interpreter.Interpret(windowData.InterpreterText, PLC);
                windowData.IntResult = interpreter.RLOobtain();
            }

            string fLocation = FileLocationTextBox.Text;

            #region Uploading data to storage location
            Task.Factory.StartNew(() =>
            {
                object[] values      = new object[windowData.RVariables.Count];
                IStoreData dataStore = null;
                if (storeData)
                {
                    if (windowData.LocationType == StorageLocation.LocalFile)
                    {
                        dataStore = new LocalFileCommunication(fLocation);

                        if (String.IsNullOrEmpty(fLocation))
                        {
                            startTimeButton_Click("NonFile", new RoutedEventArgs());
                        }
                    }
                    else if (windowData.LocationType == StorageLocation.DataBase)
                    {
                        dataStore = new DBCommunication();
                    }
                }

                List <DataTable> readings = new List <DataTable>();

                for (int i = 0; i < windowData.RVariables.Count; i++)
                {
                    values[i] = PLC.Module.ReadModule(windowData.RVariables[i].Variable);
                    readings.Add(new DataTable()
                    {
                        VariableName  = windowData.RVariables[i].Variable,
                        VariableValue = windowData.RVariables[i].Value.ToString() == "ReadError" ? 0 : Convert.ToInt32(windowData.RVariables[i].Value),
                        Time          = now
                    });
                }

                if (windowData.IntResult != null && windowData.ExecuteIntProgram)
                {
                    readings.Add(new DataTable()
                    {
                        VariableName  = "interpreter",
                        VariableValue = Convert.ToInt32(windowData.IntResult),
                        Time          = now
                    });
                }

                dataStore?.StoreData(readings);

                Dispatcher.BeginInvoke(new Action(delegate()
                {
                    for (int i = 0; i < windowData.RVariables.Count; i++)
                    {
                        windowData.RVariables[i] = new rVariable(windowData.RVariables[i].Variable, values[i]);
                    }
                }));
            });

            #endregion
        }
Ejemplo n.º 18
0
 public NonLoggingResource(JournaledSystem journaledSystem, long id, string name, IStoreData data)
     : base(journaledSystem, id, name, data)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Метод получения кеша из биндинга
 /// </summary>
 /// <param name="kernel">Ядро нинжекта</param>
 public static void GetStoreDataFromKernel(IKernel kernel)
 {
     mcache       = kernel.Get <IStoreData>();
     localization = mcache.GetData <LocalizationModel>(ConstantStrings.Localization);
 }
Ejemplo n.º 20
0
 public GamePassport(IStoreData storeData)
 {
     _storeData = storeData;
 }
Ejemplo n.º 21
0
 public NonLoggingResource(JournaledSystem journaledSystem, long id, string name, IStoreData data)
     : base(journaledSystem, id, name, data)
 {
 }
Ejemplo n.º 22
0
 public FetchService(IAPIRestClient restClient, IStoreData storetData, IStoreReadWrite readWrite)
 {
     this.restClient = restClient;
     this.storeData  = storetData;
     this.readWrite  = readWrite;
 }
Ejemplo n.º 23
0
 public Game(IStoreData storeData, IRunTheGame runTheGame, IGameResult gameResult)
 {
     _storeData  = storeData;
     _runTheGame = runTheGame;
     _gameResult = gameResult;
 }
Ejemplo n.º 24
0
 public NonLoggingResource(JournalingSystem system, string name, long id, IStoreData storeData)
     : base(system, name, id, storeData)
 {
 }
Ejemplo n.º 25
0
 protected ResourceBase(JournalingSystem system, string name, long id, IStoreData storeData)
     : base(name, id, storeData)
 {
     System = system;
 }
 /// <summary>
 /// Constructor to setup required objects
 /// </summary>
 public StoreReadWrite()
 {
     fileStore = new StoreData();
 }
 /// <summary>
 /// Constructor to setup required objects
 /// </summary>
 /// <param name="storeData">Store data object to use</param>
 public StoreReadWrite(IStoreData storeData)
 {
     this.fileStore = storeData;
 }
Ejemplo n.º 28
0
        public LoggingResource(JournaledSystem journaledSystem, long id, string name, IStoreData data)
            : base(journaledSystem, id, name, data)
        {
            journalMap  = new JournalEntry[257];
            dataOpen    = false;
            dataExists  = data.Exists;
            dataDeleted = false;

            if (dataExists)
            {
                try {
                    size = data.Length;
                } catch (IOException e) {
                    throw new Exception("Error getting size of resource: " + e.Message);
                }
            }

            reallyOpen = false;
            pageBuffer = new byte[journaledSystem.PageSize];
        }
Ejemplo n.º 29
0
 public AstoreController(IStoreData _storeData)
 {
     storeData = _storeData;
 }
Ejemplo n.º 30
0
 public FetchService()
 {
     restClient = new APIRestClient();
     storeData  = new StoreData();
     readWrite  = new StoreReadWrite(storeData);
 }
Ejemplo n.º 31
0
 public void Initialise(IConfigSource config)
 {
     IConfig config2 = config.Configs ["WebStore"];
     if (config2 != null) {
         StoreModule.m_log.Debug ("[Web.Store Region Module]: Initializing..");
         m_Enabled = true;
         string @string = config2.GetString ("StorageProvider", "");
         string string2 = config2.GetString ("ConnectionString", "");
         string string3 = config2.GetString ("Realm", "store_transactions");
         this.m_Funcs = new Functions ();
         if (@string == string.Empty || string2 == string.Empty) {
             m_Enabled = false;
             m_log.ErrorFormat ("[Web.Store.Region.Module]: missing service specifications Not Enabled", new object[0]);
             return;
         }
         m_Database = ServerUtils.LoadPlugin<IStoreData> (@string, new object[]
         {
             string2,
             string3
         });
         MainConsole.Instance.Commands.AddCommand ("Debug", false, "Web Store Debug", "Web Store Debug <true|false>", "This setting turns on Web Store Debug", new CommandDelegate (this.HandleDebugStoreVerbose));
     }
 }
Ejemplo n.º 32
0
 protected virtual void Dispose(bool disposing)
 {
     StoreData = null;
 }
Ejemplo n.º 33
0
 public void Setup()
 {
     storeData = new StoreData();
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Метод получения кеша из биндинга
 /// </summary>
 /// <param name="kernel">Ядро нинжекта</param>
 public static void GetStoreDataFromKernel(IKernel kernel) => mcache = kernel.Get <IStoreData>();