Пример #1
0
        // Constants
        //public const string SampleConstant = "somethingImportant";
        // Constructor is run once, when it is first requested
        static Config()
        {
            IModelFactory<iServeDBProcedures> model = new ModelFactory<iServeDBProcedures>(new iServeDBDataContext());
            List<ConfigSetting> configSettings = model.New<ConfigSetting>().GetAll().ToList();

            // Get all our configuration settings from config file and put them into our static variables.
            AppVersion = configSettings.Single(c => c.Name =="AppVersion").Value;
            ConfigSetting recordsPerPage = configSettings.SingleOrDefault(c => c.Name == "RecordsPerPage");
            if (recordsPerPage != null) {
                RecordsPerPage = int.Parse(recordsPerPage.Value);
            }
            else {
                RecordsPerPage = 10;
            }
            DomainName = configSettings.Single(c => c.Name == "DomainName").Value;
            DefaultChurchCode = configSettings.Single(c => c.Name == "DefaultChurchCode").Value;
            FromEmail = configSettings.Single(c => c.Name == "FromEmail").Value;
            SMTPServer = configSettings.Single(c => c.Name == "SMTPServer").Value;
            SMTPUsername = configSettings.Single(c => c.Name == "SMTPUsername").Value;
            SMTPPassword = configSettings.Single(c => c.Name == "SMTPPassword").Value;
            ConsumerKey = configSettings.Single(c => c.Name == "ConsumerKey").Value;
            ConsumerSecret = configSettings.Single(c => c.Name == "ConsumerSecret").Value;
            F1LoginMethod = configSettings.Single(c => c.Name == "F1LoginMethod").Value;
            BaseAPIUrl = configSettings.Single(c => c.Name == "BaseAPIUrl").Value;
            ApiVersion = configSettings.Single(c => c.Name == "ApiVersion").Value;
        }
Пример #2
0
 public AccountController()
 {
     string churchCode = GetRequestedChurchCode();
     Model = new ModelFactory<iServeDBProcedures>(new iServeDBDataContext(), GetCurrentUserID());
     OAuthHelper = new OAuthUtil(Config.BaseAPIUrl, churchCode, Config.ApiVersion, Config.F1LoginMethod, Config.ConsumerKey, Config.ConsumerSecret);
     PersonAPI = new PersonAPI(churchCode);
 }
Пример #3
0
        public void Setup()
        {
            var modelFactory = new ModelFactory<UserModel>(() => new UserModel()); // {OnRestore = model => model.Invalidate()};
            _userRepository = new UserRepository(new RepositoryConfiguration(), modelFactory) { Path = @"c:\temp\yoyyin\users" };
            _userRepository.Purge();

            _userImporter = new UserImporter();
            _sniImporter = new SniImporter();
            //DevelopmentUserRepository = new DevelopmentUserRepository(new UserImporter(), new SniImporter(), UserRepository);
            //QandARepository = new Repository<QandAModel>(new RepositoryConfiguration(), qandAFactory) { Path = @"c:\Temp\yoyyin\Q&A" };

            Console.Out.WriteLine("Revision is now {0}", _userRepository.Revision);
        }
Пример #4
0
        public void Test()
        {
            var modelFactory = new ModelFactory<UserModel>(() => new UserModel()); // {OnRestore = model => model.Invalidate()};
            UserRepository userRepository = new UserRepository(new RepositoryConfiguration(), modelFactory) { Path = @"c:\temp\yoyyin\users" };

            var allCompetences = userRepository
                .Query(m => m.Users.Select(u => u.Ideas.First().SearchProfile.CompetencesNeeded));

            WeightedTags tags = new WeightedTags();
            tags.Add(allCompetences);

            tags.Print();

            Assert.That(allCompetences.Count(), Is.GreaterThanOrEqualTo(40));
        }
Пример #5
0
        private void btnMakeCharacter_Click(object sender, EventArgs e)
        {
            string currentHeadCharacterName = cbHead.SelectedItem.ToString();
            string currentTorsoCharacterName = cbTorso.SelectedItem.ToString();
            string currentLegsCharacterName = cbLegs.SelectedItem.ToString();

            ModelFactory currentModelFactory = new ModelFactory();
            ModelMaker currentModel = currentModelFactory.createModel(currentHeadCharacterName);
            pbHead.Image = currentModel.Head;

            currentModel = currentModelFactory.createModel(currentTorsoCharacterName);
            pbTorso.Image = currentModel.Torso;

            currentModel = currentModelFactory.createModel(currentLegsCharacterName);
            pbLegs.Image = currentModel.Legs;
        }
Пример #6
0
        public SearchModule()
            : base("/search")
        {
            Get["/"] = parameters =>
            {
                var model = new Location();

                return View["index.html", model];
            };

            Get["/searchLocation"] = parameters =>
            {
                //TODO: validation
                string criteria = Request.Query["term"].Value;
                List<Location> result = new ModelFactory().SearchLocation(criteria);

                return Response.AsJson(result);
            };
        }
Пример #7
0
        public void Setup()
        {
            var modelFactory = new ModelFactory<UserModel>(() => new UserModel()); // {OnRestore = model => model.Invalidate()};
            var qandAFactory = new ModelFactory<QandAModel>(() => new QandAModel());
            UserRepository = new UserRepository(new RepositoryConfiguration(), modelFactory)
                                {Path = @"c:\temp\yoyyin\users"};

            UserRepository.Purge();

            //DevelopmentUserRepository = new DevelopmentUserRepository(new UserImporter(), new SniImporter(), UserRepository);

            QandARepository = new Repository<QandAModel>(new RepositoryConfiguration(), qandAFactory)
                                  {Path = @"c:\Temp\yoyyin\Q&A"};
            //UserRepository.SaveSnapshot();

            //UserRepository.InitializeWithDataFromSql();

            //Add5QuestionsAndAnswersPerUser(users);

            Console.Out.WriteLine("Revision is now {0}", UserRepository.Revision);
            //Console.Out.WriteLine("Model size is {0}", _repo.Query(m => m.Users.Count));
        }
