Add DICUI.Check, standalone output parsing tool

This commit is contained in:
Matt Nadareski
2019-02-10 14:47:53 -08:00
parent 8729c7f20c
commit 890959cfe0
7 changed files with 240 additions and 2 deletions

6
DICUI.Check/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{8CFDE289-E171-4D49-A40D-5293265C1253}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DICUI.Check</RootNamespace>
<AssemblyName>DICUI.Check</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</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" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
<Name>DICUI.Library</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

128
DICUI.Check/Program.cs Normal file
View File

@@ -0,0 +1,128 @@
using System;
using System.IO;
using DICUI.Data;
using DICUI.Utilities;
namespace DICUI.Check
{
public class Program
{
public static void Main(string[] args)
{
if (args.Length < 2)
{
DisplayHelp("Invalid number of arguments");
return;
}
// Check for a valid mapped type and/or system
bool valid = MediaTypeFromString(args[0], out MediaType mediaType, out KnownSystem knownSystem);
if (!valid)
{
DisplayHelp($"{args[0]} is not a recognized media type");
return;
}
// Make a new Progress object
var progress = new Progress<Result>();
progress.ProgressChanged += ProgressUpdated;
// Loop through all the rest of the args
for (int i = 1; i < args.Length; i++)
{
// Check for a directory
if (!Directory.Exists(args[i]))
{
DisplayHelp($"{args[i]} is not a directory");
return;
}
// Now populate an environment
var env = new DumpEnvironment
{
OutputDirectory = args[i],
OutputFilename = "",
System = knownSystem,
Type = mediaType,
ScanForProtection = false,
};
env.FixOutputPaths();
// Finally, attempt to do the output dance
var result = env.VerifyAndSaveDumpOutput(progress);
Console.WriteLine(result.Message);
}
}
private static void DisplayHelp(string error = null)
{
if (error != null)
Console.WriteLine(error);
Console.WriteLine("Usage:");
Console.WriteLine("DICUI.Check.exe <mediatype> </path/to/output> ...");
Console.WriteLine();
Console.WriteLine(@"Media Types:\r\n
cd / cdrom - CD-ROM
dvd - DVD-ROM
gd / gdrom - GD-ROM
hddvd - HD-DVD
bd / bluray - BD-ROM
fd / floppy - Floppy Disk
umd - UMD
xbox - XBOX DVD");
}
private static bool MediaTypeFromString(string val, out MediaType type, out KnownSystem system)
{
switch (val.ToLowerInvariant())
{
case "cd":
case "cdrom":
type = MediaType.CDROM;
system = KnownSystem.IBMPCCompatible;
return true;
case "dvd":
type = MediaType.DVD;
system = KnownSystem.IBMPCCompatible;
return true;
case "gd":
case "gdrom":
type = MediaType.GDROM;
system = KnownSystem.SegaDreamcast;
return true;
case "hddvd":
type = MediaType.HDDVD;
system = KnownSystem.HDDVDVideo;
return true;
case "bd":
case "bluray":
type = MediaType.BluRay;
system = KnownSystem.BDVideo;
return true;
case "fd":
case "floppy":
type = MediaType.FloppyDisk;
system = KnownSystem.IBMPCCompatible;
return true;
case "umd":
type = MediaType.UMD;
system = KnownSystem.SonyPlayStationPortable;
return true;
case "xbox":
type = MediaType.DVD;
system = KnownSystem.MicrosoftXBOX;
return true;
default:
type = MediaType.NONE;
system = KnownSystem.NONE;
return false;
}
}
private static void ProgressUpdated(object sender, Result value)
{
Console.WriteLine(value.Message);
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DICUI.Check")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DICUI.Check")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8cfde289-e171-4d49-a40d-5293265c1253")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1709,7 +1709,7 @@ namespace DICUI.Utilities
/// Verify that the current environment has a complete dump and create submission info is possible
/// </summary>
/// <returns>Result instance with the outcome</returns>
private Result VerifyAndSaveDumpOutput(IProgress<Result> progress)
public Result VerifyAndSaveDumpOutput(IProgress<Result> progress)
{
// Check to make sure that the output had all the correct files
if (!FoundAllFiles())

View File

@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Library", "DICUI.Libr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Forms", "DICUI.Forms\DICUI.Forms.csproj", "{A6719A99-BF0E-4637-9A8E-CB38B1E16971}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Check", "DICUI.Check\DICUI.Check.csproj", "{8CFDE289-E171-4D49-A40D-5293265C1253}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Release|Any CPU.Build.0 = Release|Any CPU
{8CFDE289-E171-4D49-A40D-5293265C1253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8CFDE289-E171-4D49-A40D-5293265C1253}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8CFDE289-E171-4D49-A40D-5293265C1253}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8CFDE289-E171-4D49-A40D-5293265C1253}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -42,10 +42,13 @@ after_build:
- mv DICUI.Forms\bin\Debug\subdump_fua_0x28.exe DICUI.Forms\bin\Debug\subdump.exe
- 7z a DICUI.zip DICUI\bin\Debug\*
- 7z a DICUI-Winforms.zip DICUI.Forms\bin\Debug\*
- 7z a DICUI-Check.zip DICUI.Check\bin\Debug\*
# artifact linking
artifacts:
- path: DICUI.zip
name: DICUI
- path: DICUI-Winforms.zip
name: DICUI Winforms
name: DICUI Winforms
- path: DICUI-Check.zip
name: DICUI Check