mirror of
https://github.com/mm201/pkmn-classic-framework.git
synced 2026-04-24 23:36:51 -05:00
Added project to insert GenV battle videos into the database.
This commit is contained in:
parent
a8d8c60d7a
commit
a6d7cec291
|
|
@ -64,13 +64,10 @@ namespace bvRestorer4
|
|||
|
||||
int pid = BitConverter.ToInt32(data, 0x08);
|
||||
long serial = BitConverter.ToInt64(data, 0x0c);
|
||||
byte[] header = new byte[0xe4];
|
||||
Array.Copy(data, 0x14, header, 0, 0xe4);
|
||||
byte[] mainData = new byte[0x1c68];
|
||||
Array.Copy(data, 0xf8, mainData, 0, 0x1c68);
|
||||
byte[] mainData = new byte[0x1d4c];
|
||||
Array.Copy(data, 0x14, mainData, 0, 0x1d4c);
|
||||
|
||||
BattleVideoRecord4 record = new BattleVideoRecord4(pid, serial,
|
||||
new BattleVideoHeader4(pid, serial, header), mainData);
|
||||
BattleVideoRecord4 record = new BattleVideoRecord4(pid, serial, mainData);
|
||||
|
||||
DataAbstract.Instance.BattleVideoUpload4(record);
|
||||
|
||||
|
|
|
|||
11
bvRestorer5/App.config
Normal file
11
bvRestorer5/App.config
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
|
||||
</startup>
|
||||
<connectionStrings>
|
||||
<add name="pkmnFoundationsConnectionString"
|
||||
connectionString="Server=10.211.55.2;Database=gts;User ID=gts;Password=gts;Pooling=true;"
|
||||
providerName="MySql.Data.MySqlClient" />
|
||||
</connectionStrings>
|
||||
</configuration>
|
||||
75
bvRestorer5/Program.cs
Normal file
75
bvRestorer5/Program.cs
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PkmnFoundations.Data;
|
||||
using PkmnFoundations.Structures;
|
||||
using PkmnFoundations.Support;
|
||||
|
||||
namespace bvRestorer5
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (args.Length == 0)
|
||||
{
|
||||
Console.WriteLine("Usage: bvRestorer5 <path>");
|
||||
Console.WriteLine("Attempts to insert all the files in path\ninto the database in app configuration.");
|
||||
return;
|
||||
}
|
||||
|
||||
String[] filenames = Directory.GetFiles(args[0]);
|
||||
int successCount = 0;
|
||||
|
||||
foreach (String filename in filenames)
|
||||
{
|
||||
FileStream fs = File.OpenRead(filename);
|
||||
if (fs.Length != 0x18b8)
|
||||
{
|
||||
Console.WriteLine("{0}: file size is wrong, skipped.", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
byte[] data = new byte[0x18b8];
|
||||
fs.ReadBlock(data, 0, 0x18b8);
|
||||
fs.Close();
|
||||
|
||||
int length = BitConverter.ToInt32(data, 0);
|
||||
if (length != 0x18b8)
|
||||
{
|
||||
Console.WriteLine("{0}: size field is wrong, skipped.", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data[4] != 0xf2)
|
||||
{
|
||||
Console.WriteLine("{0}: request type is wrong, skipped.", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (data[5] != 0x55 || data[6] != 0x00 || data[7] != 0x00)
|
||||
{
|
||||
Console.WriteLine("{0}: sanity bytes are wrong, skipped.", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
int pid = BitConverter.ToInt32(data, 0x08);
|
||||
long serial = BitConverter.ToInt64(data, 0x0c);
|
||||
byte[] mainData = new byte[0x18a4];
|
||||
Array.Copy(data, 0x14, mainData, 0, 0x18a4);
|
||||
|
||||
BattleVideoRecord5 record = new BattleVideoRecord5(pid, serial, mainData);
|
||||
|
||||
DataAbstract.Instance.BattleVideoUpload5(record);
|
||||
|
||||
Console.WriteLine("Video {0} added successfully.", BattleVideoHeader4.FormatSerial(serial));
|
||||
successCount++;
|
||||
}
|
||||
Console.WriteLine("{0} battle videos successfully added.", successCount);
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
bvRestorer5/Properties/AssemblyInfo.cs
Normal file
36
bvRestorer5/Properties/AssemblyInfo.cs
Normal 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("bvRestorer5")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("bvRestorer5")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[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("f2709d12-5840-4398-8f25-30c8c8e1bd99")]
|
||||
|
||||
// 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")]
|
||||
67
bvRestorer5/bvRestorer5.csproj
Normal file
67
bvRestorer5/bvRestorer5.csproj
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.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>{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>bvRestorer5</RootNamespace>
|
||||
<AssemblyName>bvRestorer5</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</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.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\library\Library.csproj">
|
||||
<Project>{408efc7e-c6b0-4160-8628-2679e34385ce}</Project>
|
||||
<Name>Library</Name>
|
||||
</ProjectReference>
|
||||
</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>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
VisualStudioVersion = 12.0.30501.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "library\Library.csproj", "{408EFC7E-C6B0-4160-8628-2679E34385CE}"
|
||||
EndProject
|
||||
|
|
@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GlobalTerminalService", "Gl
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bvRestorer4", "bvRestorer4\bvRestorer4.csproj", "{5174CBF0-2A5D-466B-BC32-CE53B9AC4EAF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "bvRestorer5", "bvRestorer5\bvRestorer5.csproj", "{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -121,6 +123,16 @@ Global
|
|||
{5174CBF0-2A5D-466B-BC32-CE53B9AC4EAF}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{5174CBF0-2A5D-466B-BC32-CE53B9AC4EAF}.Release|x86.ActiveCfg = Release|x86
|
||||
{5174CBF0-2A5D-466B-BC32-CE53B9AC4EAF}.Release|x86.Build.0 = Release|x86
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{9F2A0A44-B90E-4B30-8DFF-2B5E273F5BEC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user