Example #1
0
        /// <summary>
        /// Constructor that initializes the character create page with default values.
        /// </summary>
        /// <param name="data"></param>
        public CharacterCreatePage(GenericViewModel <CharacterModel> data)
        {
            InitializeComponent();
            data.Data = new CharacterModel();
            foreach (Image image in DefaultData.LoadCharacterImages())
            {
                imageList.Add(image);
            }

            ImageView.ItemsSource = imageList;


            BindingContext = this.ViewModel = data;

            this.ViewModel.Title = "Create";

            SpecialAbilityPicker.SelectedItem = data.Data.SpecialAbility.ToString();
            AttackPicker.SelectedItem         = data.Data.Attack.ToString();
            DefensePicker.SelectedItem        = data.Data.Defense.ToString();

            var ItemViewModelInstance = ItemIndexViewModel.Instance;
            ObservableCollection <ItemModel> itemCollection = ItemViewModelInstance.Dataset;

            foreach (ItemModel item in itemCollection)
            {
                itemNames.Add(item.Name);
            }
        }
Example #2
0
        //To load all default addresses
        public void LoadDefaultAddresses()
        {
            try
            {
                var addressList = DefaultData.GetDefaultAddressList();

                db.AddressRecord.InsertManyAsync(addressList);

                //create index hashCode
                var key          = Builders <Address> .IndexKeys;
                var indexOptions = new CreateIndexOptions();
                indexOptions.Background = true;
                var indexModel = new CreateIndexModel <Address>(key.Ascending(x => x.HashCode), indexOptions);
                db.AddressRecord.Indexes.CreateOne(indexModel);

                //create index for addressline1
                var key2        = Builders <Address> .IndexKeys;
                var indexModel2 = new CreateIndexModel <Address>(key2.Ascending(x => x.AddressLine1), indexOptions);
                db.AddressRecord.Indexes.CreateOne(indexModel2);

                //create index for timestamp
                var key3        = Builders <Address> .IndexKeys;
                var indexModel3 = new CreateIndexModel <Address>(key3.Descending(x => x.Timestamp), indexOptions);
                db.AddressRecord.Indexes.CreateOne(indexModel3);
            }
            catch
            {
                throw;
            }
        }
Example #3
0
        private Dictionary <string, DefaultDataField[]> ReadDefaultData()
        {
            string defaultDataFile = HelperMethods.GetAppSettingsValue("DefaultDataFile", true);

            if (string.IsNullOrEmpty(defaultDataFile))
            {
                return(new Dictionary <string, DefaultDataField[]>());
            }

            XmlSerializer ser = new XmlSerializer(typeof(DefaultData));

            FileInfo dllPath = new FileInfo(Assembly.GetExecutingAssembly().Location);
            FileInfo file    = new FileInfo(string.Format(@"{0}\{1}", dllPath.DirectoryName, defaultDataFile));

            using (XmlReader reader = XmlReader.Create(file.FullName))
            {
                DefaultData data = ser.Deserialize(reader) as DefaultData;

                if (data == null || data.Entities == null || data.Entities.Length == 0)
                {
                    Logger.WriteLine("DefaultData is empty");
                    return(new Dictionary <string, DefaultDataField[]>());
                }

                return(data.Entities.ToDictionary(e => e.Name, e => e.Fields));
            }
        }
Example #4
0
        public void PickCharacterPage_OnCharacter_Clicked_Does_Not_Exist_()
        {
            // Arrange
            var characters = DefaultData.LoadData(new CharacterModel());

            // Add characters to the Engine
            foreach (var character in characters)
            {
                BattleEngineViewModel.Instance.Engine.EngineSettings.CharacterList.Add(new PlayerInfoModel(character));
            }

            ImageButton s = new ImageButton();

            // Test does not exist
            s.CommandParameter = "Test";
            System.EventArgs e = new System.EventArgs();

            // Act
            page.OnCharacter_Clicked(s, e);

            // Assert
            Assert.IsTrue(true); // Got to here, so it happened...

            //Reset
            BattleEngineViewModel.Instance.Engine.EngineSettings.CharacterList.Clear();
        }
Example #5
0
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }
            app.UseStaticFiles();
            app.UseSession();
            app.UseAuthentication();


            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Product}/{action=List}/{id?}");
            });

            DefaultData.EnsurePopulated(app);
        }