Пример #8
0
        public async Task <ActionResult> Index(CartEditModel model)
        {
            if (!ModelState.IsValid)
            {
                var svcOrder = await CartUserService.GetCartOrderAsync(GetUserId());

                if (svcOrder == null)
                {
                    AddFeedbackMessage(FeedbackMessageTypes.Informational, "Your shopping cart is empty.");
                    return(RedirectToAction("Index", "Order"));
                }

                var order = ModelFactory.CreateCartEditModel(svcOrder);
                return(View(order));
            }

            // Apply changes to cart.
            //
            var actionData = this.GetActionData();

            switch (actionData.ActionName)
            {
            case Actions.Delete:
            {
                var orderItemId = int.Parse(actionData.ActionParameter);
                var result      = await CartUserService.DeleteCartItemAsync(GetUserId(), orderItemId);

                if (!result)
                {
                    throw new Exception("DeleteCartItemAsync failure.");
                }

                var svcOrder = await CartUserService.GetCartOrderAsync(GetUserId());

                if (svcOrder == null)
                {
                    AddFeedbackMessage(FeedbackMessageTypes.Informational, "Your shopping cart is empty.");
                    return(RedirectToAction("Index", "Order"));
                }

                model = ModelFactory.CreateCartEditModel(svcOrder);

                ModelState.Clear();
                AddFeedbackMessage(FeedbackMessageTypes.Informational, "Order updated.  Please review and click Continue to confirm.");
                return(View("Index", model));
            }

            case Actions.Continue:
            {
                var orderUpdated = false;         // Assume failure
                foreach (var item in model.Items)
                {
                    if (item.Quantity != item.OriginalQuantity)
                    {
                        _ = await CartUserService.UpdateCartItemQuantityAsync(GetUserId(), item.OrderItemId, item.Quantity);

                        orderUpdated = true;
                    }
                }

                if (orderUpdated)
                {
                    var svcOrder = await CartUserService.GetCartOrderAsync(GetUserId());

                    if (svcOrder == null)
                    {
                        AddFeedbackMessage(FeedbackMessageTypes.Informational, "Your shopping cart is empty.");
                        return(RedirectToAction("Index", "Order"));
                    }

                    model = ModelFactory.CreateCartEditModel(svcOrder);

                    ModelState.Clear();
                    AddFeedbackMessage(FeedbackMessageTypes.Informational, "Order updated.  Please review and click Continue to confirm.");
                    return(View("Index", model));
                }
                else
                {
                    return(RedirectToAction("Shipping"));
                }
            }

            default:
                throw new InvalidOperationException(string.Format("Unknown action {0}", actionData.ActionName));
            }
        }
 public UserRoleService(ModelFactory <UserRole> factory)
 {
 }
Пример #10
0
 public DataFile(string path)
 {
     _fileStream = new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
     WriteBlankBlock();
     MasterHashTable = ModelFactory.GetModel <HashTable>(new byte[BlockLength]);
 }
Пример #11
0
 public DataStoreRepository()
 {
     _context      = new DCDbContext();
     _modelFactory = new ModelFactory();
 }
Пример #12
0
    public void InitBattleScene()
    {
        FF9StateGlobal FF9 = FF9StateSystem.Common.FF9;

        FF9.charArray.Clear();
        this.btlScene = FF9StateSystem.Battle.FF9Battle.btl_scene = new BTL_SCENE();
        Debug.Log("battleID = " + FF9StateSystem.Battle.battleMapIndex);
        Dictionary <String, Int32> source = FF9BattleDB.SceneData;

        battleSceneName = source.FirstOrDefault(p => p.Value == FF9StateSystem.Battle.battleMapIndex).Key;
        battleSceneName = battleSceneName.Substring(4);
        Debug.Log("battleSceneName = " + battleSceneName);
        this.btlScene.ReadBattleScene(battleSceneName);
        this.StartCoroutine(PersistenSingleton <FF9TextTool> .Instance.UpdateBattleText(FF9BattleDB.SceneData["BSC_" + battleSceneName]));
        WMProfiler.Begin("Start Load Text");
        String battleModelPath = FF9BattleDB.MapModel["BSC_" + battleSceneName];

        FF9StateSystem.Battle.FF9Battle.map.btlBGPtr     = ModelFactory.CreateModel("BattleMap/BattleModel/battleMap_all/" + battleModelPath + "/" + battleModelPath, Vector3.zero, Vector3.zero, true);
        FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum = FF9StateSystem.Battle.isDebug ? FF9StateSystem.Battle.patternIndex : (Byte)this.ChoicePattern();
        this.btlSeq = new btlseq();
        this.btlSeq.ReadBattleSequence(battleSceneName);
        BeginInitialize();
        battle.InitBattle();
        EndInitialize();
        if (!FF9StateSystem.Battle.isDebug)
        {
            String            ebFileName        = "EVT_BATTLE_" + battleSceneName;
            FF9StateBattleMap ff9StateBattleMap = FF9StateSystem.Battle.FF9Battle.map;
            ff9StateBattleMap.evtPtr = EventEngineUtils.loadEventData(ebFileName, "Battle/");
            PersistenSingleton <EventEngine> .Instance.StartEvents(ff9StateBattleMap.evtPtr);

            PersistenSingleton <EventEngine> .Instance.eTb.InitMessage();
        }
        this.CreateBattleData(FF9);
        if (battleSceneName == "EF_E006" || battleSceneName == "EF_E007")
        {
            BTL_DATA btlData1 = FF9StateSystem.Battle.FF9Battle.btl_data[4];
            BTL_DATA btlData2 = FF9StateSystem.Battle.FF9Battle.btl_data[5];
            this.GeoBattleAttach(btlData2.gameObject, btlData1.gameObject, 55);
            btlData2.attachOffset = 100;
        }
        FF9StateBattleSystem stateBattleSystem = FF9StateSystem.Battle.FF9Battle;
        GEOTEXHEADER         geotexheader      = new GEOTEXHEADER();

        geotexheader.ReadBGTextureAnim(battleModelPath);
        stateBattleSystem.map.btlBGTexAnimPtr = geotexheader;
        BBGINFO bbginfo = new BBGINFO();

        bbginfo.ReadBattleInfo(battleModelPath);
        FF9StateSystem.Battle.FF9Battle.map.btlBGInfoPtr = bbginfo;
        btlshadow.ff9battleShadowInit(13);
        battle.InitBattleMap();
        this.seqList = new List <Int32>();
        SB2_PATTERN sb2Pattern = this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum];

        Int32[] numArray = new Int32[sb2Pattern.MonCount];
        for (Int32 index = 0; index < (Int32)sb2Pattern.MonCount; ++index)
        {
            numArray[index] = sb2Pattern.Put[index].TypeNo;
        }
        foreach (Int32 num in numArray.Distinct().ToArray())
        {
            for (Int32 index1 = 0; index1 < this.btlSeq.sequenceProperty.Length; ++index1)
            {
                SequenceProperty sequenceProperty = this.btlSeq.sequenceProperty[index1];
                if (sequenceProperty.Montype == num)
                {
                    for (Int32 index2 = 0; index2 < sequenceProperty.PlayableSequence.Count; ++index2)
                    {
                        this.seqList.Add(sequenceProperty.PlayableSequence[index2]);
                    }
                }
            }
        }
        this.btlIDList          = FF9StateSystem.Battle.FF9Battle.seq_work_set.AnmOfsList.Distinct().ToArray();
        this.battleState        = BattleState.PlayerTurn;
        playerEnterCommand      = false;
        this.playerCastingSkill = false;
        this.enemyEnterCommand  = false;
    }
Пример #13
0
 public IActionResult Get(int id)
 {
     var user = DataService.GetUser(id);
     if (user == null) return NotFound();
     return Ok(ModelFactory.uMap(user, Url));
 }
Пример #14
0
 public OrganizationSearchPresenter(IOrganizationSearchView view)
 {
     _model = ModelFactory.CreateOrganizationSearchModel();
     _view  = view;
 }
Пример #15
0
        public async Task <IHttpActionResult> Search([FromUri] PagingOptions pagingOptions, [FromUri] string q = null)
        {
            IQueryable <Project> results = DbContext.Projects;

            if (!string.IsNullOrWhiteSpace(q))
            {
                results = results.Where(o => o.Name.Contains(q));
            }

            results = results.OrderBy(o => o.Name);

            return(Ok((await GetPaginatedResponse(results, pagingOptions)).Select(o => ModelFactory.Create(o))));
        }
