Пример #1
0
        public Connector()
        {
            InstallSubdirectory(
                new Dictionary<string, byte[]>
                {
                    {"settings.cnf",    System.Text.Encoding.ASCII.GetBytes("ConnectionString:\t\tSERVER=localhost;DATABASE=DarkRift;USERNAME=username;PASSWORD=password")}
                }
            );

            try
            {
                ConfigReader reader = new ConfigReader(GetSubdirectory() + @"\settings.cnf");

                if( reader["ConnectionString"] == null )
                {
                    Interface.LogFatal("ConnectionString was not defined in the MySQLConnector's settings.cnf file!");
                    DarkRiftServer.Close(true);
                }
                connectionString = reader["ConnectionString"];
            }
            catch(System.IO.FileNotFoundException)
            {
                Interface.LogFatal("MySQLConnector's settings file is missing!");
                DarkRiftServer.Close(true);
            }
        }
        protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
        {
            base.LoadContent(GraphicInfo, factory, contentManager);

            {
                SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
                TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
                ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
                ForwardMaterial fmaterial = new ForwardMaterial(shader);
                IObject obj = new IObject(fmaterial, simpleModel, tmesh);
                this.World.AddObject(obj);
            }

            ConfigWriter cw = new ConfigWriter("teste.properties");
            cw.AddKeyValue("teste", "value");
            cw.Write();

            ConfigReader cr = new ConfigReader("teste.properties");
            cr.Read();
            String v = cr.ReadValue("teste");
            System.Diagnostics.Debug.Assert(v == "value");

            this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));

            this.RenderTechnic.AddPostEffect(new BlackWhitePostEffect());
        }
 public void SetUp()
 {
     var filename = Guid.NewGuid().ToString();
     diskPath = @"c:\" + filename;
     var uriPath = "file:///C:/" + filename;
     configRepository = new ConfigReader(uriPath, string.Empty, string.Empty);
 }
        public void Embedded_GetSetting_KeyDoesNotExits()
        {
            var configReader = new ConfigReader(BuildProvider());
            string expectedValue = null;
            var actualValue = configReader.GetSetting<string>("DoesNotExit");

            Assert.AreEqual(actualValue, expectedValue);
        }
        public void GetSetting_KeyDoesNotExits()
        {
            var configReader = new ConfigReader();

            var actualValue = configReader.GetSetting<string>("DoesNotExit");

            Assert.AreEqual(actualValue, null);
        }
        public void GetSetting_NoEnviroment_TypeOfString()
        {
            var configReader = new ConfigReader();
            const string expectedValue = "TestValue";
            var actualValue = configReader.GetSetting<string>("TestKey");

            Assert.AreEqual(expectedValue, actualValue);
        }
 public async Task Http_Async_GetSetting_KeyDoesNotExits()
 {
     // arrange
     var configReader = new ConfigReader(this.SourceProvider);
     // act
     var actualValue = await configReader.GetSettingAsync<string>("DoesNotExit");
     // assert
     Assert.AreEqual(actualValue, null);
 }
        public void GetSetting_RootFolderSpecified()
        {
            Environment.SetEnvironmentVariable("RootFolder", "Config");
            var configReader = new ConfigReader();
            string expectedValue = "TestValueInCustomRootConfig";
            var actualValue = configReader.GetSetting<string>("TestKey");

            Assert.AreEqual(expectedValue, actualValue);
        }
 public async Task Http_Async_GetSetting_TypeOfString()
 {
     // arrange
     var configReader = new ConfigReader(this.SourceProvider);
     // act
     var expectedValue = "Leanne Graham";
     var actualValue = await configReader.GetSettingAsync<string>("name");
     // assert
     Assert.AreEqual(expectedValue, actualValue);
 }
        public void GetSetting_Production_TypeOfString()
        {
            Environment.SetEnvironmentVariable("ConfEnv", "Production");

            var configReader = new ConfigReader();
            const string expectedValue = "TestValue";
            var actualValue = configReader.GetSetting<string>("TestKey");

            Assert.AreEqual(expectedValue, actualValue);
        }
Пример #11
0
        public void should_read_config()
        {
            // given
            var reader = new ConfigReader();

            // when
            string slackKey = reader.SlackApiKey();

            // then
            slackKey.ShouldNotBeNull();
        }
 public void Http_Sync_GetSetting_TypeOfString()
 {
     // arrange
     var provider = new HttpClientSourceProvider("http://date.jsontest.com/", HttpMethod.Get);
     var configReader = new ConfigReader(this.SourceProvider);
     // act
     var expectedValue = "Leanne Graham";
     var actualValue = configReader.GetSetting<string>("name");
     // assert
     Assert.AreEqual(expectedValue, actualValue);
 }
Пример #13
0
        public void should_connect_as_expected()
        {
            // given
            var configReader = new ConfigReader();
            var containerStub = new NoobotContainerStub();
            var connector = new NoobotCore(configReader, new EmptyLog(), containerStub);

            // when
            var task = connector.Connect();
            task.Wait();

            // then

        }
        public void GetSetting_NoEnviroment_TypeOfPerson()
        {
            var configReader = new ConfigReader();
            var expectedValue = new Person
            {
                Name = "foo",
                Surname = "bar"

            };
            var actualValue = configReader.GetSetting<Person>("TestObjectKey");

            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Surname, actualValue.Surname);
        }
