Ejemplo n.º 1
0
        private void BuildCodeTree()
        {
            //models
            var timeModel = new TimeModel(new UpdateWatcher("Time Model"));

            var metaService = new MetaService(timeModel, new UpdateWatcher("Meta Service"), 2f);

            var metaModel = new MetaModel(timeModel, metaService, new UpdateWatcher("Meta Model"));

            var viewLayersModel = new LayersModel(new UpdateWatcher("Layers Model"));

            var assetsModel = new AssetsModel(AssetsConfiguration, new UpdateWatcher("Asset Model"));
            var phys        = new Models.Simulation.PhysicsScene("Sim1");

            var simModel = new SimulationModel(phys, assetsModel);

            var applicationModel = new ApplicationModel(metaModel, timeModel, viewLayersModel, simModel, assetsModel, new UpdateWatcher("Application Model"));

            var presenters = new List <IUpdateablePresenter>();

            //views
            var lobbyView         = new LobbyWindow(UiRoot);
            var loadingWindowView = new Loading(UiRoot);
            var gameWindowView    = new GameWindow(UiRoot);

            //presenters
            presenters.Add(new LoadingWindowPresenter(loadingWindowView, applicationModel));
            presenters.Add(new LobbyWindowPresenter(lobbyView, applicationModel));
            presenters.Add(new GameWindowPresenter(gameWindowView, applicationModel));

            //root
            _rootLoop = new ApplicationLoop(applicationModel, presenters);
        }
        private void ExecuteSearchCmd()
        {
            //空查询条件返回全部数据
            if (SearchText.Equals(""))
            {
                Videos = MetaService.GetService().SelectAll(COUNT);
                return;
            }

            ObservableCollection <MetaViewModel> selectedVideos = new ObservableCollection <MetaViewModel>();

            foreach (var item in Videos)
            {
                if (HasText(item.Meta.TaskCode) || HasText(item.Meta.PipeCode) || HasText(item.Meta.Addr))
                {
                    selectedVideos.Add(item);
                }
            }

            if (selectedVideos.Count <= 0)
            {
                MessageBox.Show("查询无结果,请重新输入查询条件");
            }
            else
            {
                Debug.WriteLine(selectedVideos.Count);
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    Videos = selectedVideos;
                });
            }
        }
 public MetaController(MetaService metaService, UsuarioService usuarioService,
                       UsuarioAutenticado usuarioAutenticado)
 {
     _metaService        = metaService;
     _usuarioService     = usuarioService;
     _usuarioAutenticado = usuarioAutenticado;
 }
Ejemplo n.º 4
0
        public void GetReleaseTypes()
        {
            using (var context = DbUtils.InMemoryApplicationDbContext("Find"))
            {
                var releaseTypesToSave = new List <ReleaseType>
                {
                    new ReleaseType()
                    {
                        Id    = Guid.NewGuid(),
                        Title = "Ad Hoc",
                    },
                    new ReleaseType()
                    {
                        Id    = Guid.NewGuid(),
                        Title = "Official Statistics",
                    }
                };


                context.AddRange(releaseTypesToSave);
                context.SaveChanges();

                var service = new MetaService(context);
                // Method under test
                var retrievedReleaseTypes = service.GetReleaseTypes();
                Assert.True(retrievedReleaseTypes.Exists(rt => rt.Title == "Ad Hoc"));
                Assert.True(retrievedReleaseTypes.Exists(rt => rt.Title == "Official Statistics"));
            }
        }
Ejemplo n.º 5
0
        protected override void Create()
        {
            var element = new AxTable {
                Name = ElementName
            };

            MetaService.CreateTable(element, Model);
        }
Ejemplo n.º 6
0
        protected override void Create()
        {
            var element = new AxMenuItemDisplay {
                Name = ElementName
            };

            MetaService.CreateMenuItemDisplay(element, Model);
        }
Ejemplo n.º 7
0
        protected override void Create()
        {
            var element = new AxEnum {
                Name = ElementName
            };

            MetaService.CreateEnum(element, Model);
        }
Ejemplo n.º 8
0
        protected override void Create()
        {
            var element = new AxQuerySimple {
                Name = ElementName
            };

            MetaService.CreateQuery(element, Model);
        }
Ejemplo n.º 9
0
        protected override void Create()
        {
            var element = new AxReport {
                Name = ElementName
            };

            MetaService.CreateReport(element, Model);
        }
Ejemplo n.º 10
0
        protected override void Create()
        {
            var element = new AxSecurityPrivilege {
                Name = ElementName
            };

            MetaService.CreateSecurityPrivilege(element, Model);
        }