Пример #16
0
 public FieldNote(ModelFactory parentSchema, string internalName)
     : base(parentSchema, internalName)
 {
     FieldType = Microsoft.SharePoint.SPFieldType.Note;
 }
Пример #17
0
 public ValuesController(ModelFactory modelFactory)
 {
     _modelFactory = modelFactory;
 }
Пример #18
0
        public async Task <IActionResult> Excel()
        {
            string   webRoot  = _env.WebRootPath;
            string   filename = @"demo1.xlsx";
            string   URL      = string.Format("{0}://{1}/{2}", Request.Scheme, Request.Host, filename);
            FileInfo file     = new FileInfo(Path.Combine(webRoot, filename));

            ViewBag.URLEXCEL = URL;

            if (file.Exists)
            {
                file.Delete();
                file = new FileInfo(Path.Combine(webRoot, filename));
            }

            // var nalozi = ModelFactory.GetRNalozi(_context.RadniNalozi.Include(v => v.VrstaRada).Include(m => m.MjestoRada).Include(a => a.Automobil).ToList());

            var nalozi = ModelFactory.GetRNalozi(_context.RadniNalozi
                                                 .Include(v => v.VrstaRada).
                                                 Include(m => m.MjestoRada).ThenInclude(mj => mj.Podrucje).
                                                 Include(m => m.MjestoRada).ThenInclude(mj => mj.TipDas).Include(m => m.MjestoRada).ThenInclude(mj => mj.TipPostrojenja).
                                                 Include(izvr => izvr.Rukovoditelj)
                                                 .Include(izvr2 => izvr2.Izvrsitelj2)
                                                 .Include(izvr3 => izvr3.Izvrsitelj3)
                                                 .Include(a => a.Automobil).ToList());


            var count = nalozi.Count;


            var memory = new MemoryStream();

            using (var fs = new FileStream(Path.Combine(webRoot, filename), FileMode.Create, FileAccess.Write))
            {
                IWorkbook workbook;
                workbook = new XSSFWorkbook();
                ISheet excelSheet = workbook.CreateSheet("Nalozi");

                IRow row = excelSheet.CreateRow(0);



                //header row
                row.CreateCell(0).SetCellValue("ID");
                row.CreateCell(1).SetCellValue("Datum");
                row.CreateCell(2).SetCellValue("Opis Radova");
                row.CreateCell(3).SetCellValue("Materijal");
                row.CreateCell(4).SetCellValue("Rukovoditelj");
                row.CreateCell(5).SetCellValue("Izvrsitelj1");
                row.CreateCell(6).SetCellValue("Izvrsitelj2");
                // row.CreateCell(7).SetCellValue("Putni Nalog");
                row.CreateCell(7).SetCellValue("Automobil");
                row.CreateCell(8).SetCellValue("Vrsta Rada");
                row.CreateCell(9).SetCellValue("Mjesto Rada");


                for (int i = 0; i < count; i++)
                {
                    row = excelSheet.CreateRow(i + 1);



                    //ispraviti excel
                    row.CreateCell(0).SetCellValue(nalozi.ElementAt(i).ID);
                    row.CreateCell(1).SetCellValue(nalozi.ElementAt(i).Datum);
                    row.CreateCell(2).SetCellValue(nalozi.ElementAt(i).OpisRadova);
                    row.CreateCell(3).SetCellValue(nalozi.ElementAt(i).Materijal);
                    row.CreateCell(4).SetCellValue(nalozi.ElementAt(i).Rukovoditelj.Ime);
                    row.CreateCell(5).SetCellValue(nalozi.ElementAt(i).Izvrsitelj2.Ime);
                    row.CreateCell(6).SetCellValue(nalozi.ElementAt(i).Izvrsitelj3.Ime);
                    //   row.CreateCell(7).SetCellValue(nalozi.ElementAt(i).PutniNalog);
                    row.CreateCell(7).SetCellValue(nalozi.ElementAt(i).Automobil.Registracija);
                    row.CreateCell(8).SetCellValue(nalozi.ElementAt(i).VrstaRada.Naziv);
                    row.CreateCell(9).SetCellValue(nalozi.ElementAt(i).MjestoRada.Ime);
                }



                workbook.Write(fs);
            }
            using (var stream = new FileStream(Path.Combine(webRoot, filename), FileMode.Open))
            {
                await stream.CopyToAsync(memory);
            }
            memory.Position = 0;
            return(File(memory, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename));
        }
Пример #19
0
 public BranchesController()
 {
     this.modelFactory = new ModelFactory();
 }
Пример #20
0
 public ActionResult Footer()
 {
     return(PartialView("_footer", ModelFactory.IndexModel()));
 }
Пример #21
0
 public DaylogsController(IGymLogRepository repo, ModelFactory modelFactory)
 {
     _repo         = repo;
     _modelFactory = modelFactory;
 }
 /// <summary>
 /// Initializes the <see cref="ModelFactoryService"/> class.
 /// </summary>
 static ModelFactoryService()
 {
     _prototypeModelFactory = new ModelFactory();
     ModelFactories         = new Dictionary <Type, IModelFactory>();
 }