Пример #15
0
 public static TaskManager CreateTaskManager(SqlToGraphiteSection configuration)
 {
     var cacheLength = new TimeSpan(0, configuration.ConfigCacheLengthMinutes, 0);
     var stop = new Stop();
     IDataClientFactory dataClientFactory = new DataClientFactory(log);
     IGraphiteClientFactory graphiteClientFactory = new GraphiteClientFactory(log);
     var configMapper = new ConfigMapper(configuration.Hostname, stop, dataClientFactory, graphiteClientFactory, log);
     var configReader = new ConfigReader(configuration.ConfigUri,configuration.ConfigUsername,configuration.ConfigPassword);
     var cache = new Cache(cacheLength, log);
     var sleeper = new Sleeper();
     var knownGraphiteClients = new KnownGraphiteClients();
     var cr = new ConfigRepository(configReader, knownGraphiteClients, cache, sleeper, log, configuration.MinutesBetweenRetryToGetConfigOnError);
     var configController = new ConfigController(configMapper, log, cr);
     return new TaskManager(log, configController, configuration.ConfigUri, stop, sleeper, configuration.CheckConfigUpdatedEveryMinutes);
 }
 public void Http_Sync_GetSetting_TypeOfAddress()
 {
     // arrange
     var configReader = new ConfigReader(this.SourceProvider);
     var expectedValue = new Address
     {
         street = "Kulas Light",
         suite = "Apt. 556",
         city = "Gwenborough"
     };
     // act
     var actualValue = configReader.GetSetting<Address>("address");
     // assert
     Assert.AreEqual(expectedValue.street, actualValue.street);
     Assert.AreEqual(expectedValue.suite, actualValue.suite);
 }
        public void GetSetting_Production_TypeOfPerson()
        {
            Environment.SetEnvironmentVariable("ConfEnv", "Production");

            var configReader = new ConfigReader();
            var expectedValue = new Person
            {
                Name = "foo",
                Surname = "bar"

            };
            var actualValue = configReader.GetSetting<Person>("TestObjectKey");

            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Surname, actualValue.Surname);
        }
        // The setup constructor will be called each time this plugin's setup is opened from the CF Setting Page
        // This setup is opened as a dialog from the CF_pluginShowSetup() call into the main plugin application form.
        public Setup(ICFMain mForm, ConfigReader config, LanguageReader lang)
        {
            // MainForm must be set before calling any Centrafuse API functions
            this.MainForm = mForm;

            // pluginConfig and pluginLang should be set before calling CF_initSetup() so this CFSetup instance
            // will internally save any changed settings.
            this.pluginConfig = config;
            this.pluginLang = lang;

            // When CF_initSetup() is called, the CFPlugin layer will call back into CF_setupReadSettings() to read the page
            // Note that this.pluginConfig and this.pluginLang must be set before making this call
            CF_initSetup(1, 1);

            // Update the Settings page title
            this.CF_updateText("TITLE", this.pluginLang.ReadField("/APPLANG/SETUP/TITLE"));
        }
        public void GetSetting_NoEnviroment_TypeOfString()
        {
            if (Environment.GetEnvironmentVariable("ConfEnv") != null)
            {
                Environment.SetEnvironmentVariable("ConfEnv", null);
            }

            if (Environment.GetEnvironmentVariable("RootFolder") != null)
            {
                Environment.SetEnvironmentVariable("RootFolder", null);
            }

            var configReader = new ConfigReader();
            const string expectedValue = "TestValue";
            var actualValue = configReader.GetSetting<string>("TestKey");

            Assert.AreEqual(expectedValue, actualValue);
        }
        public void GetSetting_NoEnviroment_TypeOfPerson()
        {
            //Explicitly Remove eniroment
            if (Environment.GetEnvironmentVariable("ConfEnv") != null)
            {
                Environment.SetEnvironmentVariable("ConfEnv", null);
            }

            var configReader = new ConfigReader();
            var expectedValue = new Person
            {
                Name = "foo",
                Surname = "bar"

            };
            var actualValue = configReader.GetSetting<Person>("TestObjectKey");

            Assert.AreEqual(expectedValue.Name, actualValue.Name);
            Assert.AreEqual(expectedValue.Surname, actualValue.Surname);
        }
Пример #21
0
        //当更改基础技能时,比如随从技能改变
        private void SetBaseSkillType(SkillType skillType, int skillId)
        {
            BaseSkillIdDic[skillType] = skillId;

            //暂时屏蔽随从技能升级
            if (skillType == SkillType.SKILL_TYPEABSORB1 || skillType == SkillType.SKILL_TYPEABSORB2)
            {
                SkillIdDic[skillType] = skillId;
                return;
            }
            SkillManagerConfig info = ConfigReader.GetSkillManagerCfg(skillId);

            if (skillId != 0 && info != null)
            {
                SetSkillUpdate(skillType, Level);
            }
            else if (skillId == 0)
            {
                SkillIdDic[skillType] = skillId;
            }
        }
    private void Start()
    {
        Instance = this;

        // Set resolution after fullscreen.
        ConfigReader configReader = new ConfigReader(SETTINGS_FILE_NAME);

        resolutions = Screen.resolutions;
        resolutionDropdown.ClearOptions();
        List <string> resolutionOptions      = new List <string>();
        int           currentResolutionIndex = 0;

        for (int i = 0; i < resolutions.Length; i++)
        {
            string option = resolutions[i].width + " x " + resolutions[i].height + " (" + resolutions[i].refreshRate + "Hz)";
            resolutionOptions.Add(option);
            if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height && resolutions[i].refreshRate == Screen.currentResolution.refreshRate)
            {
                currentResolutionIndex = i;
            }
        }
        resolutionDropdown.AddOptions(resolutionOptions);
        resolutionDropdown.value = configReader.GetInt(RESOLUTION_VALUE, currentResolutionIndex);
        resolutionDropdown.RefreshShownValue();

        // Load rest of configurations.
        SetQuality(configReader.GetInt(QUALITY_VALUE, 2));
        isFullscreenSave = configReader.GetString(FULLSCREEN_VALUE, TRUE_VALUE).Equals(TRUE_VALUE);
        SetFullscreen(isFullscreenSave);
        fullScreenToggle.isOn = isFullscreenSave;

        float musicVolume = configReader.GetFloat(MUSIC_VOLUME_VALUE, 1);

        MasterVolume(musicVolume);
        musicSlider.value = musicVolume;
        float sfxVolume = configReader.GetFloat(SFX_VOLUME_VALUE, 1);

        GameSFX(sfxVolume);
        sfxSlider.value = sfxVolume;
    }
