コード例 #1
0
        public void ValidateRequestByLocalEventConfig_Test()
        {
            // Arrange
            UserInQueueServiceMock mock = new UserInQueueServiceMock();

            KnownUser._UserInQueueService = (mock);

            EventConfig eventConfig = new EventConfig();

            eventConfig.CookieDomain         = "cookieDomain";
            eventConfig.LayoutName           = "layoutName";
            eventConfig.Culture              = "culture";
            eventConfig.EventId              = "eventId";
            eventConfig.QueueDomain          = "queueDomain";
            eventConfig.ExtendCookieValidity = true;
            eventConfig.CookieValidityMinute = 10;
            eventConfig.Version              = 12;

            // Act
            KnownUser.ValidateRequestByLocalEventConfig("targetUrl", "queueitToken", eventConfig, "customerId", "secretKey");

            // Assert
            Assert.Equal("targetUrl", mock.validateRequestCalls[0][0]);
            Assert.Equal("queueitToken", mock.validateRequestCalls[0][1]);
            Assert.Equal("cookieDomain:layoutName:culture:eventId:queueDomain:true:10:12", mock.validateRequestCalls[0][2]);
            Assert.Equal("customerId", mock.validateRequestCalls[0][3]);
            Assert.Equal("secretKey", mock.validateRequestCalls[0][4]);
        }
コード例 #2
0
    public EventConfig[] UpdateNextEventConfig()
    {
        if (currentEventConfig.Needchoice == 1)
        {
            if (currentEventConfig.ChoiceOneid[0] != -1)
            {
                nextEventConfigs[0] = EventConfig.Get(currentEventConfig.ChoiceOneid[0]);
            }
            else
            {
                nextEventConfigs[0] = RandomEvent();
            }

            if (currentEventConfig.ChoiceTwoid[0] != -1)
            {
                nextEventConfigs[1] = EventConfig.Get(currentEventConfig.ChoiceTwoid[0]);
            }
            else
            {
                nextEventConfigs[1] = RandomEvent();
            }
        }
        else
        {
            if (currentEventConfig.ChoiceOneid[0] != -1)
            {
                nextEventConfigs[0] = nextEventConfigs[1] = EventConfig.Get(currentEventConfig.ChoiceOneid[0]);
            }
            else
            {
                nextEventConfigs[0] = nextEventConfigs[1] = RandomEvent();
            }
        }
        return(nextEventConfigs);
    }
コード例 #3
0
        protected override void Process(ISymbol symbol, PolicyConfig policyConfig, IViolationReporter violationReporter)
        {
            EventConfig config = policyConfig.EventConfig;

            if (symbol.IsOverride && !config.DocumentOverrides)
            {
                return;
            }

            if (symbol.ContainingType != null && symbol.ContainingType.TypeKind == TypeKind.Interface && !config.InterfaceDeclarationDocumentationRequired)
            {
                return;
            }

            if (!symbol.CanBeReferencedByName && !config.ExplicitInterfaceEventDocumentationRequired)
            {
                return;
            }

            if (!AnyVisibilityMatches(symbol.DeclaredAccessibility, config.VisibilitiesToCheck) && symbol.CanBeReferencedByName)
            {
                return;
            }

            IDocumentationComment documentation = symbol.GetDocumentationComment();

            if (config.SummaryDocumentationRequired && string.IsNullOrWhiteSpace(documentation.SummaryText))
            {
                violationReporter.Report(ViolationFromSymbol(ViolationMessage.MissingSummaryDocumentation, symbol));
            }
        }
コード例 #4
0
        public void ValidateRequest_ValidState_ExtendableCookie_NoCookieExtensionFromConfig_DoNotRedirectDoNotStoreCookieWithExtension()
        {
            var    cookieProviderMock = MockRepository.GenerateMock <IUserInQueueStateRepository>();
            string queueId            = "queueId";
            var    config             = new EventConfig()
            {
                EventId              = "e1",
                QueueDomain          = "testDomain",
                CookieValidityMinute = 10,
                ExtendCookieValidity = false
            };

            cookieProviderMock.Stub(stub => stub.GetState("", ""))
            .IgnoreArguments().Return(new StateInfo(true, queueId, true));


            UserInQueueService testObject = new UserInQueueService(cookieProviderMock);

            var result = testObject.ValidateRequest("url", "token", config, "testCustomer", "key");

            Assert.True(!result.DoRedirect);
            Assert.True(result.QueueId == queueId);
            cookieProviderMock.AssertWasNotCalled(stub => stub.Store("", queueId, true, "", 0, ""),
                                                  options => options.IgnoreArguments());
            Assert.True(config.EventId == result.EventId);
        }
