// Start is called before the first frame update
 private void Start()
 {
     _isInner = true;
     _preview = true;
     _sh      = new StorageHandler();
     ResetTemp();
     _outerImage         = GetComponent <Image>();
     _innerImage         = transform.Find("Player_Inner").GetComponent <Image>();
     picker.CurrentColor = new Color(picker.CurrentColor[0], picker.CurrentColor[1], picker.CurrentColor[2], 1);
     LoadColors();
     _outerImage.color = _tempOuter;
     _innerImage.color = _tempInner;
     picker.onValueChanged.AddListener(color =>
     {
         if (!_preview)
         {
             return;
         }
         if (_isInner)
         {
             LoadColors(outerColor: _tempOuter, innerColor: picker.CurrentColor);
         }
         else
         {
             LoadColors(outerColor: picker.CurrentColor, innerColor: _tempInner);
         }
     });
 }
Ejemplo n.º 2
0
        /// <summary>
        /// OfflineSyncProvider method implementation called when a change set returned from GetChangeSet has been
        /// successfully uploaded.
        /// </summary>
        /// <param name="state">The unique identifier passed in to the GetChangeSet call.</param>
        /// <param name="response">ChangeSetResponse that contains an updated server blob and any conflicts or errors that
        /// happened on the service.</param>
        public override async Task OnChangeSetUploaded(Guid state, ChangeSetResponse response)
        {
            ThrowIfDisposed();

            if (response == null)
            {
                throw new ArgumentNullException("response");
            }

            if (!syncActive)
            {
                throw new InvalidOperationException("OnChangeSetUploaded cannot be called without calling BeginSession");
            }

            if (response.Error == null)
            {
                IEnumerable <OfflineEntity> updatedItems =
                    response.UpdatedItems.Cast <OfflineEntity>();

                // Notify the disk management that changes uploaded successfully.
                IEnumerable <Conflict> conflicts =
                    await StorageHandler.UploadSucceeded(state, response.ServerBlob, response.Conflicts, updatedItems);

                // Update the in-memory representation.
                cacheData.AddUploadChanges(response.ServerBlob, conflicts, updatedItems, this);
            }
            else
            {
                StorageHandler.UploadFailed(state);
            }
        }
Ejemplo n.º 3
0
    // Load actorA saved game
    public void Load()
    {
        print("Loading...");
        StorageHandler sh = new StorageHandler();
        PlayerData     dp = (PlayerData)sh.LoadData("player") as PlayerData;

        _pd = dp;
        PlayerDataTracker pdt = PlayerDataTracker.GetInstance();

        pdt.Dt       = _pd;
        PlayerPrefab = Instantiate(PlayerPrefab, new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY(), pdt.GetPlayerZ()), Quaternion.identity);

        PlayerPrefab.gameObject.name = "Player";
        this.gameObject.GetComponent <EnvironmentColours>().Player = PlayerPrefab;

        C.transform.position = new Vector3(pdt.GetPlayerX(), pdt.GetPlayerY() + 10, pdt.GetPlayerZ());
        C.transform.parent   = PlayerPrefab.transform;

        _dta                   = TempDataTracker.GetInstance();
        _settingsReader        = SettingsReader.GetInstance();
        _cam                   = GameObject.Find("Main Camera");
        _environmentController = EnvironmentController.GetInstance();
        _gm = GeneticsManager.GetInstance();
        _co = CollisionMediator.GetInstance();
        _am = AudioManager.GetInstance();
    }
Ejemplo n.º 4
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            if (playbackComponentRadioButton.Checked)
            {
                PlaybackHandler playbackHandler = new PlaybackHandler(new RichTextBoxOutput(componentTypeMenuRichTextBox));
                playbackHandler.ShowMenuOfPlaybackComponents();
            }

            if (chargerRadioButton.Checked)
            {
                ChargerHandler chargerHandler = new ChargerHandler(new RichTextBoxOutput(componentTypeMenuRichTextBox));
                chargerHandler.ShowMenuOfChargerComponents();
            }

            if (removableStorageRadioButton.Checked)
            {
                StorageHandler storageHandler = new StorageHandler(new RichTextBoxOutput(componentTypeMenuRichTextBox));
                storageHandler.ShowMenuOfStorages();
            }

            if (simCardRadioButton.Checked)
            {
                SimCardHandler simCardHandler = new SimCardHandler(new RichTextBoxOutput(componentTypeMenuRichTextBox));
                simCardHandler.ShowMenuOfSimCards();
            }

            chosenComponentTypeIndex.Text = "";
            outputOfSettingAndRunningComponentRichTextBox.Text = "";
        }