Ejemplo n.º 11
0
        protected override void Create()
        {
            var element = new AxEdtEnum {
                Name = ElementName,
            };

            MetaService.CreateExtendedDataType(element, Model);
        }
Ejemplo n.º 12
0
        protected override void Create()
        {
            var element = new AxClass {
                Name = ElementName
            };

            MetaService.CreateClass(element, Model);
        }
Ejemplo n.º 13
0
        public WcfMetaService()
        {
            serv = new MetaService(@"Data source=(localdb)\MSSQLLocalDB;AttachDbFilename=C:\dbs\cafedb.mdf;Integrated Security=True;");
            var config = new MapperConfiguration(cfg => {
                cfg.CreateMap <DataBase, DataBaseModel>();
            });

            iMapper = config.CreateMapper();
        }
Ejemplo n.º 14
0
        public void Get_TimeIdentifiersByCategory_Returns_Ok()
        {
            var metaService = new MetaService(null /* do not need */);
            var controller  =
                new MetaController(metaService);

            // Method under test
            var result = controller.GetTimeIdentifiersByCategory();

            Assert.IsAssignableFrom <List <TimeIdentifierCategoryModel> >(result.Value);
        }
 public HeadViewModelBuilder(RouteRequestInfoAccessor routeRequestInfoAccessor, RequestModelAccessor requestModelAccessor, MetaService metaService, OpenGraphViewModelBuilder openGraphViewModelBuilder, MetaService.CanonicalSettings canonicalSettings, MetaService.RobotsSettings robotsSettings, TrackingScriptService trackingScriptService, FaviconViewModelBuilder faviconViewModelBuilder, FilterService filterService)
 {
     _routeRequestInfoAccessor = routeRequestInfoAccessor;
     _requestModelAccessor     = requestModelAccessor;
     _metaService = metaService;
     _openGraphViewModelBuilder = openGraphViewModelBuilder;
     _trackingScriptService     = trackingScriptService;
     _faviconViewModelBuilder   = faviconViewModelBuilder;
     _canonicalSettings         = canonicalSettings;
     _robotsSettings            = robotsSettings;
     _filterService             = filterService;
 }
        public async Task <IViewComponentResult> InvokeAsync(int clientId, int count, int offset, DateTime?startAt)
        {
            var level = (EFClient.Permission)Enum.Parse(typeof(EFClient.Permission), UserClaimsPrincipal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Role)?.Value ?? "User");

            IEnumerable <ProfileMeta> meta = await MetaService.GetRuntimeMeta(clientId, offset, count, startAt ?? DateTime.UtcNow);

            if (level < EFClient.Permission.Trusted)
            {
                meta = meta.Where(_meta => !_meta.Sensitive);
            }

            return(View("_List", meta));
        }
Ejemplo n.º 17
0
        public async Task ItShouldLoadModelIfNotFromCache()
        {
            var model = new ModelMock();

            var metaService = new MetaService(
                new MetaRepositoryMock(new PropertyBag()),
                new ModelLoaderMock(model),
                new ModelCacheMock(putAsserts: m => { m.Should().BeSameAs(model); })
                );

            var result = await metaService.GetModel(model.Name, CancellationToken.None);

            result.Should().BeSameAs(model);
        }
Ejemplo n.º 18
0
        public async Task ItShouldGetModelFromCache()
        {
            var cachedModel = new ModelMock();

            var metaService = new MetaService(
                new MetaRepositoryMock(),
                new ModelLoaderMock(),
                new ModelCacheMock(cachedModel)
                );

            var result = await metaService.GetModel(cachedModel.Name, CancellationToken.None);

            result.Should().BeSameAs(cachedModel);
        }
 public UsuarioController(CategoriaService categoriaService, CartaoService cartaoService, MetaService metaService, PoupancaService poupancaService,
                          UsuarioService usuarioService, LancamentoService lancamentoService, RecebimentoService recebimentoService,
                          UserManager <UsuarioLogado> userManager, SignInManager <UsuarioLogado> signInManager, UsuarioAutenticado usuarioAutenticado)
 {
     _usuarioService     = usuarioService;
     _lancamentoService  = lancamentoService;
     _recebimentoService = recebimentoService;
     _categoriaService   = categoriaService;
     _cartaoService      = cartaoService;
     _metaService        = metaService;
     _poupancaService    = poupancaService;
     _userManager        = userManager;
     _signInManager      = signInManager;
     _usuarioAutenticado = usuarioAutenticado;
 }
        private void ExecuteDeleteCmd(int id)
        {
            int result = MetaService.GetService().DeleteById(id);

            if (result > 0)
            {
                for (int i = 0; i < Videos.Count; i++)
                {
                    if (Videos[i].Id == id)
                    {
                        Videos.RemoveAt(i);
                    }
                }
            }
        }