Example #6
0
        /// <summary>
        /// Add Monsters to the Round
        ///
        /// Because Monsters can be duplicated, will add 1, 2, 3 to their name
        ///

        /*
         * Hint:
         * I don't have crudi monsters yet so will add 6 new ones...
         * If you have crudi monsters, then pick from the list
         *
         * Consdier how you will scale the monsters up to be appropriate for the characters to fight
         */
        /// </summary>
        /// <returns></returns>
        public int AddMonstersToRound()
        {
            List <MonsterModel> SelectedMonsterList = DefaultData.LoadData(new MonsterModel());

            for (int i = 0; i < MaxNumberPartyMonsters; i++)
            {
                PlayerInfoModel CurrentMonster = new PlayerInfoModel(SelectedMonsterList[i]);
                CurrentMonster.ScaleLevel(GetAverageCharacterLevel());
                MonsterList.Add(CurrentMonster);
            }

            //Hack #31, When Round Count exceeds 100, Monster power becomes 10x
            if (BattleScore.RoundCount > 100)
            {
                foreach (PlayerInfoModel Monster in MonsterList)
                {
                    Monster.Attack        = 10 * Monster.Attack;
                    Monster.Speed         = 10 * Monster.Speed;
                    Monster.Defense       = 10 * Monster.Defense;
                    Monster.CurrentHealth = 10 * Monster.CurrentHealth;
                    Monster.MaxHealth     = 10 * Monster.MaxHealth;
                }
            }
            return(MonsterList.Count);
        }
        public void Setup()
        {
            // Initilize Xamarin Forms
            MockForms.Init();

            //This is your App.xaml and App.xaml.cs, which can have resources, etc.
            app = new App();
            Application.Current = app;

            BattleEngineViewModel.Instance.SetBattleEngineToGame();

            var characters = DefaultData.LoadData(new CharacterModel());

            foreach (var character in characters)
            {
                BattleEngineViewModel.Instance.Engine.EngineSettings.CharacterList.Add(new PlayerInfoModel(character));
            }

            var monsters = DefaultData.LoadData(new MonsterModel());

            foreach (var monster in monsters)
            {
                BattleEngineViewModel.Instance.Engine.EngineSettings.MonsterList.Add(new PlayerInfoModel(monster));
            }

            page = new BattlePageOne();

            // Put seed data into the system for all tests
            BattleEngineViewModel.Instance.Engine.Round.ClearLists();
        }
Example #8
0
 public static void Init(TestContext testContext)
 {
     _defaultData = new DefaultData(ExpectedSByte, ExpectedByte, ExpectedShort, ExpectedUShort, ExpectedInt,
                                    ExpectedUInt, ExpectedLong, ExpectedULong, ExpectedChar, ExpectedFloat, ExpectedDouble, ExpectedBool,
                                    ExpectedDecimal,
                                    ExpectedString, ExpectedDateTime, ExpectedList);
 }
Example #9
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity <tblCountryMaster>().HasIndex(c => new { c.CountryName }).IsUnique();
            modelBuilder.Entity <tblStateMaster>().HasIndex(c => new { c.CountryId, c.StateName }).IsUnique();
            modelBuilder.Entity <tblStateMaster>().Property(o => o.longitude).HasColumnType("decimal(18,14)");
            modelBuilder.Entity <tblStateMaster>().Property(o => o.latitude).HasColumnType("decimal(18,14)");
            modelBuilder.Entity <tblPaymentRequest>().Property(p => p.Status).IsConcurrencyToken();

            DefaultData defaultData = new DefaultData(modelBuilder);

            modelBuilder.Entity <tblCustomerBalance>(entity => entity.HasCheckConstraint("CK_tblCustomerMaster_WalletBalance", "WalletBalance >= 0"));
            modelBuilder.Entity <tblCustomerBalance>(entity => entity.HasCheckConstraint("CK_tblCustomerMaster_CreditBalance", "CreditBalance >= 0"));

            defaultData.InsertRoleClaim();
            defaultData.InsertCustomerMaster();
            defaultData.InsertUser();
            defaultData.InsertAirport();
            defaultData.InsertAirline();
            defaultData.InsertServiceProvider();
            defaultData.InsertBank();


            #region ************** Remove Default Identity Columns *******************
            modelBuilder.Entity <tblCustomerBalance>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerGSTDetails>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerIPFilter>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerBankDetails>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerPanDetails>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblCustomerMarkup>().Property(et => et.CustomerId).ValueGeneratedNever();
            modelBuilder.Entity <tblWalletBalanceAlert>().Property(et => et.CustomerId).ValueGeneratedNever();
            #endregion
        }
