当前位置: 首页>>代码示例>>C#>>正文


C# ProjectNode.Parse方法代码示例

本文整理汇总了C#中ProjectNode.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# ProjectNode.Parse方法的具体用法?C# ProjectNode.Parse怎么用?C# ProjectNode.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectNode的用法示例。


在下文中一共展示了ProjectNode.Parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: tsmProjectLoad_Click

        private void tsmProjectLoad_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Filter = "Project files (*.bdproj)|*.bdproj";
                dialog.InitialDirectory = Assembly.GetExecutingAssembly().GetWorkingDirectory();

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    _project = new ProjectNode();
                    _project.Parse(dialog.FileName);

                    // build treeview
                    trvList.Nodes["ROOT"].Nodes.Clear();

                    TreeNode tnProject = new TreeNode("Project [ '" + _project.Type + "' ]");
                    tnProject.Tag = _project;
                    tnProject.ForeColor = Color.Gray;
                    foreach (BuildDefinitionNode def in _project.Definitions)
                    {
                        TreeNode tnDefinition = new TreeNode(def.Name);
                        tnDefinition.ToolTipText = def.Description;
                        tnDefinition.Tag = def;
                        tnDefinition.ForeColor = Color.Gray;

                        foreach (BuildConfigurationNode conf in def.Configurations)
                        {
                            TreeNode tnConfiguration = new TreeNode(conf.Name + " [ '" + conf.Configuration + "' ]");
                            tnConfiguration.Tag = conf;

                            tnDefinition.Nodes.Add(tnConfiguration);
                        }

                        tnProject.Nodes.Add(tnDefinition);
                    }

                    trvList.Nodes["ROOT"].Nodes.Add(tnProject);

                    trvList.ExpandAll();
                }
            }
        }
开发者ID:chrishensel,项目名称:ezbuilder-net,代码行数:42,代码来源:MainForm.cs

示例2: Main

        static void Main(string[] args)
        {
            ParseArguments(args);

            bool showUI = string.IsNullOrWhiteSpace(_bdprojFile) && string.IsNullOrWhiteSpace(_configuration);

            if (showUI)
            {
                Application.EnableVisualStyles();
                using (MainForm form = new MainForm())
                {
                    Console.WriteLine("No options were specified. Starting client window...");
                    form.ShowDialog();
                }
            }
            else
            {
                // Duplicate hacked code to build via console
                string bdprojFile = Path.Combine(Assembly.GetExecutingAssembly().GetWorkingDirectory(), _bdprojFile);
                if (!File.Exists(bdprojFile))
                {
                    return;
                }

                Console.WriteLine("Parsing project file from {0}", bdprojFile);

                ProjectNode project = new ProjectNode();
                project.Parse(bdprojFile);
                BuildConfigurationNode configuration = project.Definitions.SelectMany(def => def.Configurations).FirstOrDefault(c => c.Name == _configuration);
                if (configuration == null)
                {
                    Console.WriteLine("Configuration {0} was not found!", _configuration);
                }

                // Setup build process
                ProjectBuildProcess buildProcess = new ProjectBuildProcess();
                BuildStartArgs buildStartArgs = new BuildStartArgs();
                buildStartArgs.ItemsToBuild = null;

                ManualResetEvent wait = new ManualResetEvent(false);

                buildProcess.BuildCompleted += (o) =>
                {
                    foreach (var item in o.Items)
                    {
                        switch (item.Level)
                        {
                            case BuildInfoItemLevel.Trace:
                                continue;
                            case BuildInfoItemLevel.Info:
                                break;
                            case BuildInfoItemLevel.Warning:
                                Console.ForegroundColor = ConsoleColor.Yellow;
                                break;
                            case BuildInfoItemLevel.Error:
                                Console.ForegroundColor = ConsoleColor.Red;
                                break;
                        }

                        Console.WriteLine(item.Text);
                        Console.ResetColor();
                    }
                };
                buildProcess.BuildFinished += (e) =>
                {
                    wait.Set();
                    buildProcess.SaveBuildLog();
                };

                buildProcess.Start(configuration, buildStartArgs);
                wait.WaitOne();
            }
        }
开发者ID:chrishensel,项目名称:ezbuilder-net,代码行数:73,代码来源:Program.cs


注:本文中的ProjectNode.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。