public void TestProcessCodeConfig() { SettingsService settingsService = new SettingsService(); this.mockSettingsService.SetupGet(x => x.ConfigPath).Returns(settingsService.ConfigPath); Mock <IProjectService> mockProjectService = new Mock <IProjectService>(); mockProjectService.SetupGet(x => x.Name).Returns("Adrian.WindowsPhone"); CodeConfig codeConfig = new CodeConfig { References = new List <string> { "test" } }; MockPathBase mockPathBase = new MockPathBase(); this.mockFileSystem.SetupGet(x => x.Path).Returns(mockPathBase); ////this.mockSettingsService.SetupGet(x => x.UseNugetForPlugins).Returns(false); /*this.service.ProcessCodeConfig(mockProjectService.Object, "SQLite", "source", "destination"); * * mockProjectService.Verify( * x => x.AddReference( * It.IsAny<string>(), * It.IsAny<string>(), * It.IsAny<string>(), * It.IsAny<bool>(), * It.IsAny<bool>()));*/ }
void Init() { //文件路径 this.conflang = MyConfig.GetLanguageFile(this.datapath); //游戏数据,MSE数据 this.datacfg = new DataConfig(MyConfig.GetCardInfoFile(this.datapath)); //初始化YGOUtil的数据 YGOUtil.SetConfig(this.datacfg); //代码提示 string funtxt = MyPath.Combine(this.datapath, MyConfig.FILE_FUNCTION); string conlua = MyPath.Combine(this.datapath, MyConfig.FILE_CONSTANT); string confstring = MyPath.Combine(this.datapath, MyConfig.FILE_STRINGS); this.codecfg = new CodeConfig(); //添加函数 this.codecfg.AddFunction(funtxt); //添加指示物 this.codecfg.AddStrings(confstring); //添加常量 this.codecfg.AddConstant(conlua); this.codecfg.SetNames(this.datacfg.dicSetnames); //生成菜单 this.codecfg.InitAutoMenus(); this.history = new History(this); //读取历史记录 this.history.ReadHistory(MyPath.Combine(this.datapath, MyConfig.FILE_HISTORY)); //加载多语言 LanguageHelper.LoadFormLabels(this.conflang); }
public void CheckStates(CodeConfig config, IEnumerable <string> expected) { var states = config.EnumerateStates().ToList(); states .Select(s => s.State.Values.Format()) .ShouldBe(expected, true); }
public void TestGetBootstrapFileNameIsOveridden() { CodeConfig codeConfig = new CodeConfig { BootstrapFileNameOverride = "OverrideBootstrap.cs" }; string fileName = this.service.GetBootstrapFileName(codeConfig, "friendlyName"); Assert.IsTrue(fileName == "OverrideBootstrap.cs"); }
/// <summary> /// Gets the nuget command. /// </summary> /// <param name="codeConfig">The code config.</param> /// <returns>The nuget command.</returns> public string GetNugetCommand(CodeConfig codeConfig) { TraceService.WriteLine("CodeConfigService::GetNugetCommand"); if (codeConfig != null && string.IsNullOrEmpty(codeConfig.NugetPackage) == false) { return(codeConfig.NugetPackage); } return(string.Empty); }
void Init() { //文件路径 conflang = DEXConfig.GetLanguageFile(datapath); //游戏数据,MSE数据 olddatacfg = datacfg = new DataConfig(DEXConfig.GetCardInfoFile(datapath)); string confstring = MyPath.Combine(datapath, DEXConfig.FILE_STRINGS); if (File.Exists(confstring)) { Dictionary <long, string> d = datacfg.dicSetnames; if (!d.ContainsKey(0)) { d.Add(0L, "Archetype"); } foreach (string l in File.ReadAllLines(confstring)) { if (l.StartsWith("!setname")) { string[] sn = l.Split(new char[] { ' ' }, 3); _ = long.TryParse(sn[1], System.Globalization.NumberStyles.HexNumber, null, out long sc); if (!d.ContainsKey(sc)) { d.Add(sc, sn[2]); } } } } //初始化YGOUtil的数据 YGOUtil.SetConfig(datacfg); //代码提示 string funtxt = MyPath.Combine(datapath, DEXConfig.FILE_FUNCTION); string conlua = MyPath.Combine(datapath, DEXConfig.FILE_CONSTANT); codecfg = new CodeConfig(); //添加函数 codecfg.AddFunction(funtxt); //添加指示物 codecfg.AddStrings(confstring); //添加常量 codecfg.AddConstant(conlua); codecfg.SetNames(datacfg.dicSetnames); //生成菜单 codecfg.InitAutoMenus(); history = new History(this); //读取历史记录 history.ReadHistory(MyPath.Combine(datapath, DEXConfig.FILE_HISTORY)); //加载多语言 LanguageHelper.LoadFormLabels(conflang); }
public override void OnInspectorGUI() { if (me == null) { me = CodeConfig.Me; } if (me == null) { return; } if (GUILayout.Button("Test Date")) { Debug.LogErrorFormat("date:{0}", me.GetDate()); } DrawDefaultInspector(); }
/// <summary> /// Applies the code dependencies. /// </summary> /// <param name="visualStudioService">The visual studio service.</param> /// <param name="codeConfig">The code config.</param> /// <returns>The messages.</returns> public IEnumerable <string> ApplyCodeDependencies( IVisualStudioService visualStudioService, CodeConfig codeConfig) { TraceService.WriteLine("CodeConfigService::ApplyCodeDependencies"); List <string> messages = new List <string>(); //// apply any code dependencies foreach (CodeSnippet codeSnippet in codeConfig.CodeDependencies) { IEnumerable <string> snippetMessages = this.ApplyCodeSnippet(visualStudioService, codeSnippet); messages.AddRange(snippetMessages); } return(messages); }
/// <summary> /// Gets the name of the bootstrap file. /// </summary> /// <param name="codeConfig">The code config.</param> /// <param name="friendlyName">Name of the friendly.</param> /// <returns>The bootstrap file name.</returns> public string GetBootstrapFileName( CodeConfig codeConfig, string friendlyName) { TraceService.WriteLine("CodeConfigService::GetBootstrapFileName name=" + friendlyName); string bootstrapFileName = friendlyName + "PluginBootstrap.cs"; //// the bootstrap file name can be overridden in the code config file. if (codeConfig != null && string.IsNullOrEmpty(codeConfig.BootstrapFileNameOverride) == false) { bootstrapFileName = codeConfig.BootstrapFileNameOverride; TraceService.WriteLine("bootstrapFile has been overidden filename=" + bootstrapFileName); } return(bootstrapFileName); }
/// <summary> /// Gets the project nuget command if we need one. /// </summary> /// <param name="codeConfig">The code config.</param> /// <param name="projectService">The project service.</param> /// <returns>The nuget command if applicable.</returns> public string GetProjectNugetCommand( CodeConfig codeConfig, IProjectService projectService) { TraceService.WriteLine("CodeConfigService::GetProjectNugetCommand"); string command = string.Empty; string nugetCommand = this.GetNugetCommand(codeConfig); if (string.IsNullOrEmpty(nugetCommand) == false) { command = Settings.NugetInstallPackage.Replace("%s", nugetCommand); //// need to add the project to the end of the command! command += string.Format(" {0}", projectService.Name); TraceService.WriteLine("Command=" + command); } return(command); }
public void InitTooltip(CodeConfig codeconfig) { this.tooltipDic = codeconfig.TooltipDic; items = codeconfig.Items; popupMenu.Items.SetAutocompleteItems(items); }
public void CheckCount(CodeConfig config, int expected) { var states = config.EnumerateStates(); states.Count().ShouldBe(expected); }