Example #10
0
        /// <summary>
        /// Конфигурирование работы pipeline во время обработки запроса
        /// </summary>
        /// <param name="app">Сборщик приложения</param>
        /// <param name="env">Переменные среды выполнения</param>
        /// <param name="context"></param>
        /// <param name="userManager"></param>
        /// <param name="rolesManager"></param>
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              AppDbContext context,
                              UserManager <IdentityUser> userManager,
                              RoleManager <IdentityRole> rolesManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();
            app.UseCors(builder => builder.AllowAnyOrigin());
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints => endpoints.MapControllers());
            app.UseSpaStaticFiles();
            app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "../ClientApp";
                if (env.IsDevelopment())
                {
                    Connection.UseVueDevelopmentServer(spa);
                }
            });

            DefaultData.Initialize(context, userManager, rolesManager).Wait();
        }
        // -------------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------------

        public MultipleFileUpload(IData data, string usercontrolPath)
        {
            // Get usercontrol path
            if (!String.IsNullOrEmpty(usercontrolPath))
            {
                _usercontrolPath = usercontrolPath;
            }
            else
            {
                // Use default usercontrol
                _usercontrolPath = "~/usercontrols/MultipleFileUpload/MultipleFileUpload.ascx";
            }

            _data = (DefaultData)data;

            // Get multiplefileupload config
            string configFilePath =
                HttpContext.Current.Server.MapPath(VirtualPathUtility.ToAbsolute("~/config/multiplefileupload.config"));

            if (File.Exists(configFilePath))
            {
                _multipleFileUploadXml = new XmlDocument();
                XmlReader xmlReader = null;
                try
                {
                    // Read configfile with schema
                    // Get schema from assembly
                    Stream schemaStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("noerd.multipleFileUpload.MultipleFileUpload.xsd");

                    // XmlReader settings
                    XmlReaderSettings settings = new XmlReaderSettings();
                    if (schemaStream != null)
                    {
                        settings.ValidationType = ValidationType.Schema;
                        settings.Schemas.Add(SCHEMA_NAMESPACE, XmlReader.Create(schemaStream));
                        settings.ValidationEventHandler += ConfigValidationEventHandler;
                    }

                    // Create XmlReader
                    xmlReader = XmlReader.Create(configFilePath, settings);

                    // Read xml
                    _multipleFileUploadXml.Load(xmlReader);
                }
                catch (XmlException)
                {
                    if (xmlReader != null)
                    {
                        xmlReader.Close();
                    }

                    Log(LogTypes.Error, -1, "multiplefileupload.config invalid XML");
                }
            }
            else
            {
                Log(LogTypes.Error, -1, "multiplefileupload.config not found");
            }
        }
Example #12
0
        public void DefaultData_SetValue_Ensures_Empty_String_When_Null_Value_Any_Data_Type(DataTypeDatabaseType type)
        {
            var defaultData = new DefaultData(new Mock <BaseDataType>().Object);

            ((IDataValueSetter)defaultData).SetValue(null, type.ToString());

            Assert.AreEqual(string.Empty, defaultData.Value);
        }
Example #13
0
 public void SaveVersion()
 {
     File.WriteAllText(DefaultData.Create("system/") + "version.dat", "1.0.6");
     Debug.LogFormat("SystemVersion : {0}", new object[1]
     {
         (object)"1.0.6"
     });
 }
Example #14
0
        public override RolePermission GetFromCache(Guid id)
        {
            var item = base.GetFromCache(id);

            if (item != null)
            {
                return(item);
            }
            return(DefaultData.GetDefault(id));
        }
        public BattleThemePage()
        {
            InitializeComponent();
            foreach (Image image in DefaultData.LoadThemeImages())
            {
                ImageList.Add(image);
            }

            ImageView.ItemsSource = ImageList;
        }
Example #16
0
        //从内存加载图片
        public void addGDIlayer(string layername, IImageDataProvider datapro, config cfg)
        {
            //delete existing same layer
            ILayer layer = this.mapBox.Map.GetLayerByName(layername);

            if (layer != null)
            {
                if (mp != null)
                {
                    mp.Dispose();
                    mp = null;
                }

                if (img != null)
                {
                    img.Dispose();
                    img = null;
                }

                if (p != null)
                {
                    DeleteObject(p);
                }

                this.mapBox.Map.Layers.Remove(layer);
                ((Layer)layer).Dispose();

                GC.Collect();
            }
            //get data from data provider

            if (datapro == null)
            {
                DefaultData dd = new DefaultData();

                mp = dd.GetData();
            }
            else
            {
                mp = datapro.GetData();
            }

            p   = mp.GetHbitmap();
            img = Image.FromHbitmap(p);

            ImageGDILayer gdilayer = new ImageGDILayer(layername, img, cfg);

            this.mapBox.Map.Layers.Insert(0, gdilayer);
            this.mapBox.Map.ZoomToBox(gdilayer.Envelope);
            this.mapBox.Refresh();

            //System.Diagnostics.Process.GetCurrentProcess().MinWorkingSet = new System.IntPtr(5);
        }