Пример #23
0
    static async Task Inner(string targetDirectory, ConfigInput configInput)
    {
        var(fileConfig, configFilePath) = ConfigReader.Read(targetDirectory);
        var configResult = ConfigDefaults.Convert(fileConfig, configInput);

        var message = LogBuilder.BuildConfigLogMessage(targetDirectory, configResult, configFilePath);

        Console.WriteLine(message);

        var processor = new DirectoryMarkdownProcessor(
            targetDirectory,
            log: Console.WriteLine,
            directoryFilter: ExcludeToFilterBuilder.ExcludesToFilter(configResult.Exclude),
            readOnly: configResult.ReadOnly,
            writeHeader: configResult.WriteHeader,
            header: configResult.Header,
            urlPrefix: configResult.UrlPrefix,
            linkFormat: configResult.LinkFormat,
            tocExcludes: configResult.TocExcludes,
            tocLevel: configResult.TocLevel,
            treatMissingSnippetAsWarning: configResult.TreatMissingSnippetAsWarning,
            treatMissingIncludeAsWarning: configResult.TreatMissingIncludeAsWarning,
            maxWidth: configResult.MaxWidth,
            validateContent: configResult.ValidateContent);

        var snippets = new List <Snippet>();
        await snippets.AppendUrlsAsSnippets(configResult.UrlsAsSnippets);

        processor.AddSnippets(snippets);

        try
        {
            processor.Run();
        }
        catch (SnippetException exception)
        {
            Console.WriteLine($"Failed: {exception.Message}");
            Environment.Exit(1);
        }
    }
        private void ShowObj()
        {
            for (int i = 0; i < showObjDic.Count; i++)
            {
                int taskId = showObjDic.ElementAt(i).Value.TaskId;
                CGameObjectShowTask showTask = ConfigReader.GetObjShowTaskInfo(taskId);
                if (showTask == null)
                {
                    Debug.LogError("GuideShowObjTask 找不到任務 Id" + taskId);
                }
                Transform btnParent = null;
                switch (showTask.PathType)
                {
                case UIPathType.UIGuideType:
                    if (UINewsGuide.Instance != null)
                    {
                        btnParent = UINewsGuide.Instance.transform;
                    }
                    break;

                case UIPathType.UIPlayType:
//                         if (UIPlay.Instance != null)
//                         {
//                             btnParent = UIPlay.Instance.transform;
//                         }
                    break;
                }
                if (btnParent == null)
                {
                    Debug.LogError("GuideShowObjTask = " + taskId + "挂点不存在");
                }
                GameObject objShow = btnParent.Find(showTask.Path).gameObject;
                if (objShow == null)
                {
                    Debug.LogError("GuideShowObjTask 找不到物體 Id" + taskId);
                }
                objShow.SetActive(showObjDic.ElementAt(i).Value.show);
                //  Debug.LogError("objShow = " + objShow.name + "value = " + showObjDic.ElementAt(i).Value.show);
            }
        }
Пример #25
0
        //6.创建普通引导特效
        public NormalEffect CreateLeadingEffect(UInt64 owner, UInt32 skillModelID, UInt32 projectid)
        {
            SkillLeadingonfig skillconfig = ConfigReader.GetSkillLeadingConfig(skillModelID);

            //判断路径是否有效
            if (skillconfig == null || skillconfig.effect == "0")
            {
                return(null);
            }

            string       resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillconfig.effect;
            NormalEffect effect       = new NormalEffect();

            //加载特效信息
            effect.projectID = projectid;
            effect.NEType    = NormalEffect.NormalEffectType.eNE_Leading;
            effect.resPath   = resourcePath;

            Ientity entity = null;

            EntityManager.AllEntitys.TryGetValue(owner, out entity);

            //创建
            if (entity != null)
            {
                effect.Create();
                if (effect.obj == null)
                {
                    return(null);
                }
                if (null != entity.RealEntity.objPoint)
                {
                    effect.obj.transform.parent        = entity.RealEntity.objPoint.transform;
                    effect.obj.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
                }
            }

            AddEffect(effect.projectID, effect);
            return(effect);
        }
Пример #26
0
    public List <int> GetHeroRecommendEquip()
    {
        if (PlayerManager.Instance.LocalAccount.ObjType == ObPlayerOrPlayer.PlayerObType)
        {
            return(null);
        }
        List <int>     items  = new List <int>();
        Iselfplayer    player = PlayerManager.Instance.LocalPlayer;
        HeroConfigInfo info   = ConfigReader.GetHeroInfo(player.NpcGUIDType);

        for (int i = 0; i < 3; i++)
        {
            switch (i)
            {
            case 0:
                items.AddRange(info.HeroPreEquip);
                break;

            case 1:
                items.AddRange(info.HeroMidEquip);
                break;

            case 2:
                items.AddRange(info.HeroLatEquip);
                break;
            }
            int count     = items.Count / 6;
            int tempCount = items.Count;
            if (items.Count % 6 != 0)
            {
                count += 1;
            }
            for (int j = 0; j < (count * 6 - tempCount); j++)
            {
                items.Add(0);
            }
        }

        return(items);
    }
Пример #27
0
        public DtstSECCrawlerViews.spCOI_fullTextSearchByFormTypeWithSnippetDataTable GetFormsByFullTextSearchAndFormTypeWithSnippet(string searchCriteria, string formType, LinkResponseType makeURLClickable, string customURL, string coName)
        {
            var adapter1 = new DtstSECCrawlerViewsTableAdapters.spCOI_fullTextSearchByFormTypeWithSnippetTableAdapter();
            var table    = adapter1.GetData(searchCriteria, formType, coName);

            if (makeURLClickable == LinkResponseType.ClickableWithAbsolutePath)
            {
                var basePath = (string)ConfigReader.GetValue("LocalDataStoreWebShare", string.Empty.GetType());
                foreach (var rowF in table)
                {
                    rowF.FormPartialURL = "<A target=_blank href=\"" + basePath + rowF.FormPartialURL + "\">" + rowF.FormPartialURL + "</A>";
                }
            }
            if (makeURLClickable == LinkResponseType.ClickableWithModifiedLink)
            {
                var basePath = (string)ConfigReader.GetValue("LocalDataStoreWebShare", string.Empty.GetType());
                foreach (var rowF in table)
                {
                    rowF.FormPartialURL = "<A target=_blank href=\"" + customURL + rowF.FormID.ToString() + "\">" + rowF.FormPartialURL + "</A>";
                }
            }
            if (makeURLClickable == LinkResponseType.NotClickableWithModifiedPath)
            {
                string basePath;
                if (string.IsNullOrEmpty(customURL))
                {
                    basePath = (string)ConfigReader.GetValue("LocalDataStoreWebShare", string.Empty.GetType());
                }
                else
                {
                    basePath = customURL;
                }
                foreach (var rowF in table)
                {
                    rowF.FormPartialURL = basePath + rowF.FormPartialURL;
                }
            }

            return(table);
        }
Пример #28
0
        public ActionResult RegisterAdmin(RegisterAdminViewModel model)
        {
            if (model.BootstrapAdministratorSecret != ConfigReader.GetConfigValue("BootstrapAdministratorSecret"))
            {
                this.ModelState.AddModelError("BootstrapAdministratorSecret", "The provided Bootstrap Administrator Secret is invalid.");
            }

            if (!this.ModelState.IsValid)
            {
                return(View(model));
            }

            if (this.userService.GetUsers().Count() > 0)
            {
                // If a user exists, then this action should not occur.
                return(RedirectToAction("Index", "Home"));
            }

            var identity = this.HttpContext.User.Identity as IClaimsIdentity;

            var nameIdentifierClaim   = identity.Claims.Where(c => c.ClaimType.Equals(ClaimTypes.NameIdentifier, StringComparison.OrdinalIgnoreCase)).SingleOrDefault();
            var identityProviderClaim = identity.Claims.Where(c => c.ClaimType.Equals(IdentityProviderClaimType, StringComparison.OrdinalIgnoreCase)).SingleOrDefault();

            var user = new User()
            {
                Name             = model.AdministratorEmail,
                Email            = model.AdministratorEmail,
                NameIdentifier   = nameIdentifierClaim.Value,
                IdentityProvider = identityProviderClaim.Value,
            };

            this.userService.CreateUser(user);
            var role = this.roleService.GetRoleByName("Administrator");

            this.roleService.AddUserToRole(role, user);

            this.ExecuteLogOff();

            return(RedirectToAction("RegistrationSuccess"));
        }