Пример #23
0
        public async Task <IHttpActionResult> Search([FromUri] PagingOptions pagingOptions, [FromUri] string q = null, [FromUri] Guid?projectId = null, [FromUri] Guid?primaryFieldId = null)
        {
            if (pagingOptions == null)
            {
                pagingOptions = new PagingOptions();
            }

            IQueryable <Entity> results = DbContext.Entities;

            if (pagingOptions.IncludeEntities)
            {
                results = results.Include(o => o.Project);
                results = results.Include(o => o.PrimaryField);
            }

            if (!string.IsNullOrWhiteSpace(q))
            {
                results = results.Where(o => o.Name.Contains(q));
            }

            if (projectId.HasValue)
            {
                results = results.Where(o => o.ProjectId == projectId);
            }
            if (primaryFieldId.HasValue)
            {
                results = results.Where(o => o.PrimaryFieldId == primaryFieldId);
            }

            results = results.OrderBy(o => o.Name);

            return(Ok((await GetPaginatedResponse(results, pagingOptions)).Select(o => ModelFactory.Create(o))));
        }
        protected override void AddAttributes(AttributeTableBuilder builder)
        {
            GenericDefaultInitializer.SetAction(
                typeof(SSWC.Expander),
                (modelitem, context) =>
            {
                ModelItem newGrid = ModelFactory.CreateItem(context, typeof(SSWC.Grid), CreateOptions.InitializeDefaults);
                newGrid.Properties["Height"].SetValue(Double.NaN);
                newGrid.Properties["Width"].SetValue(Double.NaN);
                newGrid.Properties["HorizontalAlignment"].SetValue(SSW.HorizontalAlignment.Stretch);
                newGrid.Properties["VerticalAlignment"].SetValue(SSW.VerticalAlignment.Stretch);
                modelitem.Content.SetValue(newGrid);
            });

            GenericDefaultInitializer.AddDefault <SSWC.WrapPanel>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.WrapPanel>(x => x.Width, 200d);

            GenericDefaultInitializer.AddDefault <SSWC.Expander>(x => x.Height, 100d);
            GenericDefaultInitializer.AddDefault <SSWC.Expander>(x => x.Width, 150d);

            GenericDefaultInitializer.SetAction(
                typeof(SSWC.HeaderedContentControl),
                (modelitem, context) =>
            {
                ModelItem newGrid = ModelFactory.CreateItem(context, typeof(SSWC.Grid), CreateOptions.InitializeDefaults);
                newGrid.Properties["Height"].SetValue(Double.NaN);
                newGrid.Properties["Width"].SetValue(Double.NaN);
                newGrid.Properties["HorizontalAlignment"].SetValue(SSW.HorizontalAlignment.Stretch);
                newGrid.Properties["VerticalAlignment"].SetValue(SSW.VerticalAlignment.Stretch);
                modelitem.Content.SetValue(newGrid);
            });

            GenericDefaultInitializer.AddDefault <SSWC.HeaderedContentControl>(x => x.Height, 16d);
            GenericDefaultInitializer.AddDefault <SSWC.HeaderedContentControl>(x => x.Width, 120d);

            builder.AddCallback(
                typeof(SSWC.HeaderedContentControl),
                b => b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer))));
            builder.AddCallback(
                typeof(SSWC.WrapPanel),
                b => b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer))));
            builder.AddCallback(
                typeof(SSWC.Expander),
                b => b.AddCustomAttributes(new FeatureAttribute(typeof(GenericDefaultInitializer))));

            builder.AddCallback(
                typeof(SSWCP.GlobalCalendarButton),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(SSWCP.GlobalCalendarDayButton),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(SSWCP.GlobalCalendarItem),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));

            builder.AddCallback(
                typeof(SSWC.TreeViewItemCheckBox),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));

            builder.AddCallback(
                typeof(SSWC.ListBoxDragDropTarget),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
            builder.AddCallback(
                typeof(SSWC.TreeViewDragDropTarget),
                b => b.AddCustomAttributes(new ToolboxBrowsableAttribute(false)));
        }
Пример #25
0
        public IHttpActionResult Get(int userId, int page = 0, int pagesize = Config.DefaultPageSize)
        {
            var data = _repository.GetAnswersWithUserId(userId, pagesize, page * pagesize).Select(u => ModelFactory.Map(u, Url));

            if (!data.Any())
            {
                return(NotFound());
            }

            var result = GetWithPaging(
                data,
                pagesize,
                page,
                _repository.GetNumbersOfAnswersWithUserId(userId),
                Config.UsersAnswersRoute);

            return(Ok(result));
        }
Пример #26
0
        static void Main(string[] args)
        {
            const string pnUniqueKey  = "UniqueKey";
            const string pnFilename   = "Filename";
            const string pnFQN        = "FQN";
            const string pnType       = "Type";
            const string pnName       = "Name";
            const string pnSignature  = "Signature";
            const string pnReturnType = "ReturnType";
            const string pnModuleFQN  = "ModuleFQN";
            const string pnVersion    = "Version";

            //var pdUniqueKey =   ModelFactory.NewPropertyDef(pnUniqueKey, ModelConst.PropertyDataType.stringType);
            //var pdFileName =    ModelFactory.NewPropertyDef(pnFilename, ModelConst.PropertyDataType.stringType);
            //var pdFQN =         ModelFactory.NewPropertyDef(pnFQN, ModelConst.PropertyDataType.stringType);
            //var pdType =        ModelFactory.NewPropertyDef(pnType, ModelConst.PropertyDataType.stringType);
            //var pdName =        ModelFactory.NewPropertyDef(pnName, ModelConst.PropertyDataType.stringType);
            //var pdSignature =   ModelFactory.NewPropertyDef(pnSignature, ModelConst.PropertyDataType.stringType);
            //var pdReturnType =  ModelFactory.NewPropertyDef(pnReturnType, ModelConst.PropertyDataType.stringType);
            //var pdModuleFQN =   ModelFactory.NewPropertyDef(pnModuleFQN, ModelConst.PropertyDataType.stringType);
            //var pdVersion =     ModelFactory.NewPropertyDef(pnVersion, ModelConst.PropertyDataType.stringType);

            //var propdefs0 =     ModelFactory.NewPropertyDefs(
            //    new propertydef[]
            //    {
            //        pdFileName,
            //        pdFQN,
            //        pdModuleFQN,
            //        pdName,
            //        pdReturnType,
            //        pdSignature,
            //        pdType,
            //        pdUniqueKey,
            //        pdVersion
            //    });

            //model.propertydefs.Add(propdefs0);

            //const string enameTest = "Test6 Element";
            //var element0 = ModelFactory.NewElement(enameTest, ModelConst.ElementType.Artifact);
            //var property0 = ModelFactory.NewProperty(ModelFactory.NewValue(Guid.NewGuid().ToString()), pdUniqueKey);
            //var properties0 = ModelFactory.NewProperties(new property[] { property0 });

            //element0.properties.Add(properties0);

            //var elements = ModelFactory.NewElements(element0);

            //model.elements.Add(elements);

            const string tnameTest = "Test6 Tenant";
            const string mnameTest = "Test6 Model";
            const string vnameTest = "Test6 View";

            ModelFactory.TenantName = tnameTest;
            ModelFactory.ModelName  = mnameTest;

            var tenant  = ModelFactory.NewTenantWithRootFolder(tnameTest);
            var folder0 = tenant.folders.ElementAt <folders>(0).folder.ElementAt(0);

            var model  = ModelFactory.NewModel(mnameTest);
            var models = ModelFactory.NewModels(model);

            folder0.models.Add(models);


            var vView0 = ModelFactory.NewView(vnameTest);
            var views  = ModelFactory.NewViews(new view[] { vView0 });

            model.views.Add(views);

            const string lApplication           = "Application";
            const string lApplications          = "Applications";
            const string lApplicationComponents = "Application Components";
            const string lApplicationInterfaces = "Application Interfaces";
            var          iApplication           = ModelFactory.NewItem(lApplication);
            var          iApplications          = ModelFactory.NewItem(lApplications);
            var          iApplicationComponents = ModelFactory.NewItem(lApplicationComponents);
            var          iApplicationInterfaces = ModelFactory.NewItem(lApplicationInterfaces);

            iApplication.item1.Add(iApplications);
            iApplications.item1.Add(iApplicationComponents);
            iApplications.item1.Add(iApplicationInterfaces);

            const string lTechnology           = "Technology";
            const string lArtifacts            = "Artifacts";
            const string lTechnologyInterfaces = "Technology Interfaces";
            const string lSystemSoftware       = "System Software";
            var          iTechnology           = ModelFactory.NewItem(lTechnology);
            var          iArtifacts            = ModelFactory.NewItem(lArtifacts);
            var          iTechnologyInterfaces = ModelFactory.NewItem(lTechnologyInterfaces);
            var          iSystemSoftware       = ModelFactory.NewItem(lSystemSoftware);

            iTechnology.item1.Add(iArtifacts);
            iTechnology.item1.Add(iTechnologyInterfaces);
            iTechnology.item1.Add(iSystemSoftware);

            const string lRelations = "Relations";
            var          iRelations = ModelFactory.NewItem(lRelations);

            const string lViews = "Views";
            var          iViews = ModelFactory.NewItem(lViews);
            var          iView0 = ModelFactory.NewItem(vView0);

            iViews.item1.Add(iView0);

            //var item0 = ModelFactory.NewItem(element0);

            //iArtifacts.item1.Add(item0);

            var organization = ModelFactory.NewOrganization(new item[] { iApplication, iTechnology, iRelations, iViews });

            model.organization.Add(organization);

            using (var ctx = new ModelMateEFModel9Context())
            {
                ctx.Database.Log = Console.Write;

                ctx.tenant.Add(tenant);
                ctx.SaveChanges();
            }

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }
 public TransformersController(IDatastore datastore, IWarResolver warResolver, ModelFactory factory)
 {
     _datastore   = datastore;
     _warResolver = warResolver;
     _factory     = factory;
 }