Ejemplo n.º 21
0
        public async Task <IActionResult> Meta(int id, int count, int offset, DateTime?startAt)
        {
            IEnumerable <ProfileMeta> meta = await MetaService.GetRuntimeMeta(id, startAt == null?offset : 0, count, startAt ?? DateTime.UtcNow);

            if (!Authorized)
            {
                meta = meta.Where(_meta => !_meta.Sensitive);
            }

            if (meta.Count() == 0)
            {
                return(Ok());
            }

            return(View("Components/ProfileMetaList/_List", meta));
        }
Ejemplo n.º 22
0
        protected override void Create()
        {
            var element = new AxQuerySimple
            {
                Name = ElementName, Methods = new KeyedObjectCollection <AxMethod>()
                {
                    new AxMethod()
                    {
                        Name   = "classDeclaration",
                        Source = "[Query]\r\npublic class " + ElementName + " extends QueryRun \r\n{\r\n}",
                    }
                }
            };

            MetaService.CreateQuery(element, Model);
        }
Ejemplo n.º 23
0
        protected override async Task OnParametersSetAsync()
        {
            var id = Id;

            if (Id.Contains(":"))
            {
                id             = Id.Split(':')[0];
                SelectedSeason = Id.Split(':')[1];
            }

            var detail = await MetaService.GetMeta(Type, id);

            ContentMeta = detail.Meta;

            StateHasChanged();
        }
Ejemplo n.º 24
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                ProgV = Visibility.Visible;
            });
            worker.ReportProgress(0);
            for (int i = 0; i < MetaList.Count; i++)
            {
                if (!File.Exists(MetaList[i].VideoPath))
                {
                    Debug.WriteLine("视频 {0} 不存在", MetaList[i].VideoPath);
                    continue;
                }

                Stopwatch watch = new Stopwatch();
                watch.Start();

                string framePathWithDirectory = Path.GetFileNameWithoutExtension(MetaList[i].VideoPath);

                //小图
                string target = TargetPath + @"\" + framePathWithDirectory + @"\smallimg";
                //大图
                string target1 = TargetPath + @"\" + framePathWithDirectory + @"\bigimg";

                try
                {
                    Directory.CreateDirectory(target);
                    Directory.CreateDirectory(target1);
                }
                catch (Exception fileExpt)
                {
                    Debug.WriteLine("创建文件夹失败:" + fileExpt.ToString());
                    return;
                }

                Cut(MetaList[i].VideoPath, target, 1);
                Cut(MetaList[i].VideoPath, target1, 0);

                watch.Stop();
                TimeSpan timespan = watch.Elapsed;                                 //获取当前实例测量得出的总时间
                Debug.WriteLine("本次视频分帧执行时间:{0}(毫秒)", timespan.TotalMilliseconds); //总毫秒数

                MetaService.GetService().UpdateFramePathByVideoPath(target1, MetaList[i].VideoPath);
                worker.ReportProgress(100 * (i + 1) / MetaList.Count);
            }
        }
Ejemplo n.º 25
0
        public void GetTimeIdentifiers()
        {
            var service = new MetaService(null /* Do not need */);
            // Method under test
            var timeIdentifiersRetrieved = service.GetTimeIdentifiersByCategory();

            foreach (TimeIdentifierCategory category in Enum.GetValues(typeof(TimeIdentifierCategory)))
            {
                // Check each Category is accounted for
                Assert.True(timeIdentifiersRetrieved.Exists(ti => ti.Category == category));
                foreach (var identifier in category.GetTimeIdentifiers())
                {
                    // Check each Identifier is accounted for
                    Assert.True(timeIdentifiersRetrieved.Single(ti => ti.Category == category).TimeIdentifiers
                                .Exists(i => i.Identifier == identifier));
                }
            }
        }
Ejemplo n.º 26
0
        private int MyTaskBig()
        {
            for (int i = 0; i < MetaList.Count; i++)
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();

                string framePathWithDirectory = Path.GetFileNameWithoutExtension(MetaList[i].VideoPath);
                string target = TargetPath + @"\" + framePathWithDirectory + @"\bigimg";

                Directory.CreateDirectory(target);
                Cut(MetaList[i].VideoPath, target, 1);
                watch.Stop();
                TimeSpan timespan = watch.Elapsed;                                 //获取当前实例测量得出的总时间
                Debug.WriteLine("打开窗口代码执行时间:{0}(毫秒)", timespan.TotalMilliseconds); //总毫秒数
                MetaService.GetService().UpdateFramePathByVideoPath(target, MetaList[i].VideoPath);
            }
            return(0);
        }
