mirror of
https://github.com/Brawl345/customizemii.git
synced 2024-11-15 04:45:09 +01:00
TransmitMii 1.15
This commit is contained in:
parent
f194600262
commit
7ccebe4302
@ -49,5 +49,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.1.0.0")]
|
[assembly: AssemblyVersion("1.1.5.0")]
|
||||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
[assembly: AssemblyFileVersion("1.1.5.0")]
|
||||||
|
@ -9,6 +9,11 @@ TransmitMii is hosted on the CustomizeMii project page: http://customizemii.goog
|
|||||||
-----------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------
|
||||||
Changelog:
|
Changelog:
|
||||||
|
|
||||||
|
Version 1.15
|
||||||
|
- Fixed transmitting to HBC -1.0.4 (HAXX)
|
||||||
|
- Fixed transmitting to USB Loader GX
|
||||||
|
- Bugfix
|
||||||
|
|
||||||
Version 1.1
|
Version 1.1
|
||||||
- Added ability to link and unlink extensions with TransmitMii
|
- Added ability to link and unlink extensions with TransmitMii
|
||||||
- Added compression for HBC 1.0.5+ (similar to wiiload)
|
- Added compression for HBC 1.0.5+ (similar to wiiload)
|
||||||
|
@ -41,6 +41,8 @@ namespace TransmitMii
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static bool CheckAssociation(Extension which)
|
public static bool CheckAssociation(Extension which)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if (which == Extension.Both)
|
if (which == Extension.Both)
|
||||||
{
|
{
|
||||||
@ -61,6 +63,8 @@ namespace TransmitMii
|
|||||||
if (Registry.GetValue(regKey, "", "").ToString().ToLower() != "wiibin") return false;
|
if (Registry.GetValue(regKey, "", "").ToString().ToLower() != "wiibin") return false;
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
catch { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
public static bool DeleteAssociation(Extension which)
|
public static bool DeleteAssociation(Extension which)
|
||||||
{
|
{
|
||||||
|
@ -27,11 +27,11 @@ namespace TransmitMii
|
|||||||
{
|
{
|
||||||
public partial class TransmitMii_Main : Form
|
public partial class TransmitMii_Main : Form
|
||||||
{
|
{
|
||||||
const string version = "1.1"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
|
const string version = "1.15"; //Hint for myself: Never use a char in the Version (UpdateCheck)!
|
||||||
private bool IsRunning = false;
|
private bool IsRunning = false;
|
||||||
private string fileName;
|
private string fileName;
|
||||||
private string statusText;
|
private string statusText;
|
||||||
private bool JODI;
|
private Protocol protocol;
|
||||||
private bool Aborted = false;
|
private bool Aborted = false;
|
||||||
private bool directStart = false;
|
private bool directStart = false;
|
||||||
EventHandler UpdateStatus;
|
EventHandler UpdateStatus;
|
||||||
@ -222,7 +222,7 @@ namespace TransmitMii
|
|||||||
|
|
||||||
fileName = Path.GetFileName(tbFile.Text);
|
fileName = Path.GetFileName(tbFile.Text);
|
||||||
|
|
||||||
JODI = cmbProtocol.SelectedIndex == 0 ? true : false;
|
protocol = IntToProtocol(cmbProtocol.SelectedIndex);
|
||||||
bwTransmit.RunWorkerAsync(theFile);
|
bwTransmit.RunWorkerAsync(theFile);
|
||||||
}
|
}
|
||||||
else { tbIP.Focus(); tbIP.SelectAll(); }
|
else { tbIP.Focus(); tbIP.SelectAll(); }
|
||||||
@ -241,7 +241,7 @@ namespace TransmitMii
|
|||||||
{
|
{
|
||||||
byte[] theFile = e.Argument as byte[];
|
byte[] theFile = e.Argument as byte[];
|
||||||
|
|
||||||
if (Transmit_Compress(fileName, theFile, JODI, File.Exists(Application.StartupPath + "\\zlib1.dll")))
|
if (Transmit_Compress(fileName, theFile, protocol, File.Exists(Application.StartupPath + "\\zlib1.dll")))
|
||||||
{
|
{
|
||||||
if (usedCompression)
|
if (usedCompression)
|
||||||
MessageBox.Show(string.Format("Transmitted {0} kB in {1} milliseconds...\nCompression Ratio: {2}%", transmittedLength, timeElapsed, compressionRatio), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show(string.Format("Transmitted {0} kB in {1} milliseconds...\nCompression Ratio: {2}%", transmittedLength, timeElapsed, compressionRatio), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -311,7 +311,9 @@ namespace TransmitMii
|
|||||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
if (files.Length == 1)
|
if (files.Length == 1)
|
||||||
{
|
{
|
||||||
if (Path.GetExtension(files[0]) == ".dol" || Path.GetExtension(files[0]) == ".elf")
|
if (Path.GetExtension(files[0]) == ".dol" ||
|
||||||
|
Path.GetExtension(files[0]) == ".elf" ||
|
||||||
|
Path.GetExtension(files[0]) == ".wad")
|
||||||
e.Effect = DragDropEffects.Copy;
|
e.Effect = DragDropEffects.Copy;
|
||||||
else
|
else
|
||||||
e.Effect = DragDropEffects.None;
|
e.Effect = DragDropEffects.None;
|
||||||
|
@ -22,6 +22,10 @@ namespace TransmitMii
|
|||||||
{
|
{
|
||||||
partial class TransmitMii_Main
|
partial class TransmitMii_Main
|
||||||
{
|
{
|
||||||
|
const bool JODI_Compress = true;
|
||||||
|
const bool HAXX_Compress = false;
|
||||||
|
const bool USBX_Compress = false;
|
||||||
|
|
||||||
TcpClient theClient;
|
TcpClient theClient;
|
||||||
NetworkStream theStream;
|
NetworkStream theStream;
|
||||||
System.Diagnostics.Stopwatch stopper = new System.Diagnostics.Stopwatch();
|
System.Diagnostics.Stopwatch stopper = new System.Diagnostics.Stopwatch();
|
||||||
@ -30,18 +34,42 @@ namespace TransmitMii
|
|||||||
private bool usedCompression;
|
private bool usedCompression;
|
||||||
private double compressionRatio;
|
private double compressionRatio;
|
||||||
|
|
||||||
private bool Transmit_Compress(string fileName, byte[] fileData, bool JODI, bool compress)
|
private enum Protocol : int
|
||||||
|
{
|
||||||
|
// 0 = No Compression
|
||||||
|
// 1 = Compression
|
||||||
|
JODI = 1,
|
||||||
|
HAXX = 0,
|
||||||
|
USBX = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
private Protocol IntToProtocol(int theInt)
|
||||||
|
{
|
||||||
|
switch (theInt)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return Protocol.JODI;
|
||||||
|
case 1:
|
||||||
|
return Protocol.HAXX;
|
||||||
|
case 2:
|
||||||
|
return Protocol.USBX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Transmit_Compress(string fileName, byte[] fileData, Protocol protocol, bool compress)
|
||||||
{
|
{
|
||||||
stopper.Reset(); stopper.Start();
|
stopper.Reset(); stopper.Start();
|
||||||
|
|
||||||
if (!Environment.OSVersion.ToString().Contains("Windows"))
|
if (!Environment.OSVersion.ToString().Contains("Windows"))
|
||||||
compress = false;
|
compress = false;
|
||||||
|
|
||||||
|
if ((int)(protocol) == 0) compress = false;
|
||||||
|
|
||||||
theClient = new TcpClient();
|
theClient = new TcpClient();
|
||||||
|
|
||||||
byte[] compFileData;
|
byte[] compFileData;
|
||||||
int Blocksize = 4 * 1024;
|
int Blocksize = 4 * 1024;
|
||||||
if (!JODI) Blocksize = 16 * 1024;
|
if (protocol != Protocol.JODI) Blocksize = 16 * 1024;
|
||||||
byte[] buffer = new byte[4];
|
byte[] buffer = new byte[4];
|
||||||
string theIP = tbIP.Text;
|
string theIP = tbIP.Text;
|
||||||
|
|
||||||
@ -59,24 +87,15 @@ namespace TransmitMii
|
|||||||
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Magic:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Magic:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
StatusUpdate("Magic Sent... Sending Version Info...");
|
StatusUpdate("Magic Sent... Sending Version Info...");
|
||||||
if (JODI)
|
|
||||||
{
|
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
buffer[1] = 5;
|
buffer[1] = protocol == Protocol.JODI ? (byte)5 : (byte)4;
|
||||||
buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff);
|
buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff);
|
||||||
buffer[3] = (byte)((fileName.Length + 2) & 0xff);
|
buffer[3] = (byte)((fileName.Length + 2) & 0xff);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer[0] = 0;
|
|
||||||
buffer[1] = 1;
|
|
||||||
buffer[2] = 0;
|
|
||||||
buffer[3] = 0;
|
|
||||||
}
|
|
||||||
try { theStream.Write(buffer, 0, 4); }
|
try { theStream.Write(buffer, 0, 4); }
|
||||||
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Version Info:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Version Info:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
if (JODI && compress)
|
if (compress)
|
||||||
{
|
{
|
||||||
StatusUpdate("Version Info Sent... Compressing File...");
|
StatusUpdate("Version Info Sent... Compressing File...");
|
||||||
try { compFileData = zlib.Compress(fileData); }
|
try { compFileData = zlib.Compress(fileData); }
|
||||||
@ -106,7 +125,7 @@ namespace TransmitMii
|
|||||||
try { theStream.Write(buffer, 0, 4); }
|
try { theStream.Write(buffer, 0, 4); }
|
||||||
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Filesize:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Filesize:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
if (JODI)
|
if (compress)
|
||||||
{
|
{
|
||||||
buffer[0] = (byte)((fileData.Length >> 24) & 0xff);
|
buffer[0] = (byte)((fileData.Length >> 24) & 0xff);
|
||||||
buffer[1] = (byte)((fileData.Length >> 16) & 0xff);
|
buffer[1] = (byte)((fileData.Length >> 16) & 0xff);
|
||||||
@ -139,14 +158,11 @@ namespace TransmitMii
|
|||||||
}
|
}
|
||||||
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending File:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending File:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
if (JODI)
|
|
||||||
{
|
|
||||||
StatusUpdate("File Sent... Sending Arguments...");
|
StatusUpdate("File Sent... Sending Arguments...");
|
||||||
byte[] theArgs = new byte[fileName.Length + 2];
|
byte[] theArgs = new byte[fileName.Length + 2];
|
||||||
for (int i = 0; i < fileName.Length; i++) { theArgs[i] = (byte)fileName.ToCharArray()[i]; }
|
for (int i = 0; i < fileName.Length; i++) { theArgs[i] = (byte)fileName.ToCharArray()[i]; }
|
||||||
try { theStream.Write(theArgs, 0, theArgs.Length); }
|
try { theStream.Write(theArgs, 0, theArgs.Length); }
|
||||||
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Arguments:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Arguments:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
}
|
|
||||||
|
|
||||||
theStream.Close();
|
theStream.Close();
|
||||||
theClient.Close();
|
theClient.Close();
|
||||||
@ -164,13 +180,13 @@ namespace TransmitMii
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private bool Transmit(string fileName, byte[] fileData, bool JODI)
|
//private bool Transmit(string fileName, byte[] fileData, bool _JODI)
|
||||||
//{
|
//{
|
||||||
// TcpClient theClient = new TcpClient();
|
// TcpClient theClient = new TcpClient();
|
||||||
// NetworkStream theStream;
|
// NetworkStream theStream;
|
||||||
|
|
||||||
// int Blocksize = 4 * 1024;
|
// int Blocksize = 4 * 1024;
|
||||||
// if (!JODI) Blocksize = 16 * 1024;
|
// if (!_JODI) Blocksize = 16 * 1024;
|
||||||
// byte[] buffer = new byte[4];
|
// byte[] buffer = new byte[4];
|
||||||
// string theIP = tbIP.Text;
|
// string theIP = tbIP.Text;
|
||||||
|
|
||||||
@ -188,7 +204,7 @@ namespace TransmitMii
|
|||||||
// catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Magic:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
// catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Magic:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
// StatusUpdate("Magic Sent... Sending Version Info...");
|
// StatusUpdate("Magic Sent... Sending Version Info...");
|
||||||
// if (JODI)
|
// if (_JODI)
|
||||||
// {
|
// {
|
||||||
// buffer[0] = 0;
|
// buffer[0] = 0;
|
||||||
// buffer[1] = 5;
|
// buffer[1] = 5;
|
||||||
@ -214,7 +230,7 @@ namespace TransmitMii
|
|||||||
// try { theStream.Write(buffer, 0, 4); }
|
// try { theStream.Write(buffer, 0, 4); }
|
||||||
// catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Filesize:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
// catch (Exception ex) { if (!Aborted) ErrorBox("Error sending Filesize:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
// if (JODI)
|
// if (_JODI)
|
||||||
// {
|
// {
|
||||||
// buffer[0] = 0;
|
// buffer[0] = 0;
|
||||||
// buffer[1] = 0;
|
// buffer[1] = 0;
|
||||||
@ -247,7 +263,7 @@ namespace TransmitMii
|
|||||||
// }
|
// }
|
||||||
// catch (Exception ex) { if (!Aborted) ErrorBox("Error sending File:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
// catch (Exception ex) { if (!Aborted) ErrorBox("Error sending File:\n" + ex.Message); theStream.Close(); theClient.Close(); return false; }
|
||||||
|
|
||||||
// if (JODI)
|
// if (_JODI)
|
||||||
// {
|
// {
|
||||||
// StatusUpdate("File Sent... Sending Arguments...");
|
// StatusUpdate("File Sent... Sending Arguments...");
|
||||||
// byte[] theArgs = new byte[fileName.Length + 2];
|
// byte[] theArgs = new byte[fileName.Length + 2];
|
||||||
|
Loading…
Reference in New Issue
Block a user