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

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

        ShowMenu();
    }
Beispiel #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;
 }
Beispiel #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;
        }
        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>());
        }
Beispiel #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));
 }
Beispiel #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;
 }
Beispiel #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;
        }
Beispiel #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];
        }
Beispiel #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
        }
Beispiel #18
0
 public NonLoggingResource(JournaledSystem journaledSystem, long id, string name, IStoreData data)
     : base(journaledSystem, id, name, data)
 {
 }
Beispiel #19
0
 /// <summary>
 /// Метод получения кеша из биндинга
 /// </summary>
 /// <param name="kernel">Ядро нинжекта</param>
 public static void GetStoreDataFromKernel(IKernel kernel)
 {
     mcache       = kernel.Get <IStoreData>();
     localization = mcache.GetData <LocalizationModel>(ConstantStrings.Localization);
 }
Beispiel #20
0
 public GamePassport(IStoreData storeData)
 {
     _storeData = storeData;
 }
Beispiel #21
0
 public NonLoggingResource(JournaledSystem journaledSystem, long id, string name, IStoreData data)
     : base(journaledSystem, id, name, data)
 {
 }
Beispiel #22
0
 public FetchService(IAPIRestClient restClient, IStoreData storetData, IStoreReadWrite readWrite)
 {
     this.restClient = restClient;
     this.storeData  = storetData;
     this.readWrite  = readWrite;
 }
Beispiel #23
0
 public Game(IStoreData storeData, IRunTheGame runTheGame, IGameResult gameResult)
 {
     _storeData  = storeData;
     _runTheGame = runTheGame;
     _gameResult = gameResult;
 }
Beispiel #24
0
 public NonLoggingResource(JournalingSystem system, string name, long id, IStoreData storeData)
     : base(system, name, id, storeData)
 {
 }
Beispiel #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;
 }
Beispiel #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];
        }
Beispiel #29
0
 public AstoreController(IStoreData _storeData)
 {
     storeData = _storeData;
 }
Beispiel #30
0
 public FetchService()
 {
     restClient = new APIRestClient();
     storeData  = new StoreData();
     readWrite  = new StoreReadWrite(storeData);
 }
 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));
     }
 }
Beispiel #32
0
 protected virtual void Dispose(bool disposing)
 {
     StoreData = null;
 }
Beispiel #33
0
 public void Setup()
 {
     storeData = new StoreData();
 }
Beispiel #34
0
 /// <summary>
 /// Метод получения кеша из биндинга
 /// </summary>
 /// <param name="kernel">Ядро нинжекта</param>
 public static void GetStoreDataFromKernel(IKernel kernel) => mcache = kernel.Get <IStoreData>();