Пример #28
0
        public void ConvertToGod(string targetPath, string name, bool crop)
        {
            var  size           = crop ? _xiso.RealSize : _xiso.VolumeSize;
            long pos            = 0;
            var  dataBlockCount = (int)Math.Ceiling(((double)size) / 0x1000);
            var  dataFileCount  = (int)Math.Ceiling(((double)dataBlockCount) / 0xa1c4);
            var  contentType    = _xiso.ContentType;
            var  uniqueName     = GetUniqueName(_xiso);
            var  path           = System.IO.Path.Combine(targetPath, _xiso.Details.TitleId, ((int)contentType).ToString("X8"), uniqueName);

            var  blockIndex = 0;
            long godSize    = 0;

            _xiso.Seek(0);
            var       stack     = new Stack <DataFile>();
            HashTable lastTable = null;

            //write parts
            for (var i = 0; i < dataFileCount; i++)
            {
                OnProgressChanged(string.Format(Resources.WritingPart + Strings.DotDotDot, i + 1, dataFileCount));

                Directory.CreateDirectory(path + ".data");
                var dataPath = string.Format("{0}.data\\Data{1:D4}", path, i);
                var f        = new DataFile(dataPath);
                for (var j = 0; j < 0xcb; j++) // subhashtable per masterhashtable
                {
                    var table = ModelFactory.GetModel <HashTable>(new byte[DataFile.BlockLength]);
                    f.WriteBlankBlock();
                    long blockPerTable = 0;
                    while ((blockIndex < dataBlockCount) && (blockPerTable < 0xcc)) // block per subhashtable
                    {
                        var buffer = _xiso.ReadBytes(DataFile.BlockLength);
                        pos += buffer.Length;
                        if (buffer.Length < DataFile.BlockLength)
                        {
                            Array.Resize(ref buffer, DataFile.BlockLength);
                        }
                        var blockHash = _sha1.ComputeHash(buffer, 0, DataFile.BlockLength);
                        table.Entries[blockPerTable].BlockHash = blockHash;
                        f.Write(buffer);
                        blockIndex++;
                        blockPerTable++;
                    }
                    OnProgressChanged((int)(pos * 100 / size));
                    var position   = f.Position;
                    var tableBytes = table.Binary.ReadAll();
                    f.Seek(0 - ((blockPerTable + 1) * DataFile.BlockLength), SeekOrigin.Current);
                    f.Write(tableBytes);
                    f.Seek(position, SeekOrigin.Begin);
                    var masterHash = _sha1.ComputeHash(tableBytes, 0, DataFile.BlockLength);
                    f.SetBlockHash(j, masterHash);
                    if (blockIndex >= dataBlockCount)
                    {
                        break;
                    }
                }
                if (blockIndex >= dataBlockCount)
                {
                    lastTable = f.MasterHashTable;
                    f.WriteMasterHashBlock();
                    godSize = f.Length;
                    f.Close();
                    break;
                }
                stack.Push(f);
            }

            //calculate mht hash chain
            OnProgressChanged(Resources.CalculatingMasterHashTablechain + Strings.DotDotDot);
            foreach (var f in stack)
            {
                var tableBytes = lastTable.Binary.ReadAll();
                var masterHash = _sha1.ComputeHash(tableBytes, 0, DataFile.BlockLength);
                f.SetBlockHash(0xcb, masterHash);
                f.WriteMasterHashBlock();
                godSize += f.Length;
                f.Close();
                lastTable = f.MasterHashTable;
            }

            //create con header
            OnProgressChanged(Resources.CreatingHeaderFile + Strings.DotDotDot);
            var conHeader = ResourceHelper.GetEmptyConHeader();

            conHeader.TitleId        = _xiso.Details.TitleId;
            conHeader.MediaId        = _xiso.Details.MediaId;
            conHeader.Version        = _xiso.Details.Version;
            conHeader.BaseVersion    = _xiso.Details.BaseVersion;
            conHeader.DisplayName    = name;
            conHeader.TitleName      = name;
            conHeader.Platform       = _xiso.Details.Platform;
            conHeader.ExecutableType = _xiso.Details.ExecutionType;
            conHeader.DiscNumber     = _xiso.Details.DiscNumber;
            conHeader.DiscInSet      = _xiso.Details.DiscCount;
            conHeader.VolumeDescriptor.DeviceFeatures  = 0;
            conHeader.VolumeDescriptor.DataBlockCount  = dataBlockCount;
            conHeader.VolumeDescriptor.DataBlockOffset = 0;
            conHeader.VolumeDescriptor.Hash            = _sha1.ComputeHash(lastTable.Binary.ReadAll(), 0, DataFile.BlockLength);
            conHeader.DataFileCount           = dataFileCount;
            conHeader.DataFileCombinedSize    = godSize;
            conHeader.DescriptorType          = VolumeDescriptorType.SVOD;
            conHeader.ThumbnailImage          = _xiso.Details.Thumbnail;
            conHeader.ThumbnailImageSize      = _xiso.Details.Thumbnail.Length;
            conHeader.TitleThumbnailImage     = _xiso.Details.Thumbnail;
            conHeader.TitleThumbnailImageSize = _xiso.Details.Thumbnail.Length;
            conHeader.ContentType             = _xiso.ContentType;

            //conHeader.Resign();
            conHeader.HeaderHash = conHeader.HashBlock(0x344, 0xacbc);
            conHeader.Save(path);
        }