Ejemplo n.º 27
0
        private void AddBagHelper(string path)
        {
            string drive = System.IO.Path.GetPathRoot(path);

            try {
                DatabaseOperations dbOp  = vMan.CreateBagVolume(drive, path);
                DirectoryInfo      dInfo = new DirectoryInfo(path);

                foreach (FileInfo fInfo in dInfo.GetFiles())
                {
                    Item fileItem = Helper.GetItemFromFileInfo(fInfo);
                    MetaService.ProcessItem(fileItem, dbOp);
                }

                Console.WriteLine("Successfully created a bag volume on " + drive);
            } catch (VolumeMountManagerException e) {
                PrintError(e);
            }
        }
Ejemplo n.º 28
0
    public async Task <EventHandledResponse> Handle(EventMetaData eventMetadata, AppMentionEvent slackEvent)
    {
        var debugDetails = MetaService.DebugInfo();
        var debugInfo    = $"▪️ v{debugDetails.MajorMinorPatch}\n" +
                           $"▪️ {debugDetails.Informational}\n";
        var releaseNotes = await GitHubReleaseService.GetReleaseNotes(debugDetails.MajorMinorPatch);

        if (!string.IsNullOrEmpty(releaseNotes))
        {
            debugInfo += releaseNotes;
        }
        else if (debugDetails.Sha != "0")
        {
            debugInfo += $"️▪️ <https://github.com/fplbot/fplbot/tree/{debugDetails.Sha}|{debugDetails.Sha?.Substring(0, debugDetails.Sha.Length - 1)}>\n";
        }
        await _session.Send("FplBot.EventHandlers.Slack", new PublishToSlack(eventMetadata.Team_Id, slackEvent.Channel, debugInfo));

        return(new EventHandledResponse("OK"));
    }
Ejemplo n.º 29
0
 private ApplicationManager()
 {
     _servers               = new List <Server>();
     Commands               = new List <Command>();
     TaskStatuses           = new List <AsyncStatus>();
     MessageTokens          = new List <MessageToken>();
     ClientSvc              = new ClientService();
     AliasSvc               = new AliasService();
     PenaltySvc             = new PenaltyService();
     ConfigHandler          = new BaseConfigurationHandler <ApplicationConfiguration>("IW4MAdminSettings");
     StartTime              = DateTime.UtcNow;
     OnQuit                 = new ManualResetEventSlim();
     PageList               = new PageList();
     AdditionalEventParsers = new List <IEventParser>();
     AdditionalRConParsers  = new List <IRConParser>();
     OnServerEvent         += OnGameEvent;
     OnServerEvent         += EventApi.OnGameEvent;
     _authenticator         = new TokenAuthentication();
     _metaService           = new MetaService();
 }
Ejemplo n.º 30
0
        //先于Configure执行
        public virtual IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddCors();//跨域
            services.AddMvc(options =>
            {
                options.Filters.Add(new TokenValidateFilter());
                options.Filters.Add(typeof(DefaultFilter));
                //options.Filters.Add(new DefaultActionFilter());
                //options.Filters.Add(new DefaultResultFilter());
                //options.Filters.Add(new DefaultExceptionFilter());
            })
            .AddJsonOptions(options =>
            {
                //忽略循环引用
                //options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
                //不更改元数据的key的大小写
                //options.SerializerSettings.ContractResolver = new DefaultContractResolver();
                //不序列化为null的属性
                options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;
                //不序列化等于默认值的属性
                options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore;
            })
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            var builder = new ContainerBuilder();//实例化 AutoFac  容器

            builder.Populate(services);

            DefaultBuild(builder);

            //注册其他程序集中的模块
            builder.RegisterAssemblyModules(AppDomain.CurrentDomain.GetAssemblies());

            ApplicationContainer = builder.Build();

            //AutoFac声明以下方法已过时,因此不可能在程序运行中动态改变已注册的注入
            //builder.Update(ApplicationContainer);

            MetaService.RegisterDataGate("SaveUser", new UsersGate());
            Consts.ServiceProvider = new AutofacServiceProvider(ApplicationContainer);//第三方IOC接管 core内置DI容器
            return(Consts.ServiceProvider);
        }