Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
+ v1.4
Browse files Browse the repository at this point in the history
- New CD Parser class
- Fixed times bug when converting multifile CD images to a single .bin
- Fixed bug, when setting a custom TEMP folder, it now sets and restores it correctly.
- When **crushing** and the output archive already exists, it doesn't overwrite it, instead it renames the new archive by adding a `_` to the end of the file.
  • Loading branch information
john32b committed Apr 25, 2018
1 parent 2ed3243 commit b1d1aa3
Show file tree
Hide file tree
Showing 19 changed files with 244 additions and 140 deletions.
29 changes: 26 additions & 3 deletions BUILDING.MD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Building cdcrush dot NET


Expand All @@ -9,20 +10,42 @@ https://www.visualstudio.com/downloads/

### Running Requirements

These tools are needed to run cdcrush:
These tools are needed to **run** cdcrush:

- **FreeArc**, an open source archiver. **Included** in the project files.\
Project Site : https://sourceforge.net/projects/freearc
- **Ecmtools**, open source CD tools. **Included** in the project files. \
Project Site : https://github.com/kidoz/ecm
- **FFmpeg**, open source video/audio codecs. **NOT INCLUDED** \
- **FFmpeg**, open source video/audio codecs. :warning: **NOT INCLUDED** \
Project Site : https://www.ffmpeg.org


### Building `release`

Create a subfolder named `tools` and put all the external executables there `[Arc.exe , ecm.exe , unecm.exe, ffmpeg.exe ]`
Create a subfolder named `tools` and put all the external executables there `[Arc.exe , ecm.exe , unecm.exe, ffmpeg.exe ]` <sup>*ffmpeg is optional*</sup>


### Building `debug`

The tool executables are fetched from the root repo folder `/tools/`. All the tools are provided in the repo except `FFmpeg` which you need to download and place it on your system/user path.



### `cdinfos.dll`