Пример #29
0
    private void CreateBattleData(FF9StateGlobal FF9)
    {
        BTL_DATA[] btlDataArray = btlseq.btl_list = FF9StateSystem.Battle.FF9Battle.btl_data;
        Int32      index1       = 0;

        for (Int32 index2 = index1; index2 < 4; ++index2)
        {
            btlDataArray[index2] = new BTL_DATA();
            if (FF9.party.member[index2] != null)
            {
                Byte num = FF9.party.member[index2].info.serial_no;
                BattlePlayerCharacter.CreatePlayer(btlDataArray[index1], (BattlePlayerCharacter.PlayerSerialNumber)num);
                Int32       length     = 0;
                IEnumerator enumerator = btlDataArray[index1].gameObject.transform.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        if ((enumerator.Current as UnityEngine.Object)?.name.Contains("mesh") == true)
                        {
                            ++length;
                        }
                    }
                }
                finally
                {
                    IDisposable disposable = enumerator as IDisposable;
                    disposable?.Dispose();
                }
                btlDataArray[index1].meshIsRendering = new Boolean[length];
                for (Int32 index3 = 0; index3 < length; ++index3)
                {
                    btlDataArray[index1].meshIsRendering[index3] = true;
                }
                btlDataArray[index1].meshCount = length;
                btlDataArray[index1].animation = btlDataArray[index1].gameObject.GetComponent <Animation>();
                ++index1;
            }
            btlDataArray[index2].typeNo            = 5;
            btlDataArray[index2].idleAnimationName = this.animationName[index2];
        }
        for (Int32 index2 = 4; index2 < 4 + (Int32)this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum].MonCount; ++index2)
        {
            SB2_PATTERN  sb2Pattern = this.btlScene.PatAddr[FF9StateSystem.Battle.FF9Battle.btl_scene.PatNum];
            Byte         num        = sb2Pattern.Put[index2 - 4].TypeNo;
            SB2_MON_PARM sb2MonParm = this.btlScene.MonAddr[num];
            String       path       = FF9BattleDB.GEO[sb2MonParm.Geo];
            //var vector3 = new Vector3(sb2Pattern.Put[index2 - 4].Xpos, sb2Pattern.Put[index2 - 4].Ypos * -1, sb2Pattern.Put[index2 - 4].Zpos);
            btlDataArray[index2] = new BTL_DATA {
                gameObject = ModelFactory.CreateModel(path, true)
            };
            if (ModelFactory.IsUseAsEnemyCharacter(path))
            {
                if (path.Contains("GEO_MON_B3_168"))
                {
                    btlDataArray[index2].gameObject.transform.FindChild("mesh5").gameObject.SetActive(false);
                }
                btlDataArray[index2].weapon_geo = ModelFactory.CreateDefaultWeaponForCharacterWhenUseAsEnemy(path);
                MeshRenderer[] componentsInChildren = btlDataArray[index2].weapon_geo.GetComponentsInChildren <MeshRenderer>();
                btlDataArray[index2].weaponMeshCount = componentsInChildren.Length;
                btlDataArray[index2].weaponRenderer  = new Renderer[btlDataArray[index2].weaponMeshCount];
                for (Int32 index3 = 0; index3 < btlDataArray[index2].weaponMeshCount; ++index3)
                {
                    btlDataArray[index2].weaponRenderer[index3] = componentsInChildren[index3].GetComponent <Renderer>();
                }
                geo.geoAttach(btlDataArray[index2].weapon_geo, btlDataArray[index2].gameObject, ModelFactory.GetDefaultWeaponBoneIdForCharacterWhenUseAsEnemy(path));
            }
            Int32       length     = 0;
            IEnumerator enumerator = btlDataArray[index2].gameObject.transform.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    if ((enumerator.Current as UnityEngine.Object)?.name.Contains("mesh") == true)
                    {
                        ++length;
                    }
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                disposable?.Dispose();
            }
            btlDataArray[index2].meshIsRendering = new Boolean[length];
            for (Int32 index3 = 0; index3 < length; ++index3)
            {
                btlDataArray[index2].meshIsRendering[index3] = true;
            }
            btlDataArray[index2].meshCount         = length;
            btlDataArray[index2].animation         = btlDataArray[index2].gameObject.GetComponent <Animation>();
            btlDataArray[index2].animation         = btlDataArray[index2].gameObject.GetComponent <Animation>();
            btlDataArray[index2].typeNo            = num;
            btlDataArray[index2].idleAnimationName = this.animationName[index2];
        }
    }
Пример #30
0
        public void RunApplication(IModelFactory dotNetModelFactory)
        {
            if (dotNetModelFactory != null)
            {
                // Tell OpenDA what model factory to use
                ModelFactory.InsertModelFactory(dotNetModelFactory);
            }
            // run the openda application
            ApplicationRunnerSingleThreaded applicationRunner;

            try
            {
                applicationRunner = new ApplicationRunnerSingleThreaded();
                applicationRunner.initialize(new java.io.File(odaDirectoryName), odaFileName);
                applicationRunner.runSingleThreaded();
            }
            catch (Exception e)
            {
                String message = "Error running OpenDA application.\nDetailed error message: " + e.Message;
                ModelFactory.AppendLogMessage(message);
                Console.WriteLine(message);
                return;
            }

            if (true)             // TODO: applicationRunner.getStatus()== ApplicationRunnerJ2N.Status.FINISHED // DONE)
            {
                // get a reference to the model instance selected by the algorithm as optimal

                IAlgorithm          algorithm = applicationRunner.getAlgorithm();
                IStochModelInstance calibratedStochModel;
                if (algorithm is Dud)
                {
                    Dud dud = ((Dud)algorithm);
                    calibratedStochModel = dud.getBestEstimate();
                }
                else if (algorithm is SparseDud)
                {
                    SparseDud sparseDud = ((SparseDud)algorithm);
                    calibratedStochModel = sparseDud.getBestEstimate();
                }
                else if (algorithm is Powell)
                {
                    Powell powell = ((Powell)algorithm);
                    calibratedStochModel = powell.getBestEstimate();
                }
                else if (algorithm is Simplex)
                {
                    Simplex simplex = ((Simplex)algorithm);
                    calibratedStochModel = simplex.getBestEstimate();
                }
                else if (algorithm is AbstractSequentialAlgorithm)
                {
                    AbstractSequentialAlgorithm asAlgorithm = ((AbstractSequentialAlgorithm)algorithm);
                    calibratedStochModel = asAlgorithm.getMainModel();
                    if (calibratedStochModel == null)
                    {
                        Console.WriteLine("No main model set by ensemble algorithm");
                        return;
                    }
                }
                else
                {
                    Console.WriteLine("Unknown Algoritm type: " + algorithm.GetType());
                    return;
                }

                // Get the model instance out of the stochModel->java2dotnet->modelInstance layers
                if (calibratedStochModel is BBStochModelInstance)
                {
                    org.openda.interfaces.IModelInstance modelInstance = ((BBStochModelInstance)calibratedStochModel).getModel();
                    if (modelInstance is ModelInstanceN2J)
                    {
                        ResultingModelInstance = ((ModelInstanceN2J)modelInstance).getDotNetModelInstance();
                    }
                    else
                    {
                        string message = "Unknown java 2 dotnet model instance type: " + modelInstance.GetType();
                        ModelFactory.AppendLogMessage(message);
                        Console.WriteLine(message);
                    }
                }
                else
                {
                    string message = "Unknown Stoch model instance type: " + calibratedStochModel.GetType();
                    ModelFactory.AppendLogMessage(message);
                    Console.WriteLine(message);
                }
            }
        }
Пример #31
0
 public IActionResult Post([FromBody] UserModel model)
 {
     var user = ModelFactory.uMap(model);
     DataService.AddUser(user);
     return Ok(ModelFactory.uMap(user, Url));
 }
        public override Task InitializeResourcesAsync(ModelFactory factory)
        {
            var tasks = GetResourceInitializers(factory).ToList();

            return(Task.WhenAll(tasks));
        }