Пример #29
0
        public JsonResult GetScheduledAppointmentsByOfficeAndStatus(string officeId, int statusId, string startDate, string endDate)
        {
            // string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetScheduledAppointmentsByOfficeAsync).Value + officeId + "/" + statusId + "/" + startDate + "/" + endDate; ;
            string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetScheduledAppointmentsByOfficeAsync) + officeId + "/" + statusId + "/" + startDate + "/" + endDate;
            CalendarAppointmentModel model = null;

            // string apiUrl = "api/AppointmentDetails/GetScheduledAppointmentsByOfficeAsync/" + officeId + "/" + statusId + "/" + startDate + "/" + endDate;
            // string apiUrl = const + officeId + "/" + statusId + "/" + startDate + "/" + endDate;
            try
            {
                var result = Common.CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod);
                if (!String.IsNullOrEmpty(result.Result))
                {
                    model = JsonConvert.DeserializeObject <CalendarAppointmentModel>(result.Result);
                }
            }
            catch (Exception ex)
            {
                LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.GetOfficeDetailsByEntity", ex.ToString());
            }
            return(JsonResult(model, JsonRequestBehavior.AllowGet));
        }
Пример #30
0
        private void FileUploadFileUploadCompleted(object sender, FileUploadCompletedEventArgs e)
        {
            var dataStore = BlobShareDataStoreEntities.CreateInstance();

            try
            {
                var blobService = new BlobService(
                    dataStore,
                    CloudStorageAccount.Parse(ConfigReader.GetConfigValue("DataConnectionString")),
                    ConfigReader.GetConfigValue("MainBlobContanier"));

                try
                {
                    if (!string.IsNullOrEmpty(e.FileName))
                    {
                        e.DistributedUpload.Commit();

                        var resource = new Blob();
                        resource.BlobId           = Guid.Parse(this.ctx.Request.QueryString["id"]);
                        resource.Name             = Path.GetFileNameWithoutExtension(e.FileName);
                        resource.Description      = string.Empty;
                        resource.OriginalFileName = e.FileName;
                        resource.UploadDateTime   = DateTime.UtcNow;

                        blobService.CreateBlob(resource);
                    }
                }
                catch (Exception ex)
                {
                    this.ctx.Response.StatusCode        = (int)System.Net.HttpStatusCode.InternalServerError;
                    this.ctx.Response.StatusDescription = ex.Message;
                    return;
                }
            }
            finally
            {
                dataStore.Dispose();
            }
        }
Пример #31
0
        //主角是否有不能移动的buff
        public bool isHaveStopBuff(UInt64 key)
        {
            foreach (Buff buff in mBuffDict.Values)
            {
                if (buff == null || buff.Entity == null || buff.Entity.GameObjGUID != key)
                {
                    continue;
                }

                BuffConfigInfo bi = ConfigReader.GetBuffInfo(buff.TypeID);
                if (null == bi)
                {
                    continue;
                }

                if (bi.effectID == (int)BuffEffectEnum.XuanYun || bi.effectID == (int)BuffEffectEnum.ShuFu)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #32
0
    void Start()
    {
        //玩家管理器
        new PlayerManager();
        //Npc管理器
        new NpcManager();
        //关闭客户端连接
        NetworkManager.Instance.Close();
        // 进入初始化状态  然后在Update中    loginState
        GameStateManager.Instance.EnterDefaultState();
        //初始化逻辑对象
        HolyGameLogic logini = HolyGameLogic.Instance;

        //预加载,减少进入游戏资源加载卡顿(创建所有配置文件)
        ConfigReader.Init();
        //读取(敏感词汇)配置文件
        //GameMethod.FileRead();
        //预加载特效信息
        ReadPreLoadConfig.Instance.Init();
        //需要释放的资源信息
        ReadReleaseResourceConfig.Instance.Init();
    }
Пример #33
0
        public void ConfigReaderConfigReadInvalidJson()
        {
            // arrange
            const string configFilePath = @"c:\users\someone\.tsqllintrc-bad-json";
            var          fileSystem     = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                {
                    configFilePath, new MockFileData(@"{")
                }
            });

            var reporter = Substitute.For <IReporter>();

            // act
            var configReader = new ConfigReader(reporter, fileSystem);

            configReader.LoadConfig(configFilePath);

            // assert
            reporter.Received().Report("Config file is not valid Json.");
            Assert.IsFalse(configReader.IsConfigLoaded);
        }
        public List <TestCaseData> RetrieveEYDSReviewCalcsTests()
        {
            List <TestCaseData> testList = new List <TestCaseData>();

            ConfigReader.SetEydsSettings();

            foreach (string filename in fullNames)
            {
                ExcelInputReader <EydsReviewTestCase> .PopulateInReviewCalcCollection(filename, EydsReviewTestCase.GetFromExcel);
            }

            //Esta parte final se repite en los 3 métodos (salvo de el eyds) pero no supe como hacerlo genérico :P
            var testItems = ExcelInputReader <EydsReviewTestCase> .GetData();

            foreach (var testItem in testItems)
            {
                testList.Add(new TestCaseData(testItem)
                             .SetProperty(nameof(testItem.ProjectName), testItem.ProjectName)
                             .SetProperty(nameof(testItem.Set), testItem.Set));
            }
            return(testList);
        }
Пример #35
0
    void SetLevelDeadKill(BattleInfo item, int i)
    {
        BattleInfoList [i].PlayerLevelLabel.text = item.PlayerLevel.ToString();
        BattleInfoList [i].PlayerNameLabel.text  = item.PlayerName;

        if (!EntityManager.AllEntitys.ContainsKey(item.PlayerIcon))
        {
            return;
        }
        IEntity sEntity = EntityManager.AllEntitys[item.PlayerIcon];

        int id = (int)sEntity.ObjTypeID;

        BattleInfoList [i].PlayerDeathLabel.text = item.PlayerDeath.ToString();
        HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id);

        BattleInfoList [i].PlayerKillsLabel.text = item.PlayerKills.ToString();
        if (info != null)
        {
            BattleInfoList [i].PlayerIcon.spriteName = info.HeroSelectHead.ToString();
        }
    }
