mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-22 05:25:15 +01:00
Add DMTreeToGlobalsList
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9799169C-0C95-4873-B6B5-211E007A15F4}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DMTreeToGlobalsList</RootNamespace>
|
||||
<AssemblyName>DMTreeToGlobalsList</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace DMTreeToGlobalsList
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length < 1 || !File.Exists(args[0]))
|
||||
{
|
||||
Console.WriteLine("Usage: DMTreeToGlobalsList.exe <path to code tree xml> [Prefix] [Postfix]");
|
||||
return;
|
||||
}
|
||||
|
||||
var XMLPath = args[0];
|
||||
string Prefix = "", Postfix = "";
|
||||
if (args.Length > 1)
|
||||
{
|
||||
Prefix = args[1];
|
||||
if (args.Length > 2)
|
||||
Postfix = args[2];
|
||||
}
|
||||
|
||||
XmlDocument Doc;
|
||||
using (var FS = new FileStream(XMLPath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
try
|
||||
{
|
||||
while (FS.ReadByte() != '<') ;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Failed to find start point of XML in output");
|
||||
return;
|
||||
}
|
||||
FS.Seek(-1, SeekOrigin.Current);
|
||||
|
||||
Doc = new XmlDocument();
|
||||
try
|
||||
{
|
||||
Doc.Load(FS);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Failed to load the XML document");
|
||||
return;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
var DMNode = Doc.ChildNodes[1];
|
||||
foreach (XmlNode Child in DMNode.ChildNodes)
|
||||
if (Child.Name == "var")
|
||||
Console.WriteLine(Prefix + Child.FirstChild.Value.Trim() + Postfix);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("Failed parsing the XML");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user