Ejemplo n.º 5
0
 // Create an enumerator that waits for the specified task to complete.
 public WaitForTaskCompletion(StorageHandler uiHandler, Task task)
 {
     uiHandler.previousTask        = task;
     uiHandler.operationInProgress = true;
     this.uiHandler = uiHandler;
     this.task      = task;
 }
Ejemplo n.º 6
0
        public ActionResult Edit([Bind(Include = "ID,CPF,Name,Birthdate,Cel,Phone,Email,EmailOthers,Residents,Pets,Cars,Visitors,Unit_ID")] UserModel userModel, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                db.Entry(userModel).State = EntityState.Modified;
                db.SaveChanges();

                if (Image != null)
                {
                    StorageHandler.UploadImage(userModel.ID.ToString(), Image, "user_");
                }

                if (User.IsInRole("Sindico"))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            ViewBag.Unit_ID = new SelectList(db.UnitModels, "ID", "Name", userModel.Unit_ID);

            return(View(userModel));
        }
        public void Storage_handler_writes_to_file_at_specified_location()
        {
            // Arrange
            var storageHandler = new StorageHandler<Content>();
            var content = new Content
            {
                RefreshDate = DateTime.Now,
                Sections = new List<ContentSection>
                {
                    new ContentSection
                    {
                        Id = ContentTypes.HeaderWithMegaNav.ToString(),
                        Html = "<div id='meganav' />"
                    }
                }
            };

            // Act
            storageHandler.WriteToStorage(ContentTypes.HeaderWithMegaNav, content);

            const string fileName = "C:\\dev\\Veneer\\Client\\ContentCache-HeaderWithMegaNav.cache";

            var fileContents = File.ReadAllText(fileName);

            var contentFromCache = storageHandler.ReadFromStorage(ContentTypes.HeaderWithMegaNav);

            // Assert
            Assert.That(fileContents, Is.StringContaining("meganav"));
            Assert.That(contentFromCache.Sections.FirstOrDefault(x => x.Id == ContentTypes.HeaderWithMegaNav.ToString()), Is.Not.Null);
        }
 public CopyStorageVideo(CosmosClient cosmosClient, StorageHandler storageHandler, MediaHandler mediaHandler)
 {
     _cosmosClient   = cosmosClient ?? throw new ArgumentNullException(nameof(cosmosClient));
     _storageHandler = storageHandler ?? throw new ArgumentNullException(nameof(storageHandler));
     _mediaHandler   = mediaHandler ?? throw new ArgumentNullException(nameof(mediaHandler));
     repoResource    = new ResourceRepository(_cosmosClient, "MigrationMedia");
 }
Ejemplo n.º 9
0
        public ActionResult Create([Bind(Include = "ID,Name,Email,Cel,Position,DutyDays,WorkShift")] EmployeeModel employeeModel, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                string userId  = User.Identity.GetUserId();
                var    userAdm = db.Users.Find(userId);

                MembershipHandler membership = new MembershipHandler();
                var user = new ApplicationUser {
                    UserName = employeeModel.Email, Email = employeeModel.Email, Condo_ID = userAdm.Condo_ID
                };

                membership.CreateUser(user, Request.Form["pass"]);
                membership.SetRoleEmpregado(user.Id);

                employeeModel.User = db.Users.Find(user.Id);

                db.EmployeeModels.Add(employeeModel);
                db.SaveChanges();

                if (Image != null)
                {
                    StorageHandler.UploadImage(employeeModel.ID.ToString(), Image, "employee_");
                }

                return(RedirectToAction("Index"));
            }

            return(View(employeeModel));
        }
Ejemplo n.º 10
0
        public void getContactsStoreTest()
        {
            var cs   = StorageHandler.getContactsStore();
            var cont = cs.getContact("testMac");

            Console.WriteLine("mac: " + cont.mac + "\nname: " + cont.name);
        }
Ejemplo n.º 11
0
        public ActionResult Create(BoardModel boardModel, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                boardModel.DatePost    = DateTime.Now;
                boardModel.DateExpires = DateTime.Now.AddMonths(1);


                if (!User.IsInRole(MembershipHandler.SINDICOROLE))
                {
                    boardModel.Published = false;
                }

                string          userID = User.Identity.GetUserId();
                ApplicationUser user   = db.Users.FirstOrDefault(x => x.Id == userID);
                boardModel.User = user;

                db.BoardModels.Add(boardModel);
                db.SaveChanges();

                if (Image != null)
                {
                    StorageHandler.UploadImage(boardModel.Id.ToString(), Image, "board_");
                }

                return(RedirectToAction("Index"));
            }

            return(View(boardModel));
        }