Пример #36
0
 private void LoadScript_bt_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog dialog = new OpenFileDialog();
         dialog.Title            = "Select file";
         dialog.InitialDirectory = "config\\Script";
         //dialog.Filter = "xls files (*.*)|*.xls";
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             ConfigReader <Command> Script = new ConfigReader <Command>();
             cmdList              = Script.ReadFile(dialog.FileName);
             ScriptPath           = dialog.FileName;
             Script_gv.DataSource = null;
             Script_gv.DataSource = cmdList;
         }
     }
     catch (Exception ex)
     {
         logger.Error("LoadScript_bt_Click:" + ex.Message + "\n" + ex.StackTrace);
     }
 }
Пример #37
0
        public JsonResult GetAppointmentByStatus(string officeId, string statusIds, string startDate, string endDate)
        {
            startDate = Convert.ToDateTime(startDate).ToString("MM-dd-yyyy");
            endDate   = Convert.ToDateTime(endDate).ToString("MM-dd-yyyy");
            CalendarAppointmentModel model = null;
            //string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetAppointmentByStatus).Value + officeId + "/" + statusIds + "/" + startDate + "/" + endDate;
            string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetAppointmentByStatus) + officeId + "/" + statusIds + "/" + startDate + "/" + endDate;

            try
            {
                var result = CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod);
                if (!String.IsNullOrEmpty(result.Result))
                {
                    model = JsonConvert.DeserializeObject <CalendarAppointmentModel>(result.Result);
                }
            }
            catch (Exception ex)
            {
                LogProvider.ErrorFormat("Controller:{0} Error: {1}", "AppointmentDetailsController.GetAppointmentByStatus", ex.ToString());
            }
            return(JsonResult(model, JsonRequestBehavior.AllowGet));
        }
Пример #38
0
        public void ConfigReaderNoRulesNoThrow()
        {
            // arrange
            const string configFilePath = @"c:\users\someone\.tsqllintrc-missing-rules";
            var          fileSystem     = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                {
                    configFilePath, new MockFileData(@"{}")
                }
            });

            var reporter = Substitute.For <IReporter>();

            // assert
            Assert.DoesNotThrow(() =>
            {
                // act
                var configReader = new ConfigReader(reporter, fileSystem);
                Assert.IsNotNull(configReader);
                Assert.IsFalse(configReader.IsConfigLoaded);
            });
        }
Пример #39
0
        static void Main(string[] args)
        {
            string classifierType = ConfigReader.Read("classifierType");

            Logger.Log("classifierType:" + classifierType);

            try
            {
                AbstractClassifier cls = LoadClassifier(classifierType);

                cls.PrintParams();
                cls.LoadData();
                var result = cls.Build();

                Logger.Log("AUC = " + result.LastResult.AUC);
                Logger.Log("LogLoss = " + result.LastResult.LogLoss);
            }
            catch (Exception e)
            {
                Logger.Log(e);
            }
        }
        private void SendMailService(Email email)
        {
            var mimeMessage = new MimeMessage();

            mimeMessage.From.Add(new MailboxAddress(email.FromEmailTitle, email.FromEmail));
            mimeMessage.To.Add(new MailboxAddress(email.ToEmailTitle, email.ToEmail));
            mimeMessage.Subject = email.Subject;
            mimeMessage.Body    = new TextPart("plain")
            {
                Text = email.BodyContent
            };

            using (var client = new SmtpClient())
            {
                client.Connect(email.SmtpServer, email.SmtpPortNumber, false);
                client.Authenticate(
                    ConfigReader.GetConfigFile()["Email:Usermail"],
                    ConfigReader.GetConfigFile()["Email:Password"]);
                client.Send(mimeMessage);
                client.Disconnect(true);
            }
        }
Пример #41
0
        public void Dispose()
        {
            if (this.disposed)
            {
                return;
            }

            this.disposed = true;

            if (GetTestOnlyFlushDataOnDispose())
            {
                this.dataCollector.FlushData();
            }

            // Dispose the data collector
            this.dataCollector.Dispose();

            // Remove the current configuration object
            ConfigReader.RemoveAppConfig(this.applicationInstanceId);
            ConfigReader.RemoveServiceConfigsForApp(this.applicationInstanceId);
            GC.SuppressFinalize(this);
        }
Пример #42
0
        //播放技能释放声音
        public static void playSkillReleaseSound(Ientity entity, int skillID)
        {
            if (entity == null)
            {
                return;
            }
            SkillManagerConfig skillinfo = ConfigReader.GetSkillManagerCfg(skillID);

            if (skillinfo == null)
            {
                return;
            }
            string       soundPath = GameConstDefine.LoadGameSoundPath + skillinfo.rSound;
            ResourceUnit objUnit   = ResourcesManager.Instance.loadImmediate(soundPath, ResourceType.ASSET);
            AudioClip    clip      = objUnit.Asset as AudioClip;

            if (clip != null)
            {
                AudioSource Audio = AudioManager.Instance.PlayEffectAudio(clip);
                SceneSoundManager.Instance.addSound(Audio, entity.RealEntity.gameObject);
            }
        }
Пример #43
0
    //normal skill init
    public void InitHeroSkills(Iplayer player)
    {
        if (skillDic.ContainsKey(player))
        {
            return;
        }
        SkillInfoDate skillListData = new SkillInfoDate();

        HeroConfigInfo heroConfig;

        if (ConfigReader.HeroXmlInfoDict.TryGetValue(player.NpcGUIDType, out heroConfig))
        {
            SkillManagerConfig skillCfg = ConfigReader.GetSkillManagerCfg(heroConfig.HeroSkillType1);
            if (skillCfg != null)
            {
                skillListData.AddSkillInfoDate(skillCfg.id, 0, skillCfg.skillIcon, skillCfg.coolDown / 1000, 0, true);
            }

            skillCfg = ConfigReader.GetSkillManagerCfg(heroConfig.HeroSkillType2);
            if (skillCfg != null)
            {
                skillListData.AddSkillInfoDate(skillCfg.id, 1, skillCfg.skillIcon, skillCfg.coolDown / 1000, 0, true);
            }

            skillCfg = ConfigReader.GetSkillManagerCfg(heroConfig.HeroSkillType3);
            if (skillCfg != null)
            {
                skillListData.AddSkillInfoDate(skillCfg.id, 2, skillCfg.skillIcon, skillCfg.coolDown / 1000, 0, false);
            }

            skillCfg = ConfigReader.GetSkillManagerCfg(heroConfig.HeroSkillType4);
            if (skillCfg != null)
            {
                skillListData.AddSkillInfoDate(skillCfg.id, 3, skillCfg.skillIcon, skillCfg.coolDown / 1000, 0, false);
            }
        }

        skillDic[player] = skillListData;
    }