This file was build using **HAXE**, compiled code from [**cdcrush nodejs**](https://github.com/johndimi/cdcrush) version.
Basically it's 2 classes, `CDInfo` and `CDTrack` compiled into a DLL so that I can have a single codebase for the CueParse for both cdcursh versions

You can find the [source code for there files here.](https://github.com/johndimi/cdcrush/tree/master/src/cd)

> :warning: You don't really have to build it yourself, you can just grab `cdinfos.dll` that is inside the project folder.
#### To compile the cdinfos DLL with HAXE run this command:
```haxe
haxe -cp src/cd -D dll -D no-root -cs cdinfos cd.CDInfos cd.CDTrack
```

- `src/cd` must point to the nodejs version folder where the CD classes are
- It will create a directory `cdinfos/` and in there you can find the .dll file

10 changes: 9 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## CHANGELOG

### V1.4
- New CD Parser class
- Fixed times bug when converting multifile CD images to a single .bin
- built with **HAXE** and is included as a DLL file
- is the exact same class used in the **nodejs** version of cdcrush *(same codebase)*
- Fixed bug, when setting a custom TEMP folder, it now sets and restores it correctly.
- When **crushing** and the output archive already exists, it doesn't overwrite it, instead it renames the new archive by adding a `_` to the end of the file.

### V1.3
- Added LOG window. You can now see a realtime log by pressing the "LOG" button on the bottom right of the window
- Upgraded version to 1.3, because many new features were added since 1.2
Expand Down Expand Up @@ -28,4 +36,4 @@
- Calculate and display the **MD5** of the first data track, useful to quickly identify the validity of the CD
- Ability to add an image cover to a CD archive. The image will then be displayed when restoring a CD.
- MultiThreaded. Background FFmpeg and ECM operations can execute in parallel. *(Custom amount of threads in the options tab)*
- Temporary files will be deleted upon user program exit.
- Temporary files will be deleted upon user program exit.
14 changes: 11 additions & 3 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

# CDCRUSH dot NET

**Name**: cdcrush, *Highy compress cd-image games*\
**Author:** John Dimi, <johndimi@outlook.com> *twitter*: [@jondmt](https://twitter.com/jondmt)\
**Project Page and Sources:** [https://github.com/johndimi/cdcrush.net](https://github.com/johndimi/cdcrush.net)\
**Language:** C# .NET 4.5, **Licence:** MIT\
**Version:** 1.3 **Platform:** Windows
**Version:** 1.3 **Platform:** Windows\
**Sister Project** : [cdcrush nodejs](https://www.npmjs.com/package/cdcrush)

## Download

Expand Down Expand Up @@ -129,9 +131,15 @@ See [`CHANGELOG.MD`](CHANGELOG.MD)
**A** : FFmpeg.exe is a small beast ( *around 36 megabytes*) and in some cases users already have it on their pc. So I am publishing a version with and a version without it.


## Npm Version
## NodeJS Version

This project is a continuation of [**cdcrush nodeJS**](https://www.npmjs.com/package/cdcrush).

**NEW APRIL 2018** :: I updated the **nodejs** version of **cdcrush** and it's compatible with the **.net** version. Meaning that archives created with **.net** can be opened with **.nodejs** and vice versa.

> :stars: **nodejs** version support **batches** , so you can restore/compress multiple CD with one command.
This project is a continuation of [**cdcrush npm**](https://www.npmjs.com/package/cdcrush). You can check it out if you want, but **note** :warning: that the NPM version is old and **NOT RECOMMENDED TO USE** until I update it.
You can checkout **nodejs** version over at NPM : https://www.npmjs.com/package/cdcrush

## About

Expand Down
4 changes: 2 additions & 2 deletions cdcrush/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// 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.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: NeutralResourcesLanguage("en")]

7 changes: 5 additions & 2 deletions cdcrush/cdcrush.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.2.0.0</ApplicationVersion>
<ApplicationVersion>1.4.0.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down Expand Up @@ -62,6 +62,10 @@
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="cdinfos, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>.\cdinfos.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WindowsAPICodePack-Core.1.1.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -125,7 +129,6 @@
<Compile Include="lib\app\EcmTools.cs" />
<Compile Include="lib\app\FFmpeg.cs" />
<Compile Include="lib\app\FreeArc.cs" />
<Compile Include="lib\CueReader.cs" />
<Compile Include="lib\task\CJob.cs" />
<Compile Include="lib\LOG.cs" />
<Compile Include="lib\task\CTask.cs" />
Expand Down
Binary file added cdcrush/cdinfos.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions cdcrush/forms/FormChecksums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ namespace cdcrush.forms
public partial class FormChecksums: Form
{
// --
CueReader cd;
cd.CDInfos cd;

static public bool ISOPEN = false;

// --
public FormChecksums(CueReader _cd)
public FormChecksums(cd.CDInfos _cd)
{
cd = _cd;
InitializeComponent();
Expand Down
6 changes: 3 additions & 3 deletions cdcrush/forms/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public partial class FormMain : Form
// Send whole form LOCK status from components
internal static Action<bool> sendLock;
// Request to open CD INFO popup
internal static Action<CueReader> showCdInfo;
internal static Action<cd.CDInfos> showCdInfo;

// VARS ::
// ---------------
Expand Down Expand Up @@ -181,7 +181,7 @@ void loadAndSetupSettings()

// --
// Show a popup with some CD infos like checksums
public void form_showCdInfo(CueReader cd)
public void form_showCdInfo(cd.CDInfos cd)
{
if(FormChecksums.ISOPEN) return;
var f = new FormChecksums(cd);
Expand Down Expand Up @@ -386,7 +386,7 @@ private void btn_selectTemp_Click(object sender, EventArgs e)
if(CDCRUSH.setTempFolder(path))
{
info_tempFolder.Text = CDCRUSH.TEMP_FOLDER;
Properties.Settings.Default.tempFolder = CDCRUSH.TEMP_FOLDER; // A valid folder
Properties.Settings.Default.tempFolder = path; // A valid folder
}
}
}// -----------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions cdcrush/forms/PanelCompress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class PanelCompress : UserControl
string preparedCover;
string loadedCuePath;
// This holds the info of the CD that was just compressed. Set AFTER crushing
CueReader postCdInfo;
cd.CDInfos postCdInfo;
// Hold the number of tracks of the quickloadedCD
int numberOfTracks;

Expand All @@ -27,7 +27,7 @@ public PanelCompress()
private void PanelCompress_Load(object sender, EventArgs e)
{
// -- Some Tooltips
ToolTip tt = new ToolTip();
ToolTip tt = new ToolTip();
tt.SetToolTip(chk_encodedCue, "Encodes audio tracks and creates a .CUE file that handles data and encoded audio tracks. Doesn't create a final archive. This format can be used in some emulators.");
tt.SetToolTip(pictureBox1,"You can optionally set an image cover for this CD and it will be stored in the archive.");

Expand Down Expand Up @@ -208,7 +208,7 @@ public void handle_dropped_file(string file)
else if (ext == ".jpg")
form_set_cover(file);
else {
FormMain.sendMessage("Unsupported file extension. Drop a .CUE file",3);
FormMain.sendMessage("Unsupported file extension. Drop a .CUE file, or .JPG for a cover",3);
}
}// -----------------------------------------

Expand All @@ -220,7 +220,7 @@ private void btn_CRUSH_Click(object sender, EventArgs e)
Tuple<int,int> audioQ = Tuple.Create(combo_audio_c.SelectedIndex,combo_audio_q.SelectedIndex);

// Since I can fire 2 jobs from here, have a common callback
Action<bool,int,CueReader> jobCallback = (complete, newSize, cd) => {
Action<bool,int,cd.CDInfos> jobCallback = (complete, newSize, cd) => {
FormTools.invoke(this, () =>{
form_lockSection("all", false);
Expand Down
6 changes: 3 additions & 3 deletions cdcrush/forms/PanelRestore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class PanelRestore : UserControl

// CD Info of the CD prepared to be restored
// Primarily used to getting the checksum data
CueReader loadedCDInfo;
cd.CDInfos loadedCDInfo;

// -----------------------------------------

Expand Down Expand Up @@ -93,7 +93,7 @@ void form_setCdInfo(dynamic cdInfo = null)
loadedCDInfo = cdInfo.cd;
btn_chksm.Enabled = true;

int numberOfTracks = loadedCDInfo.tracks.Count;
int numberOfTracks = loadedCDInfo.tracks.length;

info_cdtitle.Text = loadedCDInfo.CD_TITLE;
info_size0.Text = String.Format("{0}MB", FormTools.bytesToMB(cdInfo.sizeArc));
Expand Down Expand Up @@ -205,7 +205,7 @@ private void btn_RESTORE_Click(object sender, EventArgs e)
FormMain.sendMessage("", 1);

// Send the nuber of tracks for proper progress reporting
CDCRUSH.HACK_CD_TRACKS = loadedCDInfo.tracks.Count;
CDCRUSH.HACK_CD_TRACKS = loadedCDInfo.tracks.length;

// Start the job
// Note, Progress updates are automatically being handled by the main FORM
Expand Down
21 changes: 17 additions & 4 deletions cdcrush/lib/CueReader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
using System;
/**
* CueReader.cs
* CD .cue file parser and saver
* -----------------------
* Author : John Dimi
*
* ATTENTION:
* ----------
* This class is DEPRECATED! AND NOT USED
* In favor of the CDINFO DLL object which was generated from HAXE code.
* The reason is to have a single codebase for both this C# version
* and the nodejs version of CDCRUSH.
*
* ================================================= */

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
Expand All @@ -9,9 +24,7 @@
namespace cdcrush.lib
{

/**
* CueReader is the main class to read and operate CUE files
*/

public class CueReader
{
// :: STATICS
Expand Down
43 changes: 26 additions & 17 deletions cdcrush/prog/CDCRUSH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static class CDCRUSH
// -- Program Infos
public const string AUTHORNAME = "John Dimi";
public const string PROGRAM_NAME = "cdcrush";
public const string PROGRAM_VERSION = "1.3";
public const string PROGRAM_VERSION = "1.4";
public const string PROGRAM_SHORT_DESC = "Highy compress cd-image games";
public const string LINK_DONATE = "https://www.paypal.me/johndimi";
public const string LINK_SOURCE = "https://github.com/johndimi/cdcrush.net";
Expand Down Expand Up @@ -79,7 +79,7 @@ public static class CDCRUSH
// Hacky way of pushing number of expected tracks on the jobs.
// MUST BE SET RIGHT BEFORE CREATING AJOB.
// Until I implement progress reporting in a better way, this works fine.
public static int HACK_CD_TRACKS=0;
public static int HACK_CD_TRACKS = 0;
// -----------------------------------------

// :: AUDIO QUALITY ::
Expand Down Expand Up @@ -220,7 +220,7 @@ public static string getAudioQualityString(Tuple<int,int> A)
/// <param name="onComplete">Completed (completeStatus,final Size)</param>
/// <returns></returns>
public static bool startJob_ConvertCue(string _Input, string _Output, Tuple<int,int> _Audio,
string _Title, Action<bool,int,CueReader> onComplete)
string _Title, Action<bool,int,cd.CDInfos> onComplete)
{
if (LOCKED) { ERROR="Engine is working"; return false; }
if (!FFMPEG_OK) { ERROR="FFmpeg is not set"; return false; }
Expand Down Expand Up @@ -261,7 +261,7 @@ public static bool startJob_ConvertCue(string _Input, string _Output, Tuple<int,
/// <param name="onComplete">Completed (completeStatus,CrushedSize)</param>
/// <returns></returns>
public static bool startJob_CrushCD(string _Input, string _Output, Tuple<int,int> _Audio,
string _Cover, string _Title, int compressionLevel, Action<bool,int,CueReader> onComplete)
string _Cover, string _Title, int compressionLevel, Action<bool,int,cd.CDInfos> onComplete)
{
if (LOCKED) { ERROR="Engine is working"; return false; }
if (!FFMPEG_OK) { ERROR="FFmpeg is not set"; return false; }
Expand Down Expand Up @@ -361,20 +361,20 @@ public static object loadQuickCUE(string cueFile)
if (!check_file_(cueFile,".cue")) return false;

// Load the CUE file and try to parse it
var cd = new CueReader();

if(!cd.load(cueFile))
{
ERROR = cd.ERROR; return null;
var cd = new cd.CDInfos();
try {
cd.cueLoad(cueFile);
}catch(haxe.lang.HaxeException e) {
ERROR = e.Message; return null;
}
LOG.log("= QuickLoaded `{0}' - [OK]",cueFile);

LOG.log("= QuickLoaded `{0}' - [OK]", cueFile);

var info = new
{
title = cd.CD_TITLE,
size1 = cd.CD_TOTAL_SIZE,
tracks = cd.tracks.Count
tracks = cd.tracks.length
};

return info;
Expand Down Expand Up @@ -419,9 +419,11 @@ public static bool loadQuickInfo(string arcFile, Action<Object> onComplete)
if(success) // OK
{
// Continue
var cd = new CueReader();
if(!cd.loadJson(Path.Combine(TEMP_FOLDER,CDCRUSH_SETTINGS))) {
ERROR = cd.ERROR;
var cd = new cd.CDInfos();
try{
cd.jsonLoad(Path.Combine(TEMP_FOLDER,CDCRUSH_SETTINGS));
}catch(haxe.lang.HaxeException e){
ERROR = e.Message;
onComplete(null);
return;
}
Expand Down Expand Up @@ -505,5 +507,12 @@ public static string checkCreateUniqueOutput(string partA, string partB = "")
return path;
}// -----------------------------------------

}// --
}// --
/// Get a unique named temp folder ( inside the main temp folder )
public static string getSubTempDir()
{
return Path.Combine(CDCRUSH.TEMP_FOLDER,Guid.NewGuid().ToString().Substring(0, 12));
}// -----------------------------------------

}// -- end class

}// -- end namespace
Loading

0 comments on commit b1d1aa3

Please sign in to comment.