コード例 #5
0
    public EventConfig ChooseEvent(int dir)
    {
        int nextEventIndex = 0;

        if (dir < 0)
        {
            nextEventIndex = 0;
        }
        else
        {
            nextEventIndex = 1;
        }

        if (nextEventIndex == 0)
        {
            for (int i = 0; i < currentEventConfig.ChoiceOneSorce.Length; i++)
            {
                healthValue[i] += currentEventConfig.ChoiceOneSorce[i];
            }
        }
        else
        {
            for (int i = 0; i < currentEventConfig.ChoiceTwoSorce.Length; i++)
            {
                healthValue[i] += currentEventConfig.ChoiceTwoSorce[i];
            }
        }

        currentEventConfig = nextEventConfigs[nextEventIndex];

        turnCount++;
        UIManager.DispatchMsg("NextTurn", turnCount);
        return(currentEventConfig);
    }
コード例 #6
0
 private void SaveFile()
 {
     //Convert Data
     m_EventControlData             = new EventControlData();
     m_EventControlData.EventConfig = new Dictionary <string, EventConfig>();
     if (m_lstEventEffectInfo == null)
     {
         m_lstEventEffectInfo = new List <EventEffectInfo>();
     }
     for (int i = 0; i < m_lstEventEffectInfo.Count; i++)
     {
         if (m_lstEventEffectInfo[i].EventName == null || m_lstEventEffectInfo[i].EventName == "")
         {
             EditorUtility.DisplayDialog("保存失败", "事件名称不能为空", "确定");
             return;
         }
         EventConfig eventConfig = new EventConfig();
         eventConfig.TalentEffect = new Dictionary <string, int>();
         foreach (string talent in m_lstEventEffectInfo[i].TalentEffects.Keys)
         {
             eventConfig.TalentEffect.Add(talent, AdaptiveDifficultyManager.ConvertInt(m_lstEventEffectInfo[i].TalentEffects[talent]));
         }
         m_EventControlData.EventConfig.Add(m_lstEventEffectInfo[i].EventName, eventConfig);
     }
     //Save File
     EditorUtility.DisplayDialog("保存成功", "保存成功", "确定");
     ADE_Helper.SaveEventControlDataMap(m_EventControlDataMap, m_GameID, m_EventControlData);
 }
コード例 #7
0
        public void ValidateRequest_ValidState_NoExtendableCookie_DoNotRedirectDoNotStoreCookieWithExtension()
        {
            var    cookieProviderMock = MockRepository.GenerateMock <IUserInQueueStateRepository>();
            string queueId            = "queueId";

            var config = new EventConfig()
            {
                EventId              = "e1",
                QueueDomain          = "testDomain.com",
                CookieValidityMinute = 10,
                ExtendCookieValidity = true
            };
            var customerKey = "4e1db821-a825-49da-acd0-5d376f2068db";

            cookieProviderMock.Stub(stub => stub.GetState("", ""))
            .IgnoreArguments().Return(new StateInfo(true, queueId, false));



            UserInQueueService testObject = new UserInQueueService(cookieProviderMock);

            var result = testObject.ValidateRequest("url", "token", config, "testCustomer", customerKey);

            Assert.True(result.QueueId == queueId);
            Assert.True(!result.DoRedirect);
            cookieProviderMock.AssertWasNotCalled(stub =>
                                                  stub.Store(null, null, false, null, 0, null), options => options.IgnoreArguments());
            Assert.True(config.EventId == result.EventId);
        }
コード例 #8
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="cg">事件配置</param>
 public EventHelper(EventConfig cg)
 {
     if (cg != null)
     {
         Set(cg);
     }
 }