Пример #44
0
    public static ConfigReader GetInstance()
    {
        if (_reader == null)
        {
            _reader = new ConfigReader();

            if (File.Exists(Application.dataPath + "/config.ini"))
            {
                string[] lines = File.ReadAllLines(Application.dataPath + "/config.ini");
                foreach (string line in lines)
                {
                    string[] data  = line.Split(new char[] { '=' });
                    string   pro   = data[0];
                    string   value = data[1];
                    if (pro == "server")
                    {
                        _reader.ServerIp = value;
                    }
                    if (pro == "port")
                    {
                        _reader.ServerPort = int.Parse(value);
                    }
                }
            }
            else
            {
                FileStream   fs = new FileStream(Application.dataPath + "/config.ini", FileMode.CreateNew);
                StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
                sw.WriteLine("server=127.0.0.1");
                sw.WriteLine("port=9933");
                _reader.ServerIp   = "127.0.0.1";
                _reader.ServerPort = 9933;
                sw.Flush();
                sw.Close();
                fs.Close();
            }
        }
        return(_reader);
    }
Пример #45
0
        private void SettingDlg_Load(object sender, EventArgs e)
        {
            m_ContextMenu = new ContextMenu();
            m_ContextMenu.MenuItems.Add(new MenuItem("Abrir", this.OpenDialog));
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingDlg));
            Icon icon = ((System.Drawing.Icon)(resources.GetObject("ctlNotifyIcon.Icon")));

            m_Container              = new Container();
            m_NotifyIcon             = new NotifyIcon(m_Container);
            m_NotifyIcon.Text        = "CCPSD Notificaciones";
            m_NotifyIcon.ContextMenu = m_ContextMenu;
            m_NotifyIcon.Icon        = icon;
            m_NotifyIcon.Visible     = true;
            m_NotifyIcon.ContextMenu = m_ContextMenu;
            m_NotifyIcon.ShowBalloonTip(200
                                        , "ccpsd.notificaciones.service"
                                        , "Servicio para recibir las notificaciones de la camara"
                                        , ToolTipIcon.Info
                                        );

            textBox1.Text = ConfigReader.GetServerUrl().Replace("/Signalr", "");
        }
Пример #46
0
        public secCrawlerData.tblSEC_FormsDataTable GetFormsByFullTextSearchAndFormType(string searchCriteria, string formType, LinkResponseType makeURLClickable, string customURL)
        {
            var table = _adapter.GetDataByFullTextSearchAndFormType(searchCriteria, formType);

            if (makeURLClickable == LinkResponseType.ClickableWithAbsolutePath)
            {
                var basePath = (string)ConfigReader.GetValue("LocalDataStoreWebShare", string.Empty.GetType());
                foreach (var rowF in table)
                {
                    rowF.FormPartialURL = "<A href=\"" + basePath + rowF.FormPartialURL + "\">" + rowF.FormPartialURL + "</A>";
                }
            }
            if (makeURLClickable == LinkResponseType.ClickableWithModifiedLink)
            {
                var basePath = (string)ConfigReader.GetValue("LocalDataStoreWebShare", string.Empty.GetType());
                foreach (var rowF in table)
                {
                    rowF.FormPartialURL = "<A href=\"" + customURL + rowF.FormID.ToString() + "\">" + rowF.FormPartialURL + "</A>";
                }
            }
            if (makeURLClickable == LinkResponseType.NotClickableWithModifiedPath)
            {
                string basePath;
                if (string.IsNullOrEmpty(customURL))
                {
                    basePath = (string)ConfigReader.GetValue("LocalDataStoreWebShare", string.Empty.GetType());
                }
                else
                {
                    basePath = customURL;
                }
                foreach (var rowF in table)
                {
                    rowF.FormPartialURL = basePath + rowF.FormPartialURL;
                }
            }

            return(table);
        }
Пример #47
0
    public static void ConfigurationFileWithInvalidValues_FallsBackToDefaultValues(string configFileName)
    {
        var configuration = new TestAssemblyConfiguration();

        var result = ConfigReader.Load(configuration, AssemblyFileName, Path.Combine(AssemblyPath, configFileName));

        Assert.True(result);
        Assert.False(configuration.DiagnosticMessagesOrDefault);
        Assert.False(configuration.InternalDiagnosticMessagesOrDefault);
        Assert.Equal(Environment.ProcessorCount, configuration.MaxParallelThreadsOrDefault);
        Assert.Equal(TestMethodDisplay.ClassAndMethod, configuration.MethodDisplayOrDefault);
        Assert.Equal(TestMethodDisplayOptions.None, configuration.MethodDisplayOptionsOrDefault);
        // This value was valid as a sentinel to make sure we were trying to read values from the config file
        Assert.True(configuration.ParallelizeAssemblyOrDefault);
        Assert.True(configuration.ParallelizeTestCollectionsOrDefault);
        Assert.Null(configuration.PreEnumerateTheories);

        if (configFileName.EndsWith(".json"))
        {
            Assert.False(configuration.FailSkipsOrDefault);
        }
    }
Пример #48
0
    public static void EmptyConfigurationFile_ReturnsDefaultValues(string configFileName)
    {
        var configuration = new TestAssemblyConfiguration();

        var result = ConfigReader.Load(configuration, AssemblyFileName, Path.Combine(AssemblyPath, configFileName));

        Assert.True(result);
        Assert.Null(configuration.Culture);
        Assert.False(configuration.DiagnosticMessagesOrDefault);
        Assert.False(configuration.InternalDiagnosticMessagesOrDefault);
        Assert.Equal(Environment.ProcessorCount, configuration.MaxParallelThreadsOrDefault);
        Assert.Equal(TestMethodDisplay.ClassAndMethod, configuration.MethodDisplayOrDefault);
        Assert.Equal(TestMethodDisplayOptions.None, configuration.MethodDisplayOptionsOrDefault);
        Assert.False(configuration.ParallelizeAssemblyOrDefault);
        Assert.True(configuration.ParallelizeTestCollectionsOrDefault);
        Assert.Null(configuration.PreEnumerateTheories);

        if (configFileName.EndsWith(".json"))
        {
            Assert.False(configuration.FailSkipsOrDefault);
        }
    }
