Skip to content

Commit 9ab6f2b

Browse files
committed
Prject: Github migration
0 parents  commit 9ab6f2b

40 files changed

+1484
-0
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
bin/
2+
obj/
3+
/packages/
4+
5+
.idea/
6+
*.iml
7+
/CRCodile.sln.DotSettings.user

CRCodile.App/App.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
namespace CRCodile.App {
5+
internal class App {
6+
[STAThread]
7+
public static void Main(string[] args) {
8+
Application.Run(new MainForm());
9+
}
10+
}
11+
}

CRCodile.App/CRCodile.App.csproj

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{C53982E1-D2E1-41D9-9BC4-150ADD49F4CC}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>CRCodile.App</RootNamespace>
11+
<AssemblyName>CRCodile.App</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<LangVersion>7.3</LangVersion>
15+
<ApplicationIcon>crocodile-32px.ico</ApplicationIcon>
16+
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
18+
<PlatformTarget>AnyCPU</PlatformTarget>
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
<ApplicationIcon>crocodile-32px.ico</ApplicationIcon>
27+
</PropertyGroup>
28+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
29+
<PlatformTarget>AnyCPU</PlatformTarget>
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
<ApplicationIcon>crocodile-32px.ico</ApplicationIcon>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="System" />
40+
<Reference Include="System.Core" />
41+
<Reference Include="System.Data" />
42+
<Reference Include="System.Drawing" />
43+
<Reference Include="System.Windows.Forms" />
44+
<Reference Include="System.Xml" />
45+
</ItemGroup>
46+
<ItemGroup>
47+
<Compile Include="App.cs" />
48+
<Compile Include="ConvertButton.cs">
49+
<SubType>UserControl</SubType>
50+
</Compile>
51+
<Compile Include="ConvertButton.Designer.cs">
52+
<DependentUpon>ConvertButton.cs</DependentUpon>
53+
</Compile>
54+
<Compile Include="DumpEventArgs.cs" />
55+
<Compile Include="DumpManager.cs">
56+
<SubType>Component</SubType>
57+
</Compile>
58+
<Compile Include="DumpPicker.cs">
59+
<SubType>UserControl</SubType>
60+
</Compile>
61+
<Compile Include="DumpPicker.Designer.cs">
62+
<DependentUpon>DumpPicker.cs</DependentUpon>
63+
</Compile>
64+
<Compile Include="MainForm.cs">
65+
<SubType>Form</SubType>
66+
</Compile>
67+
<Compile Include="MainForm.Designer.cs">
68+
<DependentUpon>MainForm.cs</DependentUpon>
69+
</Compile>
70+
<Compile Include="PathEventArgs.cs" />
71+
<Compile Include="Properties\AssemblyInfo.cs" />
72+
<Compile Include="TypeLabel.cs">
73+
<SubType>UserControl</SubType>
74+
</Compile>
75+
<Compile Include="TypeLabel.Designer.cs">
76+
<DependentUpon>TypeLabel.cs</DependentUpon>
77+
</Compile>
78+
</ItemGroup>
79+
<ItemGroup>
80+
<ProjectReference Include="..\CRCodile.Lib\CRCodile.Lib.csproj">
81+
<Project>{dd3faba9-3745-462d-a38d-096797cbcd0b}</Project>
82+
<Name>CRCodile.Lib</Name>
83+
</ProjectReference>
84+
</ItemGroup>
85+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
86+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
87+
Other similar extension points exist, see Microsoft.Common.targets.
88+
<Target Name="BeforeBuild">
89+
</Target>
90+
<Target Name="AfterBuild">
91+
</Target>
92+
-->
93+
94+
</Project>