コード例 #9
0
ファイル: TestService.cs プロジェクト: Nekrotos/SweetMQ
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Started daemon.");

            var exchangeInfo = new ExchangeInfo("exchange name", ExchangeType.Direct);
            IReadOnlyCollection <RouteKey> routing = new List <RouteKey>
            {
                new RouteKey("all admin user moderator", new List <QueueInfo>
                {
                    new QueueInfo("queue1"),
                    new QueueInfo("queue2")
                }),
                new RouteKey("dante nooby", new List <QueueInfo>
                {
                    new QueueInfo("queue3"),
                    new QueueInfo("queue4")
                })
            };
            var eventConfig = new EventConfig(exchangeInfo, routing);

            EventsManager.AddEvent <UpdateUser>(eventConfig, new ConnectionFactory());
            var updateUser = new UpdateUser(Guid.NewGuid(), "new user name");
            await EventsManager.SendEvent(updateUser, "all admin user moderator");

            await Task.CompletedTask;
        }
コード例 #10
0
        private void LoadEvents()
        {
            string path = Path.Combine(this.Helper.DirectoryPath, "Events");

            if (!Directory.Exists(path))
            {
                try {
                    this.Monitor.Log("Creating directory " + path);
                    Directory.CreateDirectory(path);
                } catch (Exception ex) {
                    this.Monitor.Log("Could not create directory " + path + "! Please create it yourself.", LogLevel.Error);
                    this.Monitor.Log(ex.Message, LogLevel.Error);
                    return;
                }
            }

            string[] configList = Directory.GetFiles(path, "*.json", SearchOption.TopDirectoryOnly);
            foreach (string configPath in configList)
            {
                try {
                    EventConfig config = this.Helper.ReadJsonFile <EventConfig>(configPath);
                    if (config != null && config.Enabled)
                    {
                        this.Monitor.Log("Loading " + Path.GetFileName(configPath), LogLevel.Info);
                        this.Events.AddRange(config.Events);
                    }
                    this.Helper.WriteJsonFile(configPath, config);
                } catch (Exception ex) {
                    this.Monitor.Log(string.Format("Failed to load {0}.", Path.GetFileName(configPath)), LogLevel.Error);
                    this.Monitor.Log(ex.Message, LogLevel.Error);
                    this.Monitor.Log("Maybe your format is invalid?", LogLevel.Warn);
                }
            }
        }
コード例 #11
0
        public void ValidateRequestByLocalEventConfig_InvalidCookieValidityMinute_Test()
        {
            // Arrange
            UserInQueueServiceMock mock = new UserInQueueServiceMock();

            KnownUser._UserInQueueService = (mock);
            bool exceptionWasThrown = false;

            EventConfig eventConfig = new EventConfig();

            eventConfig.CookieDomain         = "cookieDomain";
            eventConfig.LayoutName           = "layoutName";
            eventConfig.Culture              = "culture";
            eventConfig.EventId              = "eventId";
            eventConfig.QueueDomain          = "queueDomain";
            eventConfig.ExtendCookieValidity = true;
            //eventConfig.CookieValidityMinute = 10;
            eventConfig.Version = 12;

            // Act
            try
            {
                KnownUser.ValidateRequestByLocalEventConfig("targetUrl", "queueitToken", eventConfig, "customerId", "secretKey");
            }
            catch (ArgumentException ex)
            {
                exceptionWasThrown = ex.Message == "CookieValidityMinute from eventConfig should be greater than 0.";
            }

            // Assert
            Assert.True(mock.validateRequestCalls.Count == 0);
            Assert.True(exceptionWasThrown);
        }
