Moved maptools to tool/mapmerge. Added midi2piano and AddToChangelog.
BIN
html/AddToChangelog.exe
Normal file
@@ -46,7 +46,6 @@ Header Section
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- <font size='4' color='red'><b>Visit the bleeding-edge test server at <a href="byond://tekkit.fallemmc.com:8000">byond://tekkit.fallemmc.com:8000</a></b></font>--!>
|
||||
|
||||
<!--
|
||||
Changelog Section
|
||||
@@ -56,6 +55,11 @@ Changelog Section
|
||||
Stuff which is in development and not yet visible to players or just code related
|
||||
(ie. code improvements for expandability, etc.) should not be listed here. They
|
||||
should be listed in the changelog upon commit though. Thanks. -->
|
||||
|
||||
<!-- You can simply add changelogs using AddToChangelog.exe -->
|
||||
|
||||
<!-- DO NOT REMOVE, MOVE, OR COPY THIS COMMENT! THIS MUST BE THE LAST NON-EMPTY LINE BEFORE THE LOGS #ADDTOCHANGELOGMARKER# -->
|
||||
|
||||
<div class="commit sansserif">
|
||||
<h2 class="date">August 26th, 2013</h2>
|
||||
<h3 class="author">Giacom updated:</h3>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
java -jar MapPatcher.jar -clean ../maps/tgstation2.dmm.backup ../maps/tgstation2.dmm ../maps/tgstation2.dmm
|
||||
@@ -1,96 +0,0 @@
|
||||
@setlocal enableextensions enabledelayedexpansion
|
||||
@echo off
|
||||
|
||||
set /a count=0
|
||||
for /f "tokens=*" %%A in ('dir /b /a-d "../maps/*.dmm"') do (
|
||||
set /a count+=1
|
||||
set num.!count!=%%A
|
||||
)
|
||||
|
||||
for /f "tokens=2* delims=.=" %%A in ('set num.') do echo %%A = %%B
|
||||
|
||||
:choosemap
|
||||
echo ...
|
||||
set /p prompt="Which map # would you like to clean?: " || set prompt=_None
|
||||
|
||||
if /i "%prompt%"=="exit" (
|
||||
goto :quitmaybe
|
||||
)
|
||||
|
||||
if "%prompt%"=="_None" (
|
||||
goto :prom_error
|
||||
) else set mapnum=%prompt%
|
||||
|
||||
for /f "tokens=2* delims=.=" %%A in ('set num.%mapnum%') do set map=%%B
|
||||
|
||||
if "%map%"=="" (
|
||||
echo That's not a valid map, donklorde.
|
||||
goto :choosemap
|
||||
)
|
||||
|
||||
if not exist "../maps/%map%.backup" (
|
||||
goto :bckup_error
|
||||
)
|
||||
|
||||
goto :printpath
|
||||
|
||||
:prom_error
|
||||
echo You didn't choose anything!
|
||||
goto :choosemap
|
||||
|
||||
:bckup_error
|
||||
echo ...
|
||||
echo WARNING: A .backup does not exist for %map% !
|
||||
echo ...
|
||||
goto :choosemap
|
||||
|
||||
|
||||
:printpath
|
||||
echo ...
|
||||
echo =============
|
||||
echo Map filepath (This should NOT be the .backup):
|
||||
echo:../maps/%map%
|
||||
echo =============
|
||||
goto :finalize
|
||||
|
||||
|
||||
:finalize
|
||||
echo ...
|
||||
set /p finalize="Is this filepath correct?: " || set finalize=None
|
||||
if "%finalize%"=="None" (goto :fin_error)
|
||||
if /i "%finalize%"=="y" (goto :java)
|
||||
if /i "%finalize%"=="yes" (goto :java)
|
||||
if /i "%finalize%"=="n" (goto :quitmaybe)
|
||||
if /i "%finalize%"=="no" (goto :quitmaybe)
|
||||
goto :fin_error
|
||||
|
||||
:fin_error
|
||||
echo ...
|
||||
echo That wasn't a valid response you donk!
|
||||
echo Valid responses: y, n, yes, no
|
||||
goto :finalize
|
||||
|
||||
:java
|
||||
echo Starting MapPatcher...
|
||||
java -jar MapPatcher.jar -clean ../maps/%map%.backup ../maps/%map% ../maps/%map%
|
||||
goto :exit
|
||||
|
||||
:quitmaybe
|
||||
echo ...
|
||||
set /p exitmaybe="Exit the program?: " || set exitmaybe=_NothingChosen
|
||||
if "%exitmaybe%"=="_NothingChosen" (goto :qm_error)
|
||||
if /i "%exitmaybe%"=="y" (goto :exit)
|
||||
if /i "%exitmaybe%"=="yes" (goto :exit)
|
||||
if /i "%exitmaybe%"=="n" (goto :choosemap)
|
||||
if /i "%exitmaybe%"=="no" (goto :choosemap)
|
||||
goto :qm_error
|
||||
|
||||
:qm_error
|
||||
echo ...
|
||||
echo That wasn't a valid response, or you didn't choose anything!
|
||||
echo Valid responses: y, n, yes, no
|
||||
goto :quitmaybe
|
||||
|
||||
:exit
|
||||
pause
|
||||
exit
|
||||
@@ -1,73 +0,0 @@
|
||||
@setlocal enableextensions enabledelayedexpansion
|
||||
@echo off
|
||||
|
||||
set /a count=0
|
||||
for /f "tokens=*" %%A in ('dir /b /a-d "../maps/*.dmm"') do (
|
||||
set /a count+=1
|
||||
set num.!count!=%%A
|
||||
)
|
||||
|
||||
for /f "tokens=2* delims=.=" %%A in ('set num.') do echo %%A = %%B
|
||||
|
||||
:choosemap
|
||||
echo ...
|
||||
set /p prompt="Which map # would you like to back up?: " || set prompt=_None
|
||||
|
||||
if /i "%prompt%"=="exit" (
|
||||
goto :quitmaybe
|
||||
)
|
||||
|
||||
if "%prompt%"=="_None" (
|
||||
goto :prom_error
|
||||
) else set mapnum=%prompt%
|
||||
|
||||
for /f "tokens=2* delims=.=" %%A in ('set num.%mapnum%') do set map=%%B
|
||||
|
||||
if "%map%"=="" (
|
||||
echo That's not a valid map, donklorde.
|
||||
goto :choosemap
|
||||
)
|
||||
|
||||
goto :printpath
|
||||
|
||||
:prom_error
|
||||
echo You didn't choose anything!
|
||||
goto :choosemap
|
||||
|
||||
:printpath
|
||||
echo ...
|
||||
echo =============
|
||||
echo Backing up:
|
||||
echo:../maps/%map%
|
||||
echo Into:
|
||||
echo:../maps/%map%.backup
|
||||
echo =============
|
||||
goto :copymap
|
||||
|
||||
:copymap
|
||||
echo Copying...
|
||||
cd ../maps
|
||||
copy %map% %map%.backup
|
||||
echo Done.
|
||||
goto :exit
|
||||
|
||||
:quitmaybe
|
||||
echo ...
|
||||
set /p exitmaybe="Exit the program?: " || set exitmaybe=_NothingChosen
|
||||
if "%exitmaybe%"=="_NothingChosen" (goto :qm_error)
|
||||
if /i "%exitmaybe%"=="y" (goto :exit)
|
||||
if /i "%exitmaybe%"=="yes" (goto :exit)
|
||||
if /i "%exitmaybe%"=="n" (goto :choosemap)
|
||||
if /i "%exitmaybe%"=="no" (goto :choosemap)
|
||||
goto :qm_error
|
||||
|
||||
:qm_error
|
||||
echo ...
|
||||
echo That wasn't a valid response, or you didn't choose anything!
|
||||
echo Valid responses: y, n, yes, no
|
||||
goto :quitmaybe
|
||||
|
||||
:exit
|
||||
pause
|
||||
exit
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
cd ../maps
|
||||
copy tgstation2.dmm tgstation2.dmm.backup
|
||||
20
tools/AddToChangelog/AddToChangelog.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C# Express 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddToChangelog", "AddToChangelog\AddToChangelog.csproj", "{838EA2DE-A108-4213-8409-7F562F1009BE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{838EA2DE-A108-4213-8409-7F562F1009BE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{838EA2DE-A108-4213-8409-7F562F1009BE}.Debug|x86.Build.0 = Debug|x86
|
||||
{838EA2DE-A108-4213-8409-7F562F1009BE}.Release|x86.ActiveCfg = Release|x86
|
||||
{838EA2DE-A108-4213-8409-7F562F1009BE}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
140
tools/AddToChangelog/AddToChangelog/AddToChangelog.csproj
Normal file
@@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{838EA2DE-A108-4213-8409-7F562F1009BE}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AddToChangelog</RootNamespace>
|
||||
<AssemblyName>AddToChangelog</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<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|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>changelog.ico</ApplicationIcon>
|
||||
</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.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="bugfix.png" />
|
||||
<EmbeddedResource Include="experiment.png" />
|
||||
<Content Include="changelog.ico" />
|
||||
<EmbeddedResource Include="rscdel.png" />
|
||||
<EmbeddedResource Include="wip.png" />
|
||||
<EmbeddedResource Include="imagedel.png" />
|
||||
<EmbeddedResource Include="imageadd.png" />
|
||||
<EmbeddedResource Include="sounddel.png" />
|
||||
<EmbeddedResource Include="soundadd.png" />
|
||||
<EmbeddedResource Include="rscadd.png" />
|
||||
<EmbeddedResource Include="tweak.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</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>
|
||||
263
tools/AddToChangelog/AddToChangelog/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,263 @@
|
||||
namespace AddToChangelog
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.authorBox = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.dateBox = new System.Windows.Forms.MaskedTextBox();
|
||||
this.dropdownBox = new System.Windows.Forms.ComboBox();
|
||||
this.getButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.resultsBox = new System.Windows.Forms.TextBox();
|
||||
this.addLineButton = new System.Windows.Forms.Button();
|
||||
this.addLineBox = new System.Windows.Forms.TextBox();
|
||||
this.listBox = new System.Windows.Forms.TextBox();
|
||||
this.saveButton = new System.Windows.Forms.Button();
|
||||
this.editBox = new System.Windows.Forms.TextBox();
|
||||
this.reloadButton = new System.Windows.Forms.Button();
|
||||
this.pictureBox = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(20, 46);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(33, 13);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "Date:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(20, 21);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(41, 13);
|
||||
this.label2.TabIndex = 11;
|
||||
this.label2.Text = "Author:";
|
||||
//
|
||||
// authorBox
|
||||
//
|
||||
this.authorBox.Location = new System.Drawing.Point(67, 18);
|
||||
this.authorBox.Name = "authorBox";
|
||||
this.authorBox.Size = new System.Drawing.Size(154, 20);
|
||||
this.authorBox.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(330, 21);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(68, 13);
|
||||
this.label3.TabIndex = 12;
|
||||
this.label3.Text = "Add change:";
|
||||
//
|
||||
// dateBox
|
||||
//
|
||||
this.dateBox.Location = new System.Drawing.Point(67, 43);
|
||||
this.dateBox.Mask = "00/00/0000";
|
||||
this.dateBox.Name = "dateBox";
|
||||
this.dateBox.Size = new System.Drawing.Size(79, 20);
|
||||
this.dateBox.TabIndex = 2;
|
||||
this.dateBox.ValidatingType = typeof(System.DateTime);
|
||||
//
|
||||
// dropdownBox
|
||||
//
|
||||
this.dropdownBox.DisplayMember = "\"";
|
||||
this.dropdownBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.dropdownBox.FormattingEnabled = true;
|
||||
this.dropdownBox.Items.AddRange(new object[] {
|
||||
"Added feature",
|
||||
"Removed feature",
|
||||
"Bugfix",
|
||||
"Work in progress",
|
||||
"Tweak",
|
||||
"Experimental feature",
|
||||
"Added icon",
|
||||
"Removed icon",
|
||||
"Added sound",
|
||||
"Removed sound"});
|
||||
this.dropdownBox.Location = new System.Drawing.Point(856, 17);
|
||||
this.dropdownBox.MaxDropDownItems = 10;
|
||||
this.dropdownBox.Name = "dropdownBox";
|
||||
this.dropdownBox.Size = new System.Drawing.Size(121, 21);
|
||||
this.dropdownBox.TabIndex = 7;
|
||||
this.dropdownBox.SelectedIndexChanged += new System.EventHandler(this.dropdownBox_SelectedIndexChanged);
|
||||
//
|
||||
// getButton
|
||||
//
|
||||
this.getButton.Location = new System.Drawing.Point(17, 70);
|
||||
this.getButton.Name = "getButton";
|
||||
this.getButton.Size = new System.Drawing.Size(69, 21);
|
||||
this.getButton.TabIndex = 3;
|
||||
this.getButton.Text = "Get HTML";
|
||||
this.getButton.UseVisualStyleBackColor = true;
|
||||
this.getButton.Click += new System.EventHandler(this.getButton_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.Location = new System.Drawing.Point(92, 70);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(69, 21);
|
||||
this.addButton.TabIndex = 4;
|
||||
this.addButton.Text = "Lazy Add";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addButton_Click);
|
||||
//
|
||||
// resultsBox
|
||||
//
|
||||
this.resultsBox.Location = new System.Drawing.Point(11, 101);
|
||||
this.resultsBox.Multiline = true;
|
||||
this.resultsBox.Name = "resultsBox";
|
||||
this.resultsBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.resultsBox.Size = new System.Drawing.Size(318, 356);
|
||||
this.resultsBox.TabIndex = 10;
|
||||
//
|
||||
// addLineButton
|
||||
//
|
||||
this.addLineButton.Location = new System.Drawing.Point(983, 17);
|
||||
this.addLineButton.Name = "addLineButton";
|
||||
this.addLineButton.Size = new System.Drawing.Size(21, 21);
|
||||
this.addLineButton.TabIndex = 8;
|
||||
this.addLineButton.Text = "+";
|
||||
this.addLineButton.UseVisualStyleBackColor = true;
|
||||
this.addLineButton.Click += new System.EventHandler(this.addLineButton_Click);
|
||||
//
|
||||
// addLineBox
|
||||
//
|
||||
this.addLineBox.Location = new System.Drawing.Point(404, 18);
|
||||
this.addLineBox.Name = "addLineBox";
|
||||
this.addLineBox.Size = new System.Drawing.Size(415, 20);
|
||||
this.addLineBox.TabIndex = 6;
|
||||
//
|
||||
// listBox
|
||||
//
|
||||
this.listBox.Location = new System.Drawing.Point(335, 46);
|
||||
this.listBox.Multiline = true;
|
||||
this.listBox.Name = "listBox";
|
||||
this.listBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.listBox.Size = new System.Drawing.Size(669, 49);
|
||||
this.listBox.TabIndex = 9;
|
||||
//
|
||||
// saveButton
|
||||
//
|
||||
this.saveButton.Location = new System.Drawing.Point(260, 70);
|
||||
this.saveButton.Name = "saveButton";
|
||||
this.saveButton.Size = new System.Drawing.Size(69, 21);
|
||||
this.saveButton.TabIndex = 5;
|
||||
this.saveButton.Text = "Save";
|
||||
this.saveButton.UseVisualStyleBackColor = true;
|
||||
this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
|
||||
//
|
||||
// editBox
|
||||
//
|
||||
this.editBox.Location = new System.Drawing.Point(335, 101);
|
||||
this.editBox.MaxLength = 9999999;
|
||||
this.editBox.Multiline = true;
|
||||
this.editBox.Name = "editBox";
|
||||
this.editBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.editBox.Size = new System.Drawing.Size(669, 356);
|
||||
this.editBox.TabIndex = 13;
|
||||
//
|
||||
// reloadButton
|
||||
//
|
||||
this.reloadButton.Location = new System.Drawing.Point(185, 70);
|
||||
this.reloadButton.Name = "reloadButton";
|
||||
this.reloadButton.Size = new System.Drawing.Size(69, 21);
|
||||
this.reloadButton.TabIndex = 14;
|
||||
this.reloadButton.Text = "Reload";
|
||||
this.reloadButton.UseVisualStyleBackColor = true;
|
||||
this.reloadButton.Click += new System.EventHandler(this.reloadButton_Click);
|
||||
//
|
||||
// pictureBox
|
||||
//
|
||||
this.pictureBox.Location = new System.Drawing.Point(834, 20);
|
||||
this.pictureBox.Name = "pictureBox";
|
||||
this.pictureBox.Size = new System.Drawing.Size(16, 16);
|
||||
this.pictureBox.TabIndex = 15;
|
||||
this.pictureBox.TabStop = false;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.ClientSize = new System.Drawing.Size(1016, 469);
|
||||
this.Controls.Add(this.pictureBox);
|
||||
this.Controls.Add(this.reloadButton);
|
||||
this.Controls.Add(this.editBox);
|
||||
this.Controls.Add(this.saveButton);
|
||||
this.Controls.Add(this.listBox);
|
||||
this.Controls.Add(this.addLineBox);
|
||||
this.Controls.Add(this.addLineButton);
|
||||
this.Controls.Add(this.resultsBox);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.getButton);
|
||||
this.Controls.Add(this.dropdownBox);
|
||||
this.Controls.Add(this.dateBox);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.authorBox);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "MainForm";
|
||||
this.Text = "Add To Changelog";
|
||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||
this.Shown += new System.EventHandler(this.MainForm_Shown);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox authorBox;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.MaskedTextBox dateBox;
|
||||
private System.Windows.Forms.ComboBox dropdownBox;
|
||||
private System.Windows.Forms.Button getButton;
|
||||
private System.Windows.Forms.Button addButton;
|
||||
private System.Windows.Forms.TextBox resultsBox;
|
||||
private System.Windows.Forms.Button addLineButton;
|
||||
private System.Windows.Forms.TextBox addLineBox;
|
||||
private System.Windows.Forms.TextBox listBox;
|
||||
private System.Windows.Forms.Button saveButton;
|
||||
private System.Windows.Forms.TextBox editBox;
|
||||
private System.Windows.Forms.Button reloadButton;
|
||||
private System.Windows.Forms.PictureBox pictureBox;
|
||||
}
|
||||
}
|
||||
|
||||
268
tools/AddToChangelog/AddToChangelog/Form1.cs
Normal file
@@ -0,0 +1,268 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace AddToChangelog
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
|
||||
public string changelogPath = "changelog.html";
|
||||
public string changelogMarker = "#ADDTOCHANGELOGMARKER#";
|
||||
public string longDateFormat = "d MMMM yyyy";
|
||||
public string shortDateFormat = "ddMMyyyy";
|
||||
|
||||
public Dictionary<string, string> ItemList = new Dictionary<string, string>()
|
||||
{
|
||||
{ "Added feature", "rscadd" },
|
||||
{ "Removed feature", "rscdel" },
|
||||
{ "Bugfix", "bugfix" },
|
||||
{ "Work in progress", "wip" },
|
||||
{ "Tweak", "tweak" },
|
||||
{ "Experimental feature", "experiment" },
|
||||
{ "Added icon", "imageadd" },
|
||||
{ "Removed icon", "imagedel" },
|
||||
{ "Added sound", "soundadd" },
|
||||
{ "Removed sound", "sounddel" }
|
||||
};
|
||||
|
||||
public Dictionary<string, Bitmap> ImageList = new Dictionary<string, Bitmap>();
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.dropdownBox.SelectedIndex = 0;
|
||||
this.dateBox.Text = DateTime.Now.ToString(shortDateFormat);
|
||||
this.listBox.Text = "# Enter your logs in the text box above and it'll be parsed into here. You can use 'Get HTML' to format it for the changelog. You can also use Lazy Add to automatically add the logs to the changelog, no effort needed (just remember to save)! Below is the changelog, you can edit and save it from here to easily fix mistakes. Save will save the changelog below, reload will undo any unsaved changes.";
|
||||
}
|
||||
|
||||
public void SaveChangelog()
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo);
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.WriteAllText(changelogPath, editBox.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Could not find '" + changelogPath + "'. Please place me on the same folder as " + changelogPath + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ScrollToMarker()
|
||||
{
|
||||
int selection = editBox.Text.IndexOf(changelogMarker);
|
||||
if (selection > 0)
|
||||
{
|
||||
// Hacky way to scroll the edit text box to the beginning of the changelog entries
|
||||
this.ActiveControl = editBox;
|
||||
this.Refresh();
|
||||
editBox.SelectionStart = editBox.Text.Length - 1;
|
||||
editBox.SelectionLength = 0;
|
||||
editBox.ScrollToCaret();
|
||||
editBox.SelectionStart = selection - 2;
|
||||
editBox.ScrollToCaret();
|
||||
}
|
||||
}
|
||||
|
||||
// Load up the changelog
|
||||
|
||||
public void ReadChangelog()
|
||||
{
|
||||
try
|
||||
{
|
||||
string changelog = File.ReadAllText(changelogPath);
|
||||
editBox.Text = changelog;
|
||||
ScrollToMarker();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show("Could not find '" + changelogPath + "'. Please place me on the same folder as " + changelogPath + "." + e);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the log notes
|
||||
|
||||
public string GetHTMLLines()
|
||||
{
|
||||
StringReader stringReader = new StringReader(listBox.Text);
|
||||
string html = "";
|
||||
string aLine = "";
|
||||
|
||||
do
|
||||
{
|
||||
aLine = stringReader.ReadLine();
|
||||
if (aLine != null)
|
||||
{
|
||||
// remove < and >
|
||||
if (aLine.StartsWith("<") && aLine.Contains(">"))
|
||||
{
|
||||
string tag = aLine.Substring(1, aLine.IndexOf(">") - 1); // extract the tag
|
||||
aLine = aLine.Substring(aLine.IndexOf(">") + 1); // now remove the tag from the line
|
||||
aLine = "\t\t<li class='" + tag + "'>" + aLine + "</li>\r\n"; // give html
|
||||
}
|
||||
else
|
||||
{
|
||||
aLine = "\t\t<li class='rscadd'>" + aLine + "</li>\r\n";
|
||||
}
|
||||
|
||||
html += aLine;
|
||||
}
|
||||
|
||||
} while (aLine != null);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
private void addLineButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (addLineBox.Text == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string textAdd = this.addLineBox.Text;
|
||||
string listItem = this.dropdownBox.SelectedItem.ToString();
|
||||
string itemClass = ItemList[listItem];
|
||||
|
||||
if (itemClass == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (listBox.Text.StartsWith("#"))
|
||||
{
|
||||
listBox.Text = "";
|
||||
}
|
||||
|
||||
listBox.Text += "<" + itemClass + ">" + textAdd + "\r\n";
|
||||
addLineBox.Text = "";
|
||||
|
||||
}
|
||||
|
||||
private void getButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (listBox.Text != "")
|
||||
{
|
||||
DateTime dateTime;
|
||||
if (!DateTime.TryParse(dateBox.Text, out dateTime))
|
||||
{
|
||||
MessageBox.Show("Invalid date time.");
|
||||
return;
|
||||
}
|
||||
|
||||
resultsBox.Text = "<div class='commit sansserif'>\r\n";
|
||||
resultsBox.Text += "\t<h2 class='date'>" + dateTime.ToString(longDateFormat) + "</h2>\r\n";
|
||||
resultsBox.Text += "\t<h3 class='author'>" + authorBox.Text + " updated:</h3>\r\n";
|
||||
resultsBox.Text += "\t<ul class='changes bgimages16'>\r\n";
|
||||
resultsBox.Text += GetHTMLLines();
|
||||
resultsBox.Text += "\t</ul>\r\n";
|
||||
resultsBox.Text += "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
// Automatically add to changelog
|
||||
|
||||
private void addButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (resultsBox.Text == "")
|
||||
{
|
||||
getButton_Click(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
if (resultsBox.Text == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string html = resultsBox.Text;
|
||||
|
||||
string[] changelogFile = null;
|
||||
|
||||
changelogFile = editBox.Text.Split('\n');
|
||||
|
||||
if (changelogFile != null)
|
||||
{
|
||||
bool foundMarker = false;
|
||||
for (int i = 0; i < changelogFile.Length; i++)
|
||||
{
|
||||
if (foundMarker == false)
|
||||
{
|
||||
string line = changelogFile[i];
|
||||
if (line.Contains(changelogMarker))
|
||||
{
|
||||
line += "\r\n\r\n";
|
||||
line += resultsBox.Text;
|
||||
line += "\r\n";
|
||||
changelogFile[i] = line;
|
||||
foundMarker = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundMarker == false)
|
||||
{
|
||||
MessageBox.Show("Could not find '#ADDTOCHANGELOGMARKER#' in '" + changelogPath + "'. Please place one above where the changelog entries start, inside a comment.");
|
||||
}
|
||||
else
|
||||
{
|
||||
editBox.Text = String.Join("\n", changelogFile);
|
||||
ScrollToMarker();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveChangelog();
|
||||
}
|
||||
|
||||
private void reloadButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ReadChangelog();
|
||||
}
|
||||
|
||||
private void MainForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
ReadChangelog();
|
||||
}
|
||||
|
||||
private void dropdownBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Change the image to reflect the drop down box selection
|
||||
if (ImageList.Count > 0)
|
||||
{
|
||||
string value = ItemList[dropdownBox.SelectedItem.ToString()];
|
||||
pictureBox.Image = ImageList[value];
|
||||
}
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
// Get our embedded images. Use our dictionaries to help.
|
||||
foreach (string value in ItemList.Values)
|
||||
{
|
||||
Assembly myAssembly = Assembly.GetExecutingAssembly();
|
||||
Stream myStream = myAssembly.GetManifestResourceStream("AddToChangelog." + value + ".png");
|
||||
Bitmap image = new Bitmap(myStream);
|
||||
|
||||
ImageList.Add(value, image);
|
||||
}
|
||||
|
||||
pictureBox.Image = ImageList["rscadd"];
|
||||
}
|
||||
}
|
||||
}
|
||||
1906
tools/AddToChangelog/AddToChangelog/Form1.resx
Normal file
21
tools/AddToChangelog/AddToChangelog/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AddToChangelog
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("AddToChangelog")]
|
||||
[assembly: AssemblyDescription("An open source application designed to allow the /tg/station open source project to easily add changelog notes to the changelog.html file.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Nanotrasen")]
|
||||
[assembly: AssemblyProduct("AddToChangelog")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[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("3f069aeb-901f-4fc0-8104-29da028252dc")]
|
||||
|
||||
// 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")]
|
||||
71
tools/AddToChangelog/AddToChangelog/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,71 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.296
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddToChangelog.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AddToChangelog.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
tools/AddToChangelog/AddToChangelog/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
30
tools/AddToChangelog/AddToChangelog/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.296
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace AddToChangelog.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
BIN
tools/AddToChangelog/AddToChangelog/bugfix.png
Normal file
|
After Width: | Height: | Size: 657 B |
BIN
tools/AddToChangelog/AddToChangelog/changelog.ico
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
tools/AddToChangelog/AddToChangelog/experiment.png
Normal file
|
After Width: | Height: | Size: 727 B |
BIN
tools/AddToChangelog/AddToChangelog/imageadd.png
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
tools/AddToChangelog/AddToChangelog/imagedel.png
Normal file
|
After Width: | Height: | Size: 535 B |
BIN
tools/AddToChangelog/AddToChangelog/rscadd.png
Normal file
|
After Width: | Height: | Size: 660 B |
BIN
tools/AddToChangelog/AddToChangelog/rscdel.png
Normal file
|
After Width: | Height: | Size: 651 B |
BIN
tools/AddToChangelog/AddToChangelog/soundadd.png
Normal file
|
After Width: | Height: | Size: 462 B |
BIN
tools/AddToChangelog/AddToChangelog/sounddel.png
Normal file
|
After Width: | Height: | Size: 403 B |
BIN
tools/AddToChangelog/AddToChangelog/tweak.png
Normal file
|
After Width: | Height: | Size: 684 B |
BIN
tools/AddToChangelog/AddToChangelog/wip.png
Normal file
|
After Width: | Height: | Size: 678 B |
BIN
tools/AddToChangelog/icon.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
5
tools/mapmerge/clean_map.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
set MAPFILE=tgstation2.dmm
|
||||
|
||||
java -jar MapPatcher.jar -clean ../../maps/%MAPFILE%.backup ../../maps/%MAPFILE% ../../maps/%MAPFILE%
|
||||
|
||||
pause
|
||||
17
tools/mapmerge/install.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
1. Install java(http://www.java.com/en/download/index.jsp)
|
||||
2. Make sure java is in your PATH. To test this, open git bash, and type "java". If it says unknown command, you need to add JAVA/bin to your PATH variable.
|
||||
|
||||
Committing
|
||||
1. Before starting to edit the map, double-click "prepare_map.bat" in the tools/mapmerge/ directory.
|
||||
2. After finishing your edit, and before your commit, double-click "clean_map.bat" in the tools/mapmerge/ directory.
|
||||
|
||||
This will make sure in the new version of your map, no paths are needlessly changed, thus instead of 8000 lines changed you'll get 50 lines changed. This not only reduces size of your commit, it also makes it possible to get an overview of your map changes on the "files changed" page in your pull request.
|
||||
|
||||
Merging
|
||||
The easiest way to do merging is to install the merge driver. For this, open -tg-station/.git/config in a text editor, and paste the following lines to the end of it:
|
||||
|
||||
[merge "merge-dmm"]
|
||||
name = mapmerge driver
|
||||
driver = ./tools/mapmerge/mapmerge.sh %O %A %B
|
||||
|
||||
After this, merging maps should happen automagically unless there are conflicts(a tile that both you and someone else changed). If there are conflicts, you will unfortunately still be stuck with opening both versions in a map editor, and manually resolving the issues.
|
||||
4
maptools/mapmerge.sh → tools/mapmerge/mapmerge.sh
Executable file → Normal file
@@ -1,9 +1,9 @@
|
||||
java -jar maptools/MapPatcher.jar -merge $1 $2 $3 $2
|
||||
java -jar tools/mapmerge/MapPatcher.jar -merge $1 $2 $3 $2
|
||||
if [ "$?" -gt 0 ]
|
||||
then
|
||||
echo "Unable to automatically resolve map conflicts, please merge manually."
|
||||
exit 1
|
||||
fi
|
||||
java -jar maptools/MapPatcher.jar -clean $1 $2 $2
|
||||
java -jar tools/mapmerge/MapPatcher.jar -clean $1 $2 $2
|
||||
|
||||
exit 0
|
||||
6
tools/mapmerge/prepare_map.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
set MAPFILE=tgstation2.dmm
|
||||
|
||||
cd ../../maps
|
||||
copy %MAPFILE% %MAPFILE%.backup
|
||||
|
||||
pause
|
||||
30
tools/midi2piano/midi2piano.sln
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C# Express 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "midi2piano", "midi2piano\midi2piano.csproj", "{68C84B61-F710-491C-BEE8-5E362C167897}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|Mixed Platforms = Debug|Mixed Platforms
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|Mixed Platforms = Release|Mixed Platforms
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Debug|x86.Build.0 = Debug|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Release|x86.ActiveCfg = Release|x86
|
||||
{68C84B61-F710-491C-BEE8-5E362C167897}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
135
tools/midi2piano/midi2piano/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,135 @@
|
||||
namespace midi2piano
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.OutputTxt = new System.Windows.Forms.TextBox();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.importMIDIToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.importDlg = new System.Windows.Forms.OpenFileDialog();
|
||||
this.halpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// OutputTxt
|
||||
//
|
||||
this.OutputTxt.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.OutputTxt.Location = new System.Drawing.Point(0, 24);
|
||||
this.OutputTxt.Multiline = true;
|
||||
this.OutputTxt.Name = "OutputTxt";
|
||||
this.OutputTxt.ReadOnly = true;
|
||||
this.OutputTxt.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||
this.OutputTxt.Size = new System.Drawing.Size(284, 240);
|
||||
this.OutputTxt.TabIndex = 0;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.copyToolStripMenuItem,
|
||||
this.halpToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(284, 24);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.importMIDIToolStripMenuItem,
|
||||
this.exitToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "&File";
|
||||
//
|
||||
// importMIDIToolStripMenuItem
|
||||
//
|
||||
this.importMIDIToolStripMenuItem.Name = "importMIDIToolStripMenuItem";
|
||||
this.importMIDIToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
|
||||
this.importMIDIToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
|
||||
this.importMIDIToolStripMenuItem.Text = "&Import MIDI...";
|
||||
this.importMIDIToolStripMenuItem.Click += new System.EventHandler(this.importMIDIToolStripMenuItem_Click);
|
||||
//
|
||||
// exitToolStripMenuItem
|
||||
//
|
||||
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
|
||||
this.exitToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
|
||||
this.exitToolStripMenuItem.Text = "E&xit";
|
||||
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
|
||||
//
|
||||
// copyToolStripMenuItem
|
||||
//
|
||||
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||
this.copyToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
|
||||
this.copyToolStripMenuItem.Text = "&Copy";
|
||||
this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
|
||||
//
|
||||
// importDlg
|
||||
//
|
||||
this.importDlg.Filter = "MIDI File|*.midi;*.mid";
|
||||
//
|
||||
// halpToolStripMenuItem
|
||||
//
|
||||
this.halpToolStripMenuItem.Name = "halpToolStripMenuItem";
|
||||
this.halpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.halpToolStripMenuItem.Text = "&Halp";
|
||||
this.halpToolStripMenuItem.Click += new System.EventHandler(this.halpToolStripMenuItem_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(284, 264);
|
||||
this.Controls.Add(this.OutputTxt);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Name = "Form1";
|
||||
this.Text = "MIDI2Piano";
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox OutputTxt;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem importMIDIToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
|
||||
private System.Windows.Forms.OpenFileDialog importDlg;
|
||||
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem halpToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
298
tools/midi2piano/midi2piano/Form1.cs
Normal file
@@ -0,0 +1,298 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Sanford.Multimedia;
|
||||
using Sanford.Multimedia.Midi;
|
||||
|
||||
namespace midi2piano
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
[STAThread]
|
||||
public static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
struct PNote
|
||||
{
|
||||
public float Length;
|
||||
public string Note;
|
||||
|
||||
public PNote(float length, string note)
|
||||
{
|
||||
Length = length;
|
||||
Note = note;
|
||||
}
|
||||
|
||||
public static readonly PNote Default = new PNote(0, "");
|
||||
}
|
||||
|
||||
private void importMIDIToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (importDlg.ShowDialog(this)
|
||||
== System.Windows.Forms.DialogResult.Cancel)
|
||||
return;
|
||||
|
||||
List<PNote> notes = new List<PNote>();
|
||||
PNote curNote = PNote.Default;
|
||||
float tempo = 1;
|
||||
float timeSig = 4f;
|
||||
|
||||
// first, we pull midi data
|
||||
Sequence s = new Sequence(importDlg.FileName);
|
||||
|
||||
// quickly see if there's a piano track first
|
||||
// and get the tempo as well
|
||||
int piano = -1;
|
||||
for (int it = 0; it < s.Count; it++)
|
||||
{
|
||||
Track t = s[it];
|
||||
foreach (MidiEvent me in t.Iterator())
|
||||
{
|
||||
switch (me.MidiMessage.MessageType)
|
||||
{
|
||||
case MessageType.Channel:
|
||||
{
|
||||
ChannelMessage m = (ChannelMessage)me.MidiMessage;
|
||||
if (m.Command == ChannelCommand.ProgramChange)
|
||||
if ((GeneralMidiInstrument)m.Data1 == GeneralMidiInstrument.AcousticGrandPiano)
|
||||
{
|
||||
piano = it;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MessageType.Meta:
|
||||
{
|
||||
MetaMessage m = (MetaMessage)me.MidiMessage;
|
||||
if (m.MetaType == MetaType.Tempo)
|
||||
tempo = (new TempoChangeBuilder(m)).Tempo;
|
||||
else if (m.MetaType == MetaType.TimeSignature)
|
||||
timeSig = new TimeSignatureBuilder(m).Denominator;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (piano >= 0)
|
||||
break;
|
||||
}
|
||||
if (piano >= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// didn't find one, so just try 0th track anyway
|
||||
if (piano == -1)
|
||||
piano = 0;
|
||||
|
||||
// now, pull all notes (and tempo)
|
||||
// and make sure it's a channel that has content
|
||||
for (int it = piano; it < s.Count; it++)
|
||||
{
|
||||
Track t = s[it];
|
||||
|
||||
int delta = 0;
|
||||
foreach (MidiEvent me in t.Iterator())
|
||||
{
|
||||
delta += me.DeltaTicks;
|
||||
|
||||
switch (me.MidiMessage.MessageType)
|
||||
{
|
||||
case MessageType.Channel:
|
||||
{
|
||||
ChannelMessage m = (ChannelMessage)me.MidiMessage;
|
||||
switch (m.Command)
|
||||
{
|
||||
case ChannelCommand.NoteOn:
|
||||
if (curNote.Note != "")
|
||||
{
|
||||
curNote.Length = delta / 1000F;
|
||||
delta = 0;
|
||||
notes.Add(curNote);
|
||||
}
|
||||
|
||||
curNote.Note = note2Piano(m.Data1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MessageType.Meta:
|
||||
{
|
||||
MetaMessage m = (MetaMessage)me.MidiMessage;
|
||||
if (m.MetaType == MetaType.Tempo)
|
||||
tempo = (new TempoChangeBuilder(m)).Tempo;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure we get last note
|
||||
if (curNote.Note != "")
|
||||
{
|
||||
curNote.Length = delta / 1000F;
|
||||
notes.Add(curNote);
|
||||
}
|
||||
|
||||
// we found a track with content!
|
||||
if (notes.Count > 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// compress redundant accidentals/octaves
|
||||
char[] notemods = new char[7];
|
||||
int[] noteocts = new int[7];
|
||||
for (int i = 0; i < 7; i++)
|
||||
{
|
||||
notemods[i] = 'n';
|
||||
noteocts[i] = 3;
|
||||
}
|
||||
for (int i = 0; i < notes.Count; i++)
|
||||
{
|
||||
string noteStr = notes[i].Note;
|
||||
int cur_note = noteStr[0] - 0x41;
|
||||
char mod = noteStr[1];
|
||||
int oct = int.Parse(noteStr.Substring(2));
|
||||
|
||||
noteStr = noteStr.Substring(0, 1);
|
||||
if (mod != notemods[cur_note])
|
||||
{
|
||||
noteStr += new string(mod, 1);
|
||||
notemods[cur_note] = mod;
|
||||
}
|
||||
if (oct != noteocts[cur_note])
|
||||
{
|
||||
noteStr += oct.ToString();
|
||||
noteocts[cur_note] = oct;
|
||||
}
|
||||
|
||||
notes[i] = new PNote(notes[i].Length, noteStr);
|
||||
}
|
||||
|
||||
// now, we find what the "beat" length should be,
|
||||
// by counting numbers of times for each length, and finding statistical mode
|
||||
Dictionary<float, int> scores = new Dictionary<float, int>();
|
||||
foreach (PNote n in notes)
|
||||
{
|
||||
if (n.Length != 0)
|
||||
if (scores.Keys.Contains(n.Length))
|
||||
scores[n.Length]++;
|
||||
else
|
||||
scores.Add(n.Length, 1);
|
||||
}
|
||||
float winner = 1;
|
||||
int score = 0;
|
||||
foreach (KeyValuePair<float, int> kv in scores)
|
||||
{
|
||||
if (kv.Value > score)
|
||||
{
|
||||
winner = kv.Key;
|
||||
score = kv.Value;
|
||||
}
|
||||
}
|
||||
// realign all of them to match beat length
|
||||
for (int i = 0; i < notes.Count; i++)
|
||||
{
|
||||
notes[i] = new PNote(notes[i].Length / winner, notes[i].Note);
|
||||
}
|
||||
|
||||
// compress chords down
|
||||
for (int i = 0; i < notes.Count; i++)
|
||||
{
|
||||
if (notes[i].Length == 0 && i < notes.Count - 1)
|
||||
{
|
||||
notes[i + 1] = new PNote(notes[i + 1].Length, notes[i].Note + "-" + notes[i + 1].Note);
|
||||
notes.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
// add in time
|
||||
for (int i = 0; i < notes.Count; i++)
|
||||
{
|
||||
float len = notes[i].Length;
|
||||
notes[i] = new PNote(len, notes[i].Note + (len != 1 ? "/" + (1 / len).ToString("0.##") : ""));
|
||||
}
|
||||
|
||||
// what is the bpm, anyway?
|
||||
int rpm = (int)(28800000 / tempo / winner); // 60 * 1,000,000 * .48 the .48 is because note lengths for some reason midi makes the beat note be .48 long
|
||||
|
||||
// now, output!
|
||||
string line = "";
|
||||
string output = "";
|
||||
int lineCount = 1;
|
||||
foreach (PNote n in notes)
|
||||
{
|
||||
if (line.Length + n.Note.Length + 1 > 51)
|
||||
{
|
||||
output += line.Substring(0, line.Length - 1) + "\r\n";
|
||||
line = "";
|
||||
if (lineCount == 50)
|
||||
break;
|
||||
lineCount++;
|
||||
}
|
||||
line += n.Note + ",";
|
||||
}
|
||||
if (line.Length > 0)
|
||||
output += line.Substring(0, line.Length - 1);
|
||||
OutputTxt.Text = "BPM: " + rpm.ToString() + "\r\n" + output;
|
||||
OutputTxt.SelectAll();
|
||||
}
|
||||
|
||||
public enum NoteNames
|
||||
{
|
||||
C = 0,
|
||||
D = 2,
|
||||
E = 4,
|
||||
F = 5,
|
||||
G = 7,
|
||||
A = 9,
|
||||
B = 11
|
||||
}
|
||||
|
||||
string note2Piano(int n)
|
||||
{
|
||||
string name, arg, octave;
|
||||
name = Enum.GetName(typeof(NoteNames), (NoteNames)(n % 12));
|
||||
if (name == null)
|
||||
{
|
||||
name = Enum.GetName(typeof(NoteNames), (NoteNames)((n + 1) % 12));
|
||||
arg = "b";
|
||||
}
|
||||
else
|
||||
{
|
||||
arg = "n";
|
||||
}
|
||||
octave = (n / 12 - 1).ToString();
|
||||
|
||||
return name + arg + octave;
|
||||
}
|
||||
|
||||
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
OutputTxt.SelectAll();
|
||||
OutputTxt.Copy();
|
||||
}
|
||||
|
||||
private void halpToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this,
|
||||
"This program prefers MIDIs that have a single track, otherwise it picks the first piano track it finds, else the first track. Songs with odd tempos may have their BPM's calculated wrong.",
|
||||
"Halp", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
126
tools/midi2piano/midi2piano/Form1.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="importDlg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>132, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
34
tools/midi2piano/midi2piano/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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("midi2piano")]
|
||||
[assembly: AssemblyProduct("midi2piano")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2011")]
|
||||
[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. Only Windows
|
||||
// assemblies support COM.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// On Windows, the following GUID is for the ID of the typelib if this
|
||||
// project is exposed to COM. On other platforms, it unique identifies the
|
||||
// title storage container when deploying this assembly to the device.
|
||||
[assembly: Guid("9752c562-edc1-40da-8fa1-619df747e0f3")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
BIN
tools/midi2piano/midi2piano/Sanford.Multimedia.Midi.dll
Normal file
BIN
tools/midi2piano/midi2piano/bin/x86/Release/midi2piano.exe
Normal file
83
tools/midi2piano/midi2piano/midi2piano.csproj
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>midi2piano</RootNamespace>
|
||||
<AssemblyName>midi2piano</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\x86\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\x86\Release</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Sanford.Multimedia.Midi, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>.\Sanford.Multimedia.Midi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||