Пример #49
0
 public void Write(ConfigReader p_reader)
 {
     if (!m_onlyChineseAvailable)
     {
         using (RegistryKey registryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Ubisoft\\Might & Magic X Legacy"))
         {
             registryKey.SetValue("GameLanguageCustom", Language);
         }
     }
     p_reader["language"]["subtitles"].SetValue(SubTitles);
     p_reader["gameplay"]["monsterHPBarVisible"].SetValue(MonsterHPBarsVisible);
     p_reader["gameplay"]["showHints"].SetValue(ShowHints);
     p_reader["gameplay"]["hideMinimapTooltips"].SetValue(HideMinimapTooltips);
     p_reader["gameplay"]["showAlternativeMonsterModel"].SetValue(ShowAlternativeMonsterModel);
     p_reader["gameplay"]["enemyOutlineOpacity"].SetValue(EnemyOutlineOpacity);
     p_reader["gameplay"]["objectOutlineOpacity"].SetValue(ObjectOutlineOpacity);
     p_reader["gameplay"]["showViewport"].SetValue(ShowViewport);
     p_reader["gameplay"]["lockActionBar"].SetValue(LockActionBar);
     p_reader["gameplay"]["monsterMovementSpeed"].SetValue(MonsterMovementSpeed);
     p_reader["gameplay"]["fadeLogs"].SetValue(FadeLogs);
     p_reader["gameplay"]["fadeLogsDelay"].SetValue(FadeLogsDelay);
     p_reader["gameplay"]["isLeftActionBarWithArrows"].SetValue(IsLeftActionBarShowingArrows);
     p_reader["gameplay"]["triggerBarks"].SetValue(TriggerBarks);
     p_reader["gameplay"]["showMessages"].SetValue(ShowGameMessages);
     p_reader["gameplay"]["logOpacity"].SetValue(LogOpacity);
     p_reader["gameplay"]["tooltipOpacity"].SetValue(TooltipOpacity);
     p_reader["gameplay"]["showFloatingDamageMonsters"].SetValue(ShowFloatingDamageMonsters);
     p_reader["gameplay"]["showFloatingDamageChars"].SetValue(ShowFloatingDamageCharacters);
     p_reader["gameplay"]["questLogSize"].SetValue(QuestLogSize);
     p_reader["gameplay"]["actionLogSize"].SetValue(ActionLogSize);
     p_reader["gameplay"]["lockCharacterOrder"].SetValue(LockCharacterOrder);
     p_reader["gameplay"]["tooltipDelay"].SetValue(TooltipDelay);
     p_reader["general"]["videodecoder"].SetEnumValue <EVideoDecoder>(VideoDecoder);
     p_reader["general"]["retroMode"].SetValue(RetroMode);
     p_reader["general"]["retroScreenDivisor"].SetValue(RetroScreenDivisor);
     p_reader["gameplay"]["viewAlignedMinimap"].SetValue(ViewAlignedMinimap);
     p_reader["gameplay"]["minimapGirdOpacity"].SetValue(MinimapGirdOpacity);
     p_reader["gameplay"]["showMinimap"].SetValue(ShowMinimap);
 }
Пример #50
0
        public JsonResult GetCustomerSearchData(CustomerAppointmentSearchModel customerDetailsModel)
        {
            // string apiUrl = (TempData.Peek("ConfigData") as IDictionary<string, string>)?.FirstOrDefault(x => x.Key == Constants.GetScheduledAppointmentsByCustomer).Value;
            string apiUrl = ConfigReader.ReadDatafromConfig(Constants.GetScheduledAppointmentsByCustomer);

            CustomerAppointmentDetailsSearchModel model = null;

            //string apiUrl = "api/CustomerDetails/GetScheduledAppointmentsByCustomer";
            try
            {
                var result = Common.CommonApiClient.CallWebApiServiceAsync(apiUrl, Request.HttpMethod, customerDetailsModel);
                if (!String.IsNullOrEmpty(result.Result))
                {
                    model = JsonConvert.DeserializeObject <CustomerAppointmentDetailsSearchModel>(result.Result);
                }
            }
            catch (Exception ex)
            {
                LogProvider.ErrorFormat("Controller:{0} Error: {1}", "OfficeDetailsController.CustomerAppointmentDetailsSeacrchModel", ex.ToString());
            }
            return(JsonResult(model, JsonRequestBehavior.AllowGet));
        }
Пример #51
0
 public ConnectionString(XmlDocument xmlDoc)
 {
     _reader = new ConfigReader(xmlDoc,
         @"/configuration/connectionStrings/add[@name='{0}']", @"connectionString");
 }
Пример #52
0
 public AppSetting(XmlDocument xmlDoc)
 {
     _reader = new ConfigReader(xmlDoc,
         @"/configuration/appSettings/add[@key='{0}']", @"value");
 }
        /// <summary>
        /// Returns artifact info for packages in a packages.config that match the given set of properties.
        /// </summary>
        /// <param name="configPath">Path to packages.config</param>
        /// <param name="properties">Property values to filter on</param>
        /// <returns>Artifacts matching the property filters.</returns>
        public static IEnumerable<NuGetArtifactInfo> GetArtifactInfo(string configPath, IEnumerable<string> propertyKeys)
        {
            if (configPath == null)
            {
                throw new ArgumentNullException("configPath");
            }

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

            FileInfo file = new FileInfo(configPath);

            if (!file.Exists)
            {
                throw new FileNotFoundException(configPath);
            }

            List<NuGetArtifactInfo> results = new List<NuGetArtifactInfo>();

            using (FileStream stream = file.OpenRead())
            {
                ConfigReader configReader = new ConfigReader(stream);

                foreach (PackageIdentity package in configReader.GetPackages())
                {
                    // TODO: find the real path
                    string packageName = package.Id + "." + package.Version.ToString();
                    FileInfo nupkgPath = new FileInfo(Path.Combine(file.Directory.Parent.FullName, "packages",  packageName, packageName + ".nupkg"));

                    if (!nupkgPath.Exists)
                    {
                        throw new FileNotFoundException(nupkgPath.FullName);
                    }

                    NuGetPackageId id = new NuGetPackageId(package.Id, package.Version, nupkgPath.Directory.FullName);

                    ZipFileSystem zip = new ZipFileSystem(nupkgPath.OpenRead());

                    using (PackageReader packageReader = new PackageReader(zip))
                    {
                        ComponentTree tree = null;

                        // TODO: add a better check for this
                        if (packageReader.GetPackedManifest() == null)
                        {
                            using (LegacyPackageReader legacyReader = new LegacyPackageReader(zip))
                            {
                                throw new NotImplementedException();
                                //var packed = PackedManifestCreator.FromLegacy(legacyReader);
                                //tree = packed.ComponentTree;
                            }
                        }
                        else
                        {
                            tree = packageReader.GetComponentTree();
                        }

                        List<NuGetArtifactGroup> groups = new List<NuGetArtifactGroup>();

                        // TODO: use propertyKeys
                        // TODO: get full paths
                        foreach (var path in tree.GetPaths())
                        {
                            var props = path.Properties.Select(p => (KeyValueTreeProperty)p).Select(p => new KeyValuePair<string, string>(p.Key, p.Value));
                            var items = path.Items.Select(i => (NuGetTreeItem)i).Select(i => new NuGetArtifact(i.Type, i.Data.Where(p => p.Key == "path").Select(p => p.Value).Single()));

                            groups.Add(new NuGetArtifactGroup(props, items));
                        }

                        NuGetArtifactInfo info = new NuGetArtifactInfo(id, groups.ToArray());
                        results.Add(info);
                    }
                }
            }

            return results;
        }
Пример #54
0
        public void FindLogBasePath()
        {
            string appDir = Path.GetDirectoryName(Application.ExecutablePath);
            Dictionary<string, LogBasePathInfo> logPaths = new Dictionary<string, LogBasePathInfo>();

            // Find *.flconfig in appDir
            foreach (string fileName in Directory.GetFiles(appDir, "*.flconfig"))
            {
                // Read the path setting
                var config = new ConfigReader(fileName);
                string basePath = config.ReadPath();
                // If a log file was found in that path, put it on the list
                if (!string.IsNullOrEmpty(basePath))
                {
                    CheckLogBasePath(basePath, logPaths);
                }
            }

            // Find *.exe in appDir
            foreach (string fileName in Directory.GetFiles(appDir, "*.exe"))
            {
                string baseName = Path.GetFileNameWithoutExtension(fileName);
                // Go through all possible default log paths for the exe file
                // If a log file was found in a path, put it on the list
                CheckLogBasePath(Path.Combine(appDir, "log", baseName), logPaths);
                CheckLogBasePath(Path.Combine(appDir, baseName), logPaths);
                CheckLogBasePath(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), baseName + "-log", baseName), logPaths);
                CheckLogBasePath(Path.Combine(Path.GetTempPath(), baseName + "-log", baseName), logPaths);
            }

            if (logPaths.Count == 1)
            {
                SetLogBasePath(logPaths.Values.First().LogBasePath);
            }
            else if (logPaths.Count > 1)
            {
                LogDirsListView.Items.Clear();
                foreach (var kvp in logPaths)
                {
                    AddDirectory(kvp.Value);
                }
                // Sort by latest update time
                logDirsColumnSorter.SortColumn = 1;
                logDirsColumnSorter.Order = SortOrder.Descending;
                logDirsColumnSorter.Update();

                CurrentLabel.Hide();
                SelectedLogDirText.Hide();
                LogDirsListView.Show();
                dirListMode = true;
                UpdateButtons();
            }
        }