Example #17
0
        public void DefaultData_Valid_LoadData_Monster_Should_Pass()
        {
            // Arrange

            // Act
            var result = DefaultData.LoadData(new MonsterModel());

            // Reset

            // Assert
            Assert.AreEqual(7, result.Count());
        }
Example #18
0
        private IEnumerable <PaymentInfo> GetPaymentData(int max, int paymentProcessorCode)
        {
            //empty the database
            //seed initial data
            //create paymentrequests out of seeded data
            var currency  = DefaultData.TransactionCurrency;
            var processor = paymentProcessorCode switch
            {
                0 => DefaultData.MonerisPaymentProcessor,
                1 => DefaultData.StripePaymentProcessor,
                2 => DefaultData.IatsPaymentProcessor,
                _ => throw new NotSupportedException($"PaymentProcessorCode with value {paymentProcessorCode} not supported."),
            };

            var configuration = DefaultData.Configuration(processor);

            this.db.Add(processor);
            this.db.Add(configuration);
            this.db.Add(currency);

            var random   = new Random();
            var requests = Enumerable.Range(0, max).Select(x =>
            {
                var info = new PaymentInfo
                {
                    PaymentProcessor    = processor,
                    Configuration       = configuration,
                    TransactionCurrency = currency
                };

                switch (processor.PaymentGatewayType)
                {
                case PaymentGatewayCode.Moneris:
                    info.Input = CreateMonerisPaymentInput(info);
                    break;

                case PaymentGatewayCode.Iats:
                    info.Input = CreateIatsPaymentInput(info);
                    break;

                case PaymentGatewayCode.Stripe:
                    info.Input = CreateStripePaymentInput(info);
                    break;

                default:
                    break;
                }

                return(info);
            });

            return(requests);
        }
Example #19
0
        public void DefaultData_Valid_LoadData_Score_Should_Pass()
        {
            // Arrange

            // Act
            var result = DefaultData.LoadData(new ScoreModel());

            // Reset

            // Assert
            Assert.AreEqual(2, result.Count());
        }
        public async Task <DefaultDataDTO> GetInfoAsync(Guid id)
        {
            DefaultData defaultDataFromDB = await _defaultDataRepository.FirstOrDefaultAsync(m => m.ID == id);

            if (defaultDataFromDB == null)
            {
                throw new DeployException("默认数据不存在");
            }
            var result = _mapper.Map <DefaultDataDTO>(defaultDataFromDB);

            return(result);
        }
Example #21
0
 public void LoadGameData()
 {
     // Check if the file exists if not create it, if it does exist load the data
     if (File.Exists(fileName))
     {
         string saveData = File.ReadAllText(fileName);
         gameData = JsonUtility.FromJson <DefaultData>(saveData);
     }
     else
     {
         SaveGameData();
     }
 }
Example #22
0
        public override RolePermission Get(Guid id, bool getColumnDataOnly = false)
        {
            var item = base.Get(id, getColumnDataOnly);

            if (item != null)
            {
                return(item);
            }
            else
            {
                return(DefaultData.GetDefault(id));
            }
        }
        public async Task DeleteAsync(Guid id)
        {
            DefaultData defaultDataFromDB = await _defaultDataRepository.FirstOrDefaultAsync(m => m.ID == id);

            if (defaultDataFromDB == null)
            {
                throw new DeployException("默认数据不存在");
            }
            _deploySqliteEFUnitOfWork.RegisterDelete(defaultDataFromDB);
            await _deploySqliteEFUnitOfWork.CommitAsync();

            await _defaultDataRepository.ClearCacheAsync();
        }
        public GameStringParserTests()
        {
            GameData = new FileGameData(ModsTestFolder);
            GameData.LoadAllData();

            Configuration = new Configuration();
            Configuration.Load();

            GameStringParser = new GameStringParser(Configuration, GameData);
            PreParse();

            DefaultData = new DefaultData(GameData);
            DefaultData.Load();
        }