Пример #33
0
        // Initiates the game
        private void preInitGame()
        {
            // Variables
            ModelContentStream	mcs;

            difficulty=	0;
            pUpdateFunc=	defaultUpdateFunc;
            pRenderFunc=	defaultRenderFunc;
            e_input=	null;
            loadedSounds=	new FDictionary<string, Sound>();
            loadedTextures=	new FDictionary<string, Texture>();
            loadedFonts=	new FDictionary<string, Font>();
            loadedModels=	new ModelFactory();
            window=	new GameFrame(this);
            GameInput.init(this);
            content=	new ContentManager();
            statesys=	new GameStateSystem(this);
            gui=	new GUI(this);
            sounds=	new AudioPlayer(this);
            host=	new AServerHost();

            mcs=	new ModelContentStream(this);
            content.addReader(new TextureContentReader());
            content.addReader(new FontContentReader(this));
            content.addReader(new SoundContentReader());
            content.addReader(mcs);
            content.addWriter(mcs);
            window.viewport.onRender+=	render;
        }
Пример #34
0
        public static void Initialize()
        {
            if (pdc[(int)CecilConst.PropertyName.UniqueKey] == null)
            {
                ModelConst.PropertyDataType pdtString = ModelConst.PropertyDataType.stringType;
                propertydef pdUniqueKey            = ModelFactory.NewPropertyDef(CecilConst.PropertyName.UniqueKey.ToString(), pdtString);
                propertydef pdFilename             = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Filename.ToString(), pdtString);
                propertydef pdFQName               = ModelFactory.NewPropertyDef(CecilConst.PropertyName.FQName.ToString(), pdtString);
                propertydef pdType                 = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Type.ToString(), pdtString);
                propertydef pdName                 = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Name.ToString(), pdtString);
                propertydef pdSignature            = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Signature.ToString(), pdtString);
                propertydef pdReturnType           = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ReturnType.ToString(), pdtString);
                propertydef pdVersion              = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Version.ToString(), pdtString);
                propertydef pdAllReferencesCount   = ModelFactory.NewPropertyDef(CecilConst.PropertyName.AllReferencesCount.ToString(), ModelConst.PropertyDataType.numberType);
                propertydef pdNamespace            = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Namespace.ToString(), pdtString);
                propertydef pdFQFilename           = ModelFactory.NewPropertyDef(CecilConst.PropertyName.FQFilename.ToString(), pdtString);
                propertydef pdFullName             = ModelFactory.NewPropertyDef(CecilConst.PropertyName.FullName.ToString(), pdtString);
                propertydef pdParentAssembly       = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ParentAssembly.ToString(), pdtString);
                propertydef pdParentModule         = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ParentModule.ToString(), pdtString);
                propertydef pdModuleOffset         = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ModuleOffset.ToString(), pdtString);
                propertydef pdParentFile           = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ParentFile.ToString(), pdtString);
                propertydef pdParentTypeDefinition = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ParentTypeDefinition.ToString(), pdtString);
                propertydef pdIsPublic             = ModelFactory.NewPropertyDef(CecilConst.PropertyName.IsPublic.ToString(), ModelConst.PropertyDataType.booleanType);
                propertydef pdArchiMateElementType = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ArchiMateElementType.ToString(), pdtString);
                propertydef pdCreated              = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Created.ToString(), ModelConst.PropertyDataType.dateType);
                propertydef pdLastAccessed         = ModelFactory.NewPropertyDef(CecilConst.PropertyName.LastAccessed.ToString(), ModelConst.PropertyDataType.dateType);
                propertydef pdLastWritten          = ModelFactory.NewPropertyDef(CecilConst.PropertyName.LastWritten.ToString(), ModelConst.PropertyDataType.dateType);
                propertydef pdLength               = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Length.ToString(), ModelConst.PropertyDataType.numberType);
                propertydef pdExtension            = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Extension.ToString(), pdtString);
                propertydef pdPublicKeyToken       = ModelFactory.NewPropertyDef(CecilConst.PropertyName.PublicKeyToken.ToString(), pdtString);
                propertydef pdCulture              = ModelFactory.NewPropertyDef(CecilConst.PropertyName.Culture.ToString(), pdtString);
                propertydef pdAPIType              = ModelFactory.NewPropertyDef(CecilConst.PropertyName.APIType.ToString(), pdtString);
                propertydef pdBaseType             = ModelFactory.NewPropertyDef(CecilConst.PropertyName.BaseType.ToString(), pdtString);
                propertydef pdParameterCount       = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ParameterCount.ToString(), ModelConst.PropertyDataType.numberType);
                propertydef pdDeclaringType        = ModelFactory.NewPropertyDef(CecilConst.PropertyName.DeclaringType.ToString(), pdtString);
                propertydef pdSourceIdentifier     = ModelFactory.NewPropertyDef(CecilConst.PropertyName.SourceIdentifier.ToString(), pdtString);
                propertydef pdTargetIdentifier     = ModelFactory.NewPropertyDef(CecilConst.PropertyName.TargetIdentifier.ToString(), pdtString);
                propertydef pdEADomain             = ModelFactory.NewPropertyDef(CecilConst.PropertyName.EADomain.ToString(), pdtString);
                propertydef pdParentMethod         = ModelFactory.NewPropertyDef(CecilConst.PropertyName.ParentMethod.ToString(), pdtString);
                propertydef pdTriggerSource        = ModelFactory.NewPropertyDef(CecilConst.PropertyName.TriggerSource.ToString(), pdtString);
                propertydef pdNextElement          = ModelFactory.NewPropertyDef(CecilConst.PropertyName.NextElement.ToString(), pdtString);

                pdc[(int)CecilConst.PropertyName.UniqueKey]            = pdUniqueKey;
                pdc[(int)CecilConst.PropertyName.Filename]             = pdFilename;
                pdc[(int)CecilConst.PropertyName.FQName]               = pdFQName;
                pdc[(int)CecilConst.PropertyName.Type]                 = pdType;
                pdc[(int)CecilConst.PropertyName.Name]                 = pdName;
                pdc[(int)CecilConst.PropertyName.Signature]            = pdSignature;
                pdc[(int)CecilConst.PropertyName.ReturnType]           = pdReturnType;
                pdc[(int)CecilConst.PropertyName.Version]              = pdVersion;
                pdc[(int)CecilConst.PropertyName.AllReferencesCount]   = pdAllReferencesCount;
                pdc[(int)CecilConst.PropertyName.Namespace]            = pdNamespace;
                pdc[(int)CecilConst.PropertyName.FQFilename]           = pdFQFilename;
                pdc[(int)CecilConst.PropertyName.FullName]             = pdFullName;
                pdc[(int)CecilConst.PropertyName.ParentAssembly]       = pdParentAssembly;
                pdc[(int)CecilConst.PropertyName.ParentModule]         = pdParentModule;
                pdc[(int)CecilConst.PropertyName.ModuleOffset]         = pdModuleOffset;
                pdc[(int)CecilConst.PropertyName.ParentFile]           = pdParentFile;
                pdc[(int)CecilConst.PropertyName.ParentTypeDefinition] = pdParentTypeDefinition;
                pdc[(int)CecilConst.PropertyName.IsPublic]             = pdIsPublic;
                pdc[(int)CecilConst.PropertyName.ArchiMateElementType] = pdArchiMateElementType;
                pdc[(int)CecilConst.PropertyName.Created]              = pdCreated;
                pdc[(int)CecilConst.PropertyName.LastAccessed]         = pdLastAccessed;
                pdc[(int)CecilConst.PropertyName.LastWritten]          = pdLastWritten;
                pdc[(int)CecilConst.PropertyName.Length]               = pdLength;
                pdc[(int)CecilConst.PropertyName.Extension]            = pdExtension;
                pdc[(int)CecilConst.PropertyName.PublicKeyToken]       = pdPublicKeyToken;
                pdc[(int)CecilConst.PropertyName.Culture]              = pdCulture;
                pdc[(int)CecilConst.PropertyName.APIType]              = pdAPIType;
                pdc[(int)CecilConst.PropertyName.BaseType]             = pdBaseType;
                pdc[(int)CecilConst.PropertyName.ParameterCount]       = pdParameterCount;
                pdc[(int)CecilConst.PropertyName.DeclaringType]        = pdDeclaringType;
                pdc[(int)CecilConst.PropertyName.SourceIdentifier]     = pdSourceIdentifier;
                pdc[(int)CecilConst.PropertyName.TargetIdentifier]     = pdTargetIdentifier;
                pdc[(int)CecilConst.PropertyName.EADomain]             = pdEADomain;
                pdc[(int)CecilConst.PropertyName.ParentMethod]         = pdParentMethod;
                pdc[(int)CecilConst.PropertyName.TriggerSource]        = pdTriggerSource;
                pdc[(int)CecilConst.PropertyName.NextElement]          = pdNextElement;
            }
        }
        private IModelFactory CreateModelFactory(IConnection connection)
        {
            var modelFactory = new ModelFactory(connection);

            modelFactories.Add(connection.Endpoint.ToString(), modelFactory);

            return modelFactory;
        }