コード例 #12
0
        public void ValidateRequest_NoCookie_TampredToken_RedirectToErrorPageWithHashError_DoNotStoreCookie()
        {
            Exception expectedException  = new Exception();
            var       cookieProviderMock = MockRepository.GenerateMock <IUserInQueueStateRepository>();

            var config = new EventConfig()
            {
                EventId              = "e1",
                QueueDomain          = "testDomain.com",
                CookieValidityMinute = 10,
                ExtendCookieValidity = false,
                Version              = 100
            };
            var customerKey = "4e1db821-a825-49da-acd0-5d376f2068db";
            var queueId     = "iopdb821-a825-49da-acd0-5d376f2068db";

            cookieProviderMock.Stub(stub => stub.GetState("", "")).IgnoreArguments().Return(new StateInfo(false, "", false));
            string hash = "";

            var queueitToken = QueueITTokenGenerator.GenerateToken(
                DateTime.UtcNow.AddHours(1),
                "e1",
                queueId,
                false,
                20,

                customerKey,
                out hash

                );

            queueitToken = queueitToken.Replace("False", "True");
            var currentUrl       = "http://test.test.com?b=h";
            var knownUserVersion = typeof(UserInQueueService).Assembly.GetName().Version.ToString();//queryStringList.Add($"ver=c{}");
            var expectedErrorUrl = $"https://testDomain.com/error/hash?c=testCustomer&e=e1" +
                                   $"&ver=v3-{knownUserVersion}"
                                   + $"&cver=100"
                                   + $"&queueittoken={queueitToken}"
                                   + $"&t={HttpUtility.UrlEncode(currentUrl)}";


            UserInQueueService testObject = new UserInQueueService(cookieProviderMock);
            var result = testObject.ValidateRequest(currentUrl, queueitToken, config, "testCustomer", customerKey);

            Assert.True(result.DoRedirect);

            var regex           = new Regex("&ts=[^&]*");
            var match           = regex.Match(result.RedirectUrl);
            var serverTimestamp = DateTimeHelper.GetUnixTimeStampAsDate(match.Value.Replace("&ts=", "").Replace("&", ""));

            Assert.True(DateTime.UtcNow.Subtract(serverTimestamp) < TimeSpan.FromSeconds(10));
            var redirectUrl = regex.Replace(result.RedirectUrl, "");

            Assert.True(redirectUrl.ToUpper() == expectedErrorUrl.ToUpper());
            Assert.True(config.EventId == result.EventId);
            cookieProviderMock.AssertWasNotCalled(stub => stub.Store("", "", true, "", 0, ""),
                                                  options => options.IgnoreArguments());
        }
コード例 #13
0
    public void SetEvent(EventConfig eventConfig)
    {
        config         = eventConfig;
        Image.sprite   = Resources.Load <Sprite>("Texture/UI/Role/" + config.Hero);
        ChooseOne.text = config.ChoiceOne;
        ChooseTwo.text = config.ChoiceTwo;

        HideChooseText();
    }
コード例 #14
0
ファイル: EventService.cs プロジェクト: PassiveModding/Raven
            public EventClass(ulong guildId, EventConfig config, string title, string content, EventType type, Color color)
            {
                GuildId = guildId;
                Config  = config;
                Type    = type;
                SetTitle(title);
                SetContent(content);

                Color = color;
            }
コード例 #15
0
    // Talent Control
    private void CalculateUserTalent(string eventName, EventControlData currentEventControlData)
    {
        if (m_CharTalentMap == null)
        {
            ResetUserTalent();
        }
        //foreach (string talentName in currentEventControlData.EventConfig.Keys)
        //{
        //    if (m_CharTalentMap.ContainsKey(talentName))
        //    {
        //        EventConfig talentConfig = currentEventControlData.EventConfig[talentName];
        //        if (talentConfig.TalentEffect.ContainsKey(eventName))
        //        {
        //            float effect = ConvertFloat(talentConfig.TalentEffect[eventName]);
        //            float score = ConvertFloat(m_CharTalentMap[talentName]);
        //            float result = Mathf.Clamp01(score + effect);
        //            m_CharTalentMap[talentName] = ConvertInt(result);

        //            UpdateUserTalent();
        //        }
        //        else
        //        {
        //            Debuger.LogWarning("Wrong Event Name : " + eventName + ", it does not Exist in Current EventControlData");
        //        }
        //    }
        //    else
        //    {
        //        Debuger.LogWarning("Wrong Talent Name : " + talentName + ", it does not Exist in UserTalent");
        //    }
        //}
        if (currentEventControlData.EventConfig.ContainsKey(eventName))
        {
            EventConfig eventConfig = currentEventControlData.EventConfig[eventName];
            foreach (string talentName in eventConfig.TalentEffect.Keys)
            {
                if (m_CharTalentMap.ContainsKey(talentName))
                {
                    float score  = ConvertFloat(m_CharTalentMap[talentName]);
                    float effect = ConvertFloat(eventConfig.TalentEffect[talentName]);
                    float result = Mathf.Clamp01(score + effect);
                    m_CharTalentMap[talentName] = ConvertInt(result);

                    UpdateUserTalent();
                }
                else
                {
                    Debuger.LogWarning("Wrong Talent Name : " + talentName + ", it does not Exist in UserTalent");
                }
            }
        }
        else
        {
            Debuger.LogWarning("Wrong Event Name : " + eventName + ", it does not Exist in Current EventControlData");
        }
    }