CRCodile.App/ConvertButton.Designer.cs

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CRCodile.App/ConvertButton.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System;
2+
using System.Windows.Forms;
3+
using CRCodile.Lib;
4+
5+
namespace CRCodile.App {
6+
public partial class ConvertButton : Button {
7+
/// <summary>
8+
/// This fires when output file selected
9+
/// </summary>
10+
public event EventHandler OutputFileSelected;
11+
12+
/// <summary>
13+
/// Constructor
14+
/// </summary>
15+
/// <param name="parent">Parent</param>
16+
public ConvertButton(Control parent) {
17+
InitializeComponent();
18+
parent.Controls.Add(this);
19+
}
20+
21+
/// <summary>
22+
/// Change button caption
23+
/// </summary>
24+
public void OnDumpLoaded(object sender, EventArgs e) {
25+
if (e is TypeEventArgs args) {
26+
this.Enabled = true;
27+
var type = args?.Type;
28+
var typeStr = type is DoubleDataRate3 ? "DDR3L" : "DDR3";
29+
this.Text = $"Convert to {typeStr}";
30+
}
31+
}
32+
33+
/// <summary>
34+
/// Send output file path
35+
/// </summary>
36+
private void OnClick(object sender, EventArgs e) {
37+
if (this._outputDialog.ShowDialog() == DialogResult.OK) {
38+
var path = this._outputDialog.FileName;
39+
OutputFileSelected?.Invoke(this, new PathEventArgs(path));
40+
}
41+
}
42+
}
43+
}

CRCodile.App/DumpEventArgs.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using CRCodile.Lib;
3+
4+
namespace CRCodile.App {
5+
/// <summary>
6+
/// RAM Type containing event arguments
7+
/// </summary>
8+
public class TypeEventArgs : EventArgs {
9+
/// <summary>
10+
/// RAM Type
11+
/// </summary>
12+
public RamType Type { get; }
13+
14+
/// <summary>
15+
/// Constructor
16+
/// </summary>
17+
/// <param name="type">Type to send</param>
18+
public TypeEventArgs(RamType type) {
19+
this.Type = type;
20+
}
21+
}
22+
}

CRCodile.App/DumpManager.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.IO;
4+
using System.Windows.Forms;
5+
using CRCodile.Lib;
6+
7+
namespace CRCodile.App {
8+
/// <summary>
9+
/// IO abstraction for dump management
10+
/// </summary>
11+
public partial class DumpManager : Component {
12+
/// <summary>
13+
/// Dump to process
14+
/// </summary>
15+
private RamDump _dump = null;
16+
17+
/// <summary>
18+
/// Fires when incoming file read and processed
19+
/// </summary>
20+
public event EventHandler DumpLoaded;
21+
22+
/// <summary>
23+
/// Constructor
24+
/// </summary>
25+
/// <param name="container">Components container</param>
26+
public DumpManager(IContainer container) {
27+
container.Add(this);
28+
}
29+
30+
/// <summary>
31+
/// Notify incoming file read
32+
/// </summary>
33+
public void OnIncomingFileSelected(object sender, EventArgs e) {
34+
if (e is PathEventArgs) {
35+
try {
36+
var path = e.ToString();
37+
this._dump = RamDump.FromFile(path);
38+
DumpLoaded?.Invoke(this, new TypeEventArgs(this._dump.Type));
39+
} catch (Exception ex) {
40+
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
41+
}
42+
}
43+
}
44+
45+
/// <summary>
46+
/// Write conversion result
47+
/// </summary>
48+
public void OnOutputFileSelected(object sender, EventArgs e) {
49+
if (e is PathEventArgs) {
50+
try {
51+
IRamTypeSwitcher switcher = RamTypeSwitcherFactory.CreateForSource(this._dump.Type);
52+
var switched = switcher.SwitchType(this._dump);
53+
File.WriteAllBytes(e.ToString(), switched.Bytes);
54+
} catch (Exception ex) {
55+
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
56+
return;
57+
}
58+
59+
MessageBox.Show("Successfully converted!", "Success", MessageBoxButtons.OK,
60+
MessageBoxIcon.Information);
61+
}
62+
}
63+
}
64+
}

CRCodile.App/DumpPicker.Designer.cs

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)