本文整理汇总了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();
}
}
}
示例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();
}
}