Пример #36
0
 public ValuesController()
 {
     _modelFactory = new ModelFactory();
 }
        //数据库操作成功
        private void OperatorSuccess(UserInfo userInfo, UserGame userGame, List <UserInfo_Game.UserBuff> userProps, bool isRealName, JObject responseData)
        {
            UserGameJsonObject userGameJsonObject = new UserGameJsonObject(userGame.AllGameCount, userGame.WinCount, userGame.RunCount, userGame.MeiliZhi,
                                                                           userGame.XianxianJDPrimary, userGame.XianxianJDMiddle, userGame.XianxianJDHigh,
                                                                           userGame.XianxianCDPrimary, userGame.XianxianCDMiddle, userGame.XianxianCDHigh);

            responseData.Add(MyCommon.CODE, (int)Consts.Code.Code_OK);
            responseData.Add(MyCommon.NAME, userInfo.NickName);
            responseData.Add(MyCommon.PHONE, userInfo.Phone);
            responseData.Add(MyCommon.GOLD, userInfo.Gold);
            responseData.Add("medal", userInfo.Medel);
            responseData.Add("isRealName", isRealName);
            responseData.Add("recharge_vip", userInfo.RechargeVip);
            responseData.Add(MyCommon.YUANBAO, userInfo.YuanBao);
            responseData.Add(MyCommon.HEAD, userInfo.Head);
            responseData.Add(MyCommon.GAMEDATA, JsonConvert.SerializeObject(userGameJsonObject));
            responseData.Add("BuffData", JsonConvert.SerializeObject(userProps));

            //得到转盘次数
            var turnTableJsonObject = new TurnTableJsonObject();

            turnTableJsonObject.freeCount     = userInfo.freeCount;
            turnTableJsonObject.huizhangCount = userInfo.huizhangCount;
            turnTableJsonObject.luckyValue    = userInfo.luckyValue;
            responseData.Add("turntableData", JsonConvert.SerializeObject(turnTableJsonObject));

            //获取用户二级密码
            User user = NHibernateHelper.userManager.GetByUid(userInfo.Uid);

            if (user != null)
            {
                if (string.IsNullOrWhiteSpace(user.Secondpassword))
                {
                    responseData.Add("isSetSecondPsw", false);
                }
                else
                {
                    responseData.Add("isSetSecondPsw", true);
                }
            }
            else
            {
                MySqlService.log.Warn($"获取用户失败:{userInfo.Uid}");
            }

            //获取用户充值次数
            var userRecharges = NHibernateHelper.userRechargeManager.GetListByUid(userInfo.Uid);

            responseData.Add("userRecharge", JsonConvert.SerializeObject(userRecharges));

            CommonConfig config = ModelFactory.CreateConfig(userInfo.Uid);

            if (config.first_recharge_gift == 0)
            {
                responseData.Add("hasShouChong", false);
            }
            else
            {
                responseData.Add("hasShouChong", true);
            }

            if (string.IsNullOrWhiteSpace(userInfo.ExtendCode))
            {
                while (true)
                {
                    userInfo.ExtendCode = RandomCharHelper.GetRandomNum(6);
                    if (NHibernateHelper.userInfoManager.Update(userInfo))
                    {
                        break;
                    }
                }
            }

            responseData.Add("myTuiGuangCode", userInfo.ExtendCode);

            List <UserInfo> allUserInfo = MySqlManager <UserInfo> .Instance.GetAllUserInfo();

            int goldRank  = 0;
            int medelRank = 0;

            allUserInfo = allUserInfo.OrderByDescending(u => u.Gold).ToList();
            for (int i = 0; i < allUserInfo.Count; i++)
            {
                if (allUserInfo[i].Uid == userInfo.Uid)
                {
                    goldRank = i + 1;
                    break;
                }
            }

            allUserInfo = allUserInfo.OrderByDescending(u => u.Medel).ToList();
            for (int i = 0; i < allUserInfo.Count; i++)
            {
                if (allUserInfo[i].Uid == userInfo.Uid)
                {
                    medelRank = i + 1;
                    break;
                }
            }

            responseData.Add("goldRank", goldRank);
            responseData.Add("medelRank", medelRank);
        }
Пример #38
0
        public IHttpActionResult Get(string searchString = "", int page = 0, int pagesize = Config.DefaultPageSize)
        {
            var data = _repository.SearchWithPaging(searchString, pagesize * page, pagesize).Select(s => ModelFactory.Map(s, Url));

            if (!data.Any() || data == null)
            {
                return(NotFound());
            }

            var result = SearchWithPaging(
                data,
                searchString,
                pagesize,
                page,
                _repository.GetNumberOfSeachResult(searchString),
                Config.SearchRoute);

            return(Ok(result));
        }
Пример #39
0
 public NeedController()
     : base()
 {
     Model = new ModelFactory<iServeDBProcedures>(new iServeDBDataContext(), GetCurrentUserID());
 }
 public IHttpActionResult Get()
 {
     return(Ok(ModelFactory.Create(Settings)));
 }