コード例 #16
0
ファイル: EventsManager.cs プロジェクト: Nekrotos/SweetMQ
        public static void AddEvent <T>(EventConfig eventConfig, ConnectionFactory connectionFactory)
            where T : class, IEventBase
        {
            var eventInstance = new EventInstance <T>(eventConfig, new ConnectionFactory());
            var result        = Instances.TryAdd(typeof(T), eventInstance);

            if (result == false)
            {
                throw new Exception(nameof(AddEvent));
            }
        }
コード例 #17
0
        public async Task <IActionResult> Post([FromBody] EventConfig model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            EventConfig result = await storage.SaveEventAsync(model);

            return(CreatedAtAction("Get", new { eventId = result.EventId }, result));
        }
コード例 #18
0
        void IPolicyConfigControl.ReadFromConfig(PolicyConfig config)
        {
            EventConfig controlConfig = config.EventConfig;

            Visibilities.Bind(controlConfig.VisibilitiesToCheck);

            OverridesOptionCheckBox.Checked         = controlConfig.DocumentOverrides;
            ExplicitOptionCheckBox.Checked          = controlConfig.ExplicitInterfaceEventDocumentationRequired;
            InterfaceOptionCheckBox.Checked         = controlConfig.InterfaceDeclarationDocumentationRequired;
            SummaryDocumentationTagCheckBox.Checked = controlConfig.SummaryDocumentationRequired;
        }
コード例 #19
0
        void IPolicyConfigControl.WriteToConfig(PolicyConfig config)
        {
            EventConfig controlConfig = config.EventConfig;

            controlConfig.VisibilitiesToCheck = Visibilities.GetVisibilites();

            controlConfig.DocumentOverrides = OverridesOptionCheckBox.Checked;
            controlConfig.ExplicitInterfaceEventDocumentationRequired = ExplicitOptionCheckBox.Checked;
            controlConfig.InterfaceDeclarationDocumentationRequired   = InterfaceOptionCheckBox.Checked;
            controlConfig.SummaryDocumentationRequired = SummaryDocumentationTagCheckBox.Checked;
        }
コード例 #20
0
ファイル: EventService.cs プロジェクト: PassiveModding/Raven
        public EventConfig GetOrCreateConfig(ulong guildId)
        {
            var config = TryGetConfig(guildId);

            if (config == null)
            {
                config = new EventConfig(guildId);
                SaveConfig(config);
            }

            return(config);
        }
コード例 #21
0
 public void LoadFake()
 {
     AuthorizedDevices.Fake();
     DeviceConfig.Fake();
     EventConfig.Fake();
     //GlobalConfig.Fake();
     GsmConfig.Fake();
     ZoneConfig.Fake();
     UserConfig.Fake();
     InputConfig.Fake();
     OutputConfig.Fake();
     RelayConfig.Fake();
 }
コード例 #22
0
    private EventConfig RandomEvent()
    {
        if (randomEventList.Count <= 0)
        {
            FillRandomEventList();
        }
        Random.InitState(System.DateTime.Now.Millisecond);
        int         randIndex   = Random.Range(0, randomEventList.Count);
        EventConfig eventConfig = randomEventList[randIndex];

        randomEventList.RemoveAt(randIndex);
        return(eventConfig);
    }
コード例 #23
0
    public override void RestartGame()
    {
        base.RestartGame();
        for (int i = 0; i < healthValue.Length; i++)
        {
            healthValue[i] = 50;
        }
        turnCount = 1;
        int randIndex = Random.Range(0, EventConfigMng.EventDict[1].Count);

        currentEventConfig = EventConfigMng.EventDict[1][randIndex];
        UIManager.DispatchMsg("RestartGame", healthValue, currentEventConfig, turnCount);
    }