Пример #55
0
        private static void JoinRooms()
        {
            var cr = new ConfigReader();

            socvr = chatClient.JoinRoom(cr.GetSetting("room"));

            socvr.EventManager.ConnectListener(EventType.UserMentioned,
                new Action<Message>(m => HandleChatCommand(socvr, m)));

            socvr.EventManager.ConnectListener(EventType.MessageReply,
                new Action<Message, Message>((p, c) => HandleChatCommand(socvr, c)));

            lqphq = chatClient.JoinRoom("http://chat.meta.stackexchange.com/rooms/773");

            lqphq.EventManager.ConnectListener(EventType.UserMentioned,
                new Action<Message>(m => HandleChatCommand(lqphq, m)));

            lqphq.EventManager.ConnectListener(EventType.MessageReply,
                new Action<Message, Message>((p, c) => HandleChatCommand(lqphq, c)));
        }
Пример #56
0
        private static void AuthenticateChatClient()
        {
            var cr = new ConfigReader();

            var email = cr.GetSetting("se email");
            var pwd = cr.GetSetting("se pass");

            chatClient = new Client(email, pwd);
        }
Пример #57
0
        public LoginPlugin()
        {
            if( !IsInstalled() )
            {
                InstallSubdirectory (
                    new Dictionary<string, byte[]> ()
                    {
                        {"settings.cnf", System.Text.ASCIIEncoding.ASCII.GetBytes("Tag:\t\t\t1\nLoginSubject:\t0\nLogoutSubject:\t1\nAddUserSubject:\t2\nLoginSuccessSubject:\t3\nLoginFailedSubject:\t4\nLogoutSuccessSubject:\t5\nAddUserSuccessSubject:\t6\nAddUserFailedSubject:\t7\nAllowAddUser:\tTrue")}
                    }
                );

                DarkRiftServer.database.ExecuteNonQuery (
                    "CREATE TABLE IF NOT EXISTS users(" +
                    "id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, " +
                    "username VARCHAR(50) NOT NULL, " +
                    "password VARCHAR(50) NOT NULL ) "
                );
            }

            //Load settings
            settings = new ConfigReader (GetSubdirectory() + "/settings.cnf");

            if (!byte.TryParse(settings ["Tag"], out tag))
            {
                Interface.LogFatal ("[LoginPlugin] Tag property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["LoginSubject"], out loginSubject))
            {
                Interface.LogFatal ("[LoginPlugin] LoginSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["LogoutSubject"], out logoutSubject))
            {
                Interface.LogFatal ("[LoginPlugin] LogoutSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["AddUserSubject"], out addUserSubject))
            {
                Interface.LogFatal ("[LoginPlugin] AddUserSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["LoginSuccessSubject"], out loginSuccessSubject))
            {
                Interface.LogFatal ("[LoginPlugin] LoginSuccessSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["LoginFailedSubject"], out loginFailedSubject))
            {
                Interface.LogFatal ("[LoginPlugin] LoginFailedSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["LogoutSuccessSubject"], out logoutSuccessSubject))
            {
                Interface.LogFatal ("[LoginPlugin] LogoutSuccessSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["AddUserSuccessSubject"], out addUserSuccessSubject))
            {
                Interface.LogFatal ("[LoginPlugin] AddUserSuccessSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (!ushort.TryParse (settings ["AddUserFailedSubject"], out addUserFailedSubject))
            {
                Interface.LogFatal ("[LoginPlugin] AddUserFailedSubject property could not be resolved from settings.cnf");
                DarkRiftServer.Close(true);
            }
            if (settings ["AllowAddUser"] == "")
            {
                Interface.LogFatal ("[LoginPlugin] AllowAddUser property not found in settings.cnf");
                DarkRiftServer.Close(true);
            }

            debug = settings.IsTrue("Debug");

            ConnectionService.onServerMessage += OnServerMessage;
        }