Ejemplo n.º 12
0
    private void Awake()
    {
        Time.timeScale      = timeScale;
        _options            = GameObject.Find("Canvas").transform.Find("Options").gameObject;
        _currVolume         = 0.5f;
        _musicInterpolation = 0;
        try
        {
            _musicManager = GameObject.Find("Music manager").GetComponent <music>();
        }
        catch (NullReferenceException) { }

        isDebug = Application.isEditor;
        _redBar = GameObject.Find("Red_bar");
        _sh     = new StorageHandler();
        ReadColors();
        _pauseMenu         = GameObject.Find("Canvas").GetComponentInChildren <PauseManager>();
        _deathManager      = GameObject.Find("Death manager").GetComponent <DeathManager>();
        _cam               = GameObject.Find("Main Camera").GetComponent <Camera>();
        _pm                = GameObject.Find("PlatformManager").GetComponent <PlatformManager>();
        _rb                = GetComponent <Rigidbody2D>();
        _col               = GetComponent <BoxCollider2D>();
        transform.position = new Vector3(0, GetHeight() / 2, z: transform.position.z);
        _darkener          = GameObject.Find("Canvas").transform.Find("Darkener").GetComponent <Image>();
    }
        /// <summary>
        /// Constructor for the offline context which allows a symmetric encryption algorithm to be specified.
        /// </summary>
        /// <param name="schema">The schema that specifies the set of the collections for the context.</param>
        /// <param name="scopeName">The scope name used to identify the scope on the service.</param>
        /// <param name="cachePath">Path in isolated storage where the data will be stored.</param>
        /// <param name="uri">Uri of the scopeName.  Used to intialize the CacheController.</param>
        /// <param name="encryptionAlgorithm">The symmetric encryption algorithm to use for files on disk</param>
        /// <remarks>
        /// If the Uri specified is different from the one that is stored in the cache path, the
        /// Load method will throw an InvalidOperationException.
        /// </remarks>
        public IsolatedStorageOfflineContext(IsolatedStorageSchema schema, string scopeName, string cachePath,
                                             Uri uri, SymmetricAlgorithm encryptionAlgorithm)
        {
            if (schema == null)
            {
                throw new ArgumentNullException("schema");
            }

            if (string.IsNullOrEmpty(scopeName))
            {
                throw new ArgumentNullException("scopeName");
            }

            if (string.IsNullOrEmpty(cachePath))
            {
                throw new ArgumentNullException("cachePath");
            }

            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            _isDisposed = false;

            _schema         = schema;
            _scopeUri       = uri;
            _scopeName      = scopeName;
            _cachePath      = cachePath;
            _storageHandler = new StorageHandler(schema, cachePath, encryptionAlgorithm);
            _saveSyncLock   = new AutoResetLock();

            CreateCacheController();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Saves any outstanding changes made by the application.  This method will throw if a sync is currently
        /// active.
        /// </summary>
        /// <exception cref="SyncActiveException">
        /// Thrown if sync is active when the Save is attempted</exception>
        /// <exception cref="SaveFailedException">
        /// Thrown if there is a modified item changed during sync and a save for that item is attempted.</exception>
        public async Task SaveChangesAsync()
        {
            ThrowIfDisposed();

            // If the cache is not loaded, this is a no-op
            if (!loaded)
            {
                return;
            }

            if (syncActive)
            {
                throw new SyncActiveException("SaveChanges is not permitted while sync is active");
            }

            using (saveSyncLock.LockObject())
            {
                // Don't allow SaveChanges to execute if there are unhandled conflicts from a previous
                // save attempt
                if (offlineConflicts != null && offlineConflicts.Count != 0)
                {
                    throw new SaveFailedException(offlineConflicts,
                                                  "Existing store conflicts must be resolved or have items rejected before " +
                                                  "SaveChanges can be called");
                }

                // Determine if there are any items that can't be saved
                ICollection <OfflineEntity> failures = cacheData.GetSaveFailures();

                if (failures.Count != 0)
                {
                    // Generate store conflicts for the items.
                    offlineConflicts = (from f in failures
                                        select new OfflineConflict(this)
                    {
                        ModifiedEntity = f,
                        LiveEntity = f.GetOriginal()
                    }).ToList();

                    // Make sure the modified entities point to their store conflicts
                    foreach (OfflineConflict sc in offlineConflicts)
                    {
                        sc.ModifiedEntity.OfflineConflict = sc;
                    }

                    // Throw an exception and let the user know which items are in conflict
                    // They will also be able to be retrieved from the c later.
                    throw new SaveFailedException(offlineConflicts,
                                                  "One or more modified items has had an update received from the service. The conflicts must be resolved before SaveChanges can complete successfully.");
                }

                // Everything is ok, so actually save changes.
                IEnumerable <OfflineEntity> changes = cacheData.CommitChanges();

                if (changes != null && changes.Any())
                {
                    await StorageHandler.SaveChanges(changes);
                }
            }
        }
Ejemplo n.º 15
0
        public ActionResult Create([Bind(Include = "ID,CPF,Name,Birthdate,Cel,Phone,Email,EmailOthers,Residents,Pets,Cars,Visitors")] UserModel userModel, HttpPostedFileBase Image, int idCondo)
        {
            //int idCondo = 0;

            if (ModelState.IsValid)
            {
                MembershipHandler membership = new MembershipHandler();

                var user = new ApplicationUser {
                    UserName = userModel.Email, Email = userModel.Email, Condo_ID = idCondo
                };
                membership.CreateUser(user, Request.Form["pass"]);

                if (TempData["adm"] != null)
                {
                    if (TempData["adm"].ToString() == "S")
                    {
                        membership.SetRoleSindico(user.Id);
                        TempData.Clear();
                    }
                }
                else
                {
                    membership.SetRoleCondomino(user.Id);
                }

                userModel.User = db.Users.FirstOrDefault(x => x.Email == userModel.Email);


                var towerId = Convert.ToInt32(Request.Form["TowerId"]);
                var tower   = db.TowerModels.FirstOrDefault(x => x.ID == towerId);

                UnitModel unit = new UnitModel();
                unit.Name     = String.Format(Request.Form["Unit"]);
                unit.Tower_ID = tower.ID;
                unit.Tower    = tower;

                db.UnitModels.Add(unit);
                db.SaveChanges();

                userModel.Unit = unit;

                db.UserModels.Add(userModel);
                db.SaveChanges();

                if (Image != null)
                {
                    StorageHandler.UploadImage(userModel.ID.ToString(), Image, "user_");
                }

                membership.Login(user, HttpContext);
                return(RedirectToAction("Index", "Home", ""));
            }

            ViewBag.TowerId = new SelectList(db.TowerModels.Include(c => c.Condo).Where(x => x.Condo.ID == idCondo).ToList(), "Id", "Name");
            ViewBag.CondoId = idCondo;

            return(View(userModel));
        }
Ejemplo n.º 16
0
        private void CreateACoupleOfPoints(StorageHandler storeHandler, int deviceId)
        {
            storeHandler.AddDeviceValueToDatabase(1, new DateTime(2000, 1, 1, 0, 0, 1), deviceId);

            storeHandler.AddDeviceValueToDatabase(2, new DateTime(2000, 1, 1, 0, 0, 2), deviceId);

            storeHandler.AddDeviceValueToDatabase(3, new DateTime(2000, 1, 1, 0, 0, 3), deviceId);
        }
 public MigrationUpdaterMain(CosmosClient cosmosClient, StorageHandler storageHandler, MediaHandler mediaHandler, HttpHandler httpHandler)
 {
     _cosmosClient   = cosmosClient ?? throw new ArgumentNullException(nameof(cosmosClient));
     _storageHandler = storageHandler ?? throw new ArgumentNullException(nameof(storageHandler));
     _mediaHandler   = mediaHandler ?? throw new ArgumentNullException(nameof(mediaHandler));
     _httpHandler    = httpHandler ?? throw new ArgumentNullException(nameof(httpHandler));
     repoResource    = new ResourceRepository(_cosmosClient, "MigrationMedia");
 }
Ejemplo n.º 18
0
        public static void InitializeHttpHandlers(string config = null)
        {
            if (!HostingEnvironment.IsHosted)
            {
                throw new InvalidOperationException("Application not hosted.");
            }

            var section = GetSection(config);

            if (section != null)
            {
                //old scheme
                var discHandler = section.Handlers.GetHandler("disc");
                if (discHandler != null)
                {
                    var props = discHandler.GetProperties();
                    foreach (var m in section.Modules.Cast <ModuleConfigurationElement>().Where(m => m.Type == "disc"))
                    {
                        if (m.Path.Contains(Constants.STORAGE_ROOT_PARAM))
                        {
                            DiscDataHandler.RegisterVirtualPath(
                                PathUtils.ResolveVirtualPath(m.VirtualPath),
                                PathUtils.ResolvePhysicalPath(m.Path, props),
                                m.Public);
                        }

                        foreach (var d in m.Domains.Cast <DomainConfigurationElement>().Where(d => (d.Type == "disc" || string.IsNullOrEmpty(d.Type)) && d.Path.Contains(Constants.STORAGE_ROOT_PARAM)))
                        {
                            DiscDataHandler.RegisterVirtualPath(
                                PathUtils.ResolveVirtualPath(d.VirtualPath),
                                PathUtils.ResolvePhysicalPath(d.Path, props));
                        }
                    }
                }

                //new scheme
                foreach (var m in section.Modules.Cast <ModuleConfigurationElement>())
                {
                    //todo: add path criterion
                    if (m.Type == "disc" || !m.Public || m.Path.Contains(Constants.STORAGE_ROOT_PARAM))
                    {
                        StorageHandler.RegisterVirtualPath(
                            m.Name,
                            string.Empty,
                            m.Public);
                    }

                    //todo: add path criterion
                    foreach (var d in m.Domains.Cast <DomainConfigurationElement>().Where(d => d.Path.Contains(Constants.STORAGE_ROOT_PARAM)))
                    {
                        StorageHandler.RegisterVirtualPath(
                            m.Name,
                            d.Name,
                            d.Public);
                    }
                }
            }
        }
			public static void serve(){
				StorageHandler s=new StorageHandler();
				Storage.Processor p=new Storage.Processor(s);
				
				ZMQ.Context c=new ZMQ.Context();
				
				TZmqServer tzs=new TZmqServer(p,c,"tcp://127.0.0.1:9090",ZMQ.SocketType.PAIR);
				tzs.Serve();
			}
Ejemplo n.º 20
0
        public static void Init()
        {
            connection = DBConnection.CreateConnection();
            Storage    = new StorageHandler(connection);
            Channel    = new ChannelHandler(connection);
            Station    = new StationHandler(connection);

            UpdateChache();
        }
Ejemplo n.º 21
0
    // Save current game
    public void Save()
    {
        StorageHandler sh = new StorageHandler();
        PlayerData     dt = _pd;

        if (_pd != null)
        {
            sh.SaveData(dt, "player");
        }
    }
Ejemplo n.º 22
0
        /// <summary>
        /// Store commands in a custom data storage
        /// </summary>
        /// <param name="storage">The storage</param>
        /// <returns>this</returns>
        /// <remarks>The memory is used per default</remarks>
        public PipelineDispatcherBuilder StoreCommands(ICommandStorage storage)
        {
            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            _storageHandler = new StorageHandler(storage);
            return(this);
        }
Ejemplo n.º 23
0
        public StorageHandlerSimulation(MessageHubSimulationConfig configuration)
        {
            var blobStorageSingleton = new StorageServiceClientFactory(configuration.BlobStorageConnectionString);

            EnsureTestBlobStorage(blobStorageSingleton, configuration.BlobStorageContainerName);

            var storageConfig = new StorageConfig(configuration.BlobStorageContainerName);

            StorageHandler = new StorageHandler(blobStorageSingleton, storageConfig);
        }
Ejemplo n.º 24
0
 static void ClearTasksFromLocal()
 {
     if (StorageHandler.DeleteData(TaskManagerScript.LOCAL_TASKS_FILE_PATH))
     {
         Debug.Log("Deleted local tasks.");
     }
     else
     {
         Debug.Log("No local tasks to delete.");
     }
 }
Ejemplo n.º 25
0
    // Save current game
    public void Save()
    {
        StorageHandler sh = new StorageHandler();
        PlayerData     dt = _pd;

        if (dt != null)
        {
            print("saving!");
            sh.SaveData(dt, "player");
            print("saved!");
        }
    }
Ejemplo n.º 26
0
            public static void serve()
            {
                StorageHandler s = new StorageHandler();

                Storage.Processor p = new Storage.Processor(s);

                ZMQ.Context c = new ZMQ.Context();

                TZmqServer tzs = new TZmqServer(p, c, "tcp://127.0.0.1:9090", ZMQ.SocketType.PAIR);

                tzs.Serve();
            }
Ejemplo n.º 27
0
        public void updateMyContactsFileTest()
        {
            var cs = ContactsStore.getInstance();

            cs.addContact("testMac", new Contact()
            {
                mac = "testMac", name = "siripala serializer"
            });


            StorageHandler.updateMyContactsFile(cs);
        }
Ejemplo n.º 28
0
        public void Storage_handler_returns_null_from_local_cache_if_no_app_setting_is_set_up()
        {
            // Arrange
            ConfigurationManager.AppSettings["LocalCacheFolder"] = string.Empty;
            var storageHandler = new StorageHandler<Content>();

            // Act
            var content = storageHandler.ReadFromStorage(ContentTypes.Footer);

            // Assert
            Assert.That(content, Is.Null);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Clears sync errors from memory and from disk.
        /// </summary>
        public async Task ClearSyncErrors()
        {
            ThrowIfDisposed();

            await LoadAsync();

            using (saveSyncLock.LockObject())
            {
                cacheData.ClearSyncErrors();
                await StorageHandler.ClearErrors();
            }
        }
Ejemplo n.º 30
0
        public int GetAchievementScore()
        {
            var Result = 0;

            foreach (var AchievementProgress in StorageHandler.GetCharacterAchievements(Id))
            {
                var Achievement = AchievementHandler.GetAchievement(AchievementProgress.Id);

                Result += (AchievementProgress.CurrentLevel * Achievement.ScorePerLevel);
            }

            return(Result);
        }
Ejemplo n.º 31
0
        public void SetUp()
        {
            this.data = new Dictionary <string, string>();

            this.data.Add("greet", "Hello World!");
            this.data.Add("1", "Niconicome");
            this.data.Add("2", "Test");

            var instance = new StorageHandler(new StorageHelperStab(this.data));

            instance.Initialize("", "");
            this.handler = instance;
        }
Ejemplo n.º 32
0
        public void GetResponse(OutMessage Message, Character Character)
        {
            var Achievements = StorageHandler.GetCharacterAchievements(Character.Id);
            var Details      = StorageHandler.GetAchievementDetailsSorted(Id);

            int MaxLevel = Details.Count() > 0 ? Details.Count() : 1;

            var MyProgress = new CharacterAchievement(-1, Character.Id, Id, 0);

            foreach (var Item in Achievements)
            {
                if (Item.AchievementId == Id)
                {
                    MyProgress = Item;
                }
            }

            var CurrentLevel = MyProgress.CurrentLevel;
            var NextLevel    = (CurrentLevel + 1);

            int NextRequired = 1;

            foreach (var Item in Details)
            {
                if (Item.Level == NextLevel)
                {
                    NextRequired = Item.RequiredAmmount;
                }
            }

            if (NextLevel > MaxLevel)
            {
                NextLevel = MaxLevel;
            }

            if (CurrentLevel >= MaxLevel)
            {
                CurrentLevel = MaxLevel;
            }

            Message.Append(Id);
            Message.Append(NextLevel);
            Message.Append(GetBadge(NextLevel));
            Message.Append(NextRequired);
            Message.Append(GetPixelReward(NextLevel));
            Message.Append(0); // TODO <> BadgeId
            Message.Append(0); // TODO <> GotAlready
            Message.Append(CurrentLevel == MaxLevel);
            Message.Append(AchievementHandler.GetCategory(ParentId).Caption.ToLower());
            Message.Append(MaxLevel);
        }
Ejemplo n.º 33
0
        public void Maintenance_ShouldDeleteSomething()
        {
            var deviceId = 530;

            _iniSettings.DaysOfDataStorage.Returns(5);
            var dbPath = CreateCopyOfDbAndReturnPath("DataCurveSeer_okt2019.db");

            var storageHandler = new StorageHandler(_logging, _iniSettings, dbPath);

            SystemDateTime.Now = () => new DateTime(2019, 10, 16, 0, 0, 0);

            storageHandler.AddDeviceValueToDatabase(99, SystemDateTime.Now(), deviceId);

            storageHandler.AddDeviceValueToDatabase(99, SystemDateTime.Now(), deviceId);
        }
Ejemplo n.º 34
0
        public void Storage_handler_ignores_request_to_cache_if_no_app_setting_is_set_up()
        {
            try
            {
                // Arrange
                ConfigurationManager.AppSettings["LocalCacheFolder"] = string.Empty;
                var storageHandler = new StorageHandler<Content>();
                var content = new Content {RefreshDate = DateTime.Now};

                // Act
                storageHandler.WriteToStorage(ContentTypes.HeaderWithoutMegaNav, content);
            }
            catch (Exception)
            {
                // Assert
                Assert.Fail();
            }
        }