コード例 #24
0
ファイル: GameView.cs プロジェクト: BoenYang/DeathOfDesginer
    private void NextEvent()
    {
        isAnimating = true;
        DisableTouch();

        seq = DOTween.Sequence();
        int dir = Math.Sign(xMoveDistance);

        int nextEventIndex = 0;

        if (dir < 0)
        {
            nextEventIndex = 0;
        }
        else
        {
            nextEventIndex = 1;
        }

        currentEventConfig = GameStart.Game.ChooseEvent(dir);
        ChooseDesc.text    = currentEventConfig.Event;
        RoleName.text      = roleNameDict[currentEventConfig.Hero];
        ChangeIndicator.ForEach((i) => i.transform.localScale = Vector3.zero);

        UpdateFillAmount();

        seq.Insert(0, DOTween.ToAlpha(() => CurrentEvent.Image.color, (c) => CurrentEvent.Image.color = c, 0, 1.0f));
        seq.Insert(0, CurrentEvent.rectTransform.DORotate(new Vector3(0, 0, -60 * dir), 1.0f));
        seq.Insert(0, CurrentEvent.rectTransform.DOLocalMove(originPos + new Vector3(360, 0, 0) * dir, 1.0f));
        seq.OnComplete(() =>
        {
            EventImage temp            = CurrentEvent;
            CurrentEvent               = NextEvents[nextEventIndex];
            NextEvents[nextEventIndex] = temp;
            NextEvents[nextEventIndex].rectTransform.localPosition = originPos;
            NextEvents[nextEventIndex].rectTransform.eulerAngles   = Vector3.zero;
            CurrentEvent.rectTransform.SetAsLastSibling();

            Color c = NextEvents[nextEventIndex].Image.color;
            c.a     = 1.0f;
            NextEvents[nextEventIndex].Image.color = c;

            EnableTouch();
            isAnimating = false;

            nextEventConfigs = GameStart.Game.UpdateNextEventConfig();
            SetNextEventImage();
            GameStart.Game.CheckGameOver();
        });
        seq.Play();
    }
コード例 #25
0
        private EventConfig DeserializeEventConfig(XmlNode root)
        {
            var config = new EventConfig();

            var section = root.SelectSingleNode("event");

            if (section == null)
            {
                return(config);
            }

            config.LoadFrom(section);
            return(config);
        }
コード例 #26
0
    public override void Init()
    {
        Debug.Log("init game");

        healthValue = new int[4];
        for (int i = 0; i < healthValue.Length; i++)
        {
            healthValue[i] = 50;
        }

        turnCount          = 1;
        currentEventConfig = RandomEvent();
        UIManager.OpenPanel("GameView", false, healthValue, currentEventConfig, turnCount);
    }
コード例 #27
0
ファイル: GameView.cs プロジェクト: BoenYang/DeathOfDesginer
    private void OnRestartGame(UIMsg msg)
    {
        healthValue        = (int[])msg.args[0];
        currentEventConfig = msg.args[1] as EventConfig;

        ChooseDesc.text = currentEventConfig.Event;
        RoleName.text   = roleNameDict[currentEventConfig.Hero];
        TurnCount.text  = string.Format("第1个月");

        for (int i = 0; i < healthValue.Length; i++)
        {
            Bars[i].fillAmount = healthValue[i] / 100f;
        }
    }
コード例 #28
0
        public DetectorForm(EntryPointInjector entryPoint, EventConfig eventConfig)
        {
            this.entryPoint  = entryPoint;
            this.eventConfig = eventConfig;

            InitializeComponent();

            MakeHiddenWindow();

            RegisterHotKey(this.Handle, (int)KeyEvent.MainEvent, 0x0004 | 0x4000, (int)Keys.Escape);
            RegisterHotKey(this.Handle, (int)KeyEvent.TvEvent, 0x0001 | 0x0002 | 0x4000, (int)Keys.T);
            RegisterHotKey(this.Handle, (int)KeyEvent.SoundEvent, 0x0001 | 0x0002 | 0x4000, (int)Keys.S);
            RegisterHotKey(this.Handle, (int)KeyEvent.LightEvent, 0x0001 | 0x0002 | 0x4000, (int)Keys.L);
            RegisterHotKey(this.Handle, (int)KeyEvent.SecondTvEvent, 0x0001 | 0x0002 | 0x4000, (int)Keys.B);
        }