Example #25
0
        public void LoadDefaultData(DefaultDataViewModel model)
        {
            byte[] fileBytes = new byte[] { };

            using (var ms = new MemoryStream())
            {
                model.File.CopyTo(ms);
                fileBytes = ms.ToArray();
            }

            DefaultData defaultData = GenerateDefaultData.LoadXml <DefaultData>(fileBytes);

            SaveDefaultData(defaultData);
        }
        public GameStringParserTests()
        {
            _gameData = new FileGameData(_modsTestFolder);
            _gameData.LoadAllData();

            _configuration = new Configuration();
            _configuration.Load();

            _gameStringParser = new GameStringParser(_configuration, _gameData);
            PreParse();

            _defaultData = new DefaultData(_gameData);
            _defaultData.Load();
        }
Example #27
0
        private void LoadTestData()
        {
            GameData = new FileGameData(_modsTestFolder);
            GameData.LoadAllData();

            DefaultData = new DefaultData(GameData);
            DefaultData.Load();

            Configuration = new Configuration();
            Configuration.Load();

            GameStringParser = new GameStringParser(Configuration, GameData);
            ParseGameStrings();

            XmlDataService = new XmlDataService(Configuration, GameData, DefaultData);
        }
Example #28
0
 protected override void OnExecute(Command com)
 {
     if (com.ContainsData <DefaultData>())
     {
         DefaultData data = com.GetData <DefaultData> ();
         if (data.DataType == DataType.UShort)
         {
             Cover cover = CoverManager.GetCover((ushort)data.Value);
             this.StartTransition(cover);
         }
         else if (data.DataType == DataType.Long)
         {
             Input = (long)data.Value;
         }
     }
 }
Example #29
0
        public DefaultData Get(GetDefault request)
        {
            int namesPerPage = 102;
            int offset       = request.Page * namesPerPage;

            var data = new DefaultData();

            data.NumberOfNames = this.repository.CountNames();
            data.Names         = this.repository.GetList(offset, namesPerPage);
            data.Paginator     = new Paginator()
            {
                TotalPages    = data.NumberOfNames / namesPerPage
                , CurrentPage = request.Page
            };

            return(data);
        }
        public HomeControllerTests()
        {
            DbContextOptionsBuilder <WeatherTestContext> optionsBuilder = new DbContextOptionsBuilder <WeatherTestContext>();

            optionsBuilder.UseInMemoryDatabase();
            _weatherTestDb = new WeatherTestContext(optionsBuilder.Options);

            DefaultData.Create(_weatherTestDb);

            _homeController = new HomeController(_weatherTestDb);

            _celsius    = WeatherTestDb.TemperatureUom.First(i => i.Title == DefaultData.CelsiusTitle);
            _fahrenheit = WeatherTestDb.TemperatureUom.First(i => i.Title == DefaultData.FahrenheitTitle);

            _kph = WeatherTestDb.WindSpeedUom.First(i => i.Title == DefaultData.KPHTitle);
            _mph = WeatherTestDb.WindSpeedUom.First(i => i.Title == DefaultData.MPHTitle);
        }
Example #31
0
        //从内存加载图片
        public void addGDIlayer(string layername, IImageDataProvider datapro, config cfg)
        {
            //delete existing same layer
            ILayer layer = this.mapBox.Map.GetLayerByName(layername);

            if (layer != null)
            {

                if (mp != null)
                {
                    mp.Dispose();
                    mp = null;
                }

                if (img != null)
                {
                    img.Dispose();
                    img = null;
                }

                if (p != null)
                {
                    DeleteObject(p);
                }

                this.mapBox.Map.Layers.Remove(layer);
                ((Layer)layer).Dispose();

                GC.Collect();
            }
            //get data from data provider

            if (datapro == null)
            {
                DefaultData dd = new DefaultData();

                mp = dd.GetData();
            }
            else
            {
                mp = datapro.GetData();
            }

            p = mp.GetHbitmap();
            img = Image.FromHbitmap(p);

            ImageGDILayer gdilayer = new ImageGDILayer(layername, img, cfg);
            this.mapBox.Map.Layers.Insert(0, gdilayer);
            this.mapBox.Map.ZoomToBox(gdilayer.Envelope);
            this.mapBox.Refresh();

            //System.Diagnostics.Process.GetCurrentProcess().MinWorkingSet = new System.IntPtr(5);
        }