コード例 #29
0
ファイル: GpioCore.cs プロジェクト: ArunPrakashG/Luna
        private async Task InitEvents()
        {
            for (int i = 0; i < AvailablePins.InputPins.Length; i++)
            {
                EventConfig config = new EventConfig(AvailablePins.InputPins[i], GpioPinMode.Input,
                                                     PinEventStates.Both, OnPinValueChanged);
                await EventManager.RegisterEvent(config).ConfigureAwait(false);
            }

            for (int i = 0; i < AvailablePins.OutputPins.Length; i++)
            {
                EventConfig config = new EventConfig(AvailablePins.OutputPins[i], GpioPinMode.Output,
                                                     PinEventStates.Both, OnPinValueChanged);
                await EventManager.RegisterEvent(config).ConfigureAwait(false);
            }
        }
コード例 #30
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            // Geographic Entities
            ContinentConfig.SetEntityBuilder(modelBuilder.Entity <Continent>());
            CountryConfig.SetEntityBuilder(modelBuilder.Entity <Country>());
            RegionConfig.SetEntityBuilder(modelBuilder.Entity <Region>());


            // Administrative Entities
            AdminConfig.SetEntityBuilder(modelBuilder.Entity <Admin>());
            EventConfig.SetEntityBuilder(modelBuilder.Entity <Event>());

            // Measures Entities
            SanitaryMeasureConfig.SetEntityBuilder(modelBuilder.Entity <SanitaryMeasure>());
            ContainmentMeasureConfig.SetEntityBuilder(modelBuilder.Entity <ContainmentMeasure>());
            CmByCountry.SetEntityBuilder(modelBuilder.Entity <CountryContainmentMeasures>());
            SmByCountry.SetEntityBuilder(modelBuilder.Entity <CountrySanitaryMeasures>());

            // Hospital Entities
            HospitalConfig.SetEntityBuilder(modelBuilder.Entity <Hospital>());
            HEmployeeConfig.SetEntityBuilder(modelBuilder.Entity <HospitalEmployee>());
            MedicationConfig.SetEntityBuilder(modelBuilder.Entity <Medication>());

            // Person Entities
            PatientConfig.SetEntityBuilder(modelBuilder.Entity <Patient>());
            P_MedicationConfig.SetEntityBuilder(modelBuilder.Entity <PatientMedications>());
            Pt_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PatientPathologies>());
            PersonConfig.SetEntityBuilder(modelBuilder.Entity <ContactedPerson>());
            Ps_PathologyConfig.SetEntityBuilder(modelBuilder.Entity <PersonPathologies>());
            ContactsByPatientConfig.SetEntityBuilder(modelBuilder.Entity <PersonsContactedByPatient>());

            // Not related Entities
            PathologiesConfig.SetEntityBuilder(modelBuilder.Entity <Pathology>());
            Pharm_CompanyConfig.SetEntityBuilder(modelBuilder.Entity <PharmaceuticalCompany>());
            StatusConfig.SetEntityBuilder(modelBuilder.Entity <PatientStatus>());

            // Views and Stored Procedures
            modelBuilder.Entity <PatientView>().HasNoKey().ToView(null);
            modelBuilder.Entity <ExportPatient>().HasNoKey().ToView(null);
            modelBuilder.Entity <CasesView>().HasNoKey().ToView(null);
            modelBuilder.Entity <ReportView>().HasNoKey().ToView(null);
            modelBuilder.Entity <MeasureView>().HasNoKey().ToView(null);
            modelBuilder.Entity <MedicationView>().HasNoKey().ToView(null);
            modelBuilder.Entity <PatientMedicationView>().HasNoKey().ToView(null);
            modelBuilder.Entity <PathologyView>().HasNoKey().ToView(null);
            modelBuilder.Entity <ContactView>().HasNoKey().ToView(null);
        }