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
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.1.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.0.0")]
|
||||
[assembly: AssemblyVersion("1.1.5.0")]
|
||||
[assembly: AssemblyFileVersion("1.1.5.0")]
|
||||
|
@ -9,6 +9,11 @@ TransmitMii is hosted on the CustomizeMii project page: http://customizemii.goog
|
||||
-----------------------------------------------------------------------------------------
|
||||
Changelog:
|
||||
|
||||
Version 1.15
|
||||
- Fixed transmitting to HBC -1.0.4 (HAXX)
|
||||
- Fixed transmitting to USB Loader GX
|
||||
- Bugfix
|
||||
|
||||
Version 1.1
|
||||
- Added ability to link and unlink extensions with TransmitMii
|
||||
- Added compression for HBC 1.0.5+ (similar to wiiload)
|
||||
|
@ -42,24 +42,28 @@ namespace TransmitMii
|
||||
|
||||
public static bool CheckAssociation(Extension which)
|
||||
{
|
||||
if (which == Extension.Both)
|
||||
try
|
||||
{
|
||||
if (Registry.GetValue("HKEY_CLASSES_ROOT\\.dol", "", "").ToString().ToLower() == "wiibin" &&
|
||||
Registry.GetValue("HKEY_CLASSES_ROOT\\.elf", "", "").ToString().ToLower() == "wiibin") return true;
|
||||
else return false;
|
||||
if (which == Extension.Both)
|
||||
{
|
||||
if (Registry.GetValue("HKEY_CLASSES_ROOT\\.dol", "", "").ToString().ToLower() == "wiibin" &&
|
||||
Registry.GetValue("HKEY_CLASSES_ROOT\\.elf", "", "").ToString().ToLower() == "wiibin") return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
string regKey;
|
||||
if (which == Extension.DOL)
|
||||
regKey = "HKEY_CLASSES_ROOT\\.dol";
|
||||
else if (which == Extension.ELF)
|
||||
regKey = "HKEY_CLASSES_ROOT\\.elf";
|
||||
else
|
||||
regKey = "HKEY_CLASSES_ROOT\\.wad";
|
||||
|
||||
|
||||
if (Registry.GetValue(regKey, "", "").ToString().ToLower() != "wiibin") return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
string regKey;
|
||||
if (which == Extension.DOL)
|
||||
regKey = "HKEY_CLASSES_ROOT\\.dol";
|
||||
else if (which == Extension.ELF)
|
||||
regKey = "HKEY_CLASSES_ROOT\\.elf";
|
||||
else
|
||||
regKey = "HKEY_CLASSES_ROOT\\.wad";
|
||||
|
||||
|
||||
if (Registry.GetValue(regKey, "", "").ToString().ToLower() != "wiibin") return false;
|
||||
else return true;
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
public static bool DeleteAssociation(Extension which)
|
||||
|
@ -27,11 +27,11 @@ namespace TransmitMii
|
||||
{
|
||||
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 string fileName;
|
||||
private string statusText;
|
||||
private bool JODI;
|
||||
private Protocol protocol;
|
||||
private bool Aborted = false;
|
||||
private bool directStart = false;
|
||||
EventHandler UpdateStatus;
|
||||
@ -222,7 +222,7 @@ namespace TransmitMii
|
||||
|
||||
fileName = Path.GetFileName(tbFile.Text);
|
||||
|
||||
JODI = cmbProtocol.SelectedIndex == 0 ? true : false;
|
||||
protocol = IntToProtocol(cmbProtocol.SelectedIndex);
|
||||
bwTransmit.RunWorkerAsync(theFile);
|
||||
}
|
||||
else { tbIP.Focus(); tbIP.SelectAll(); }
|
||||
@ -241,7 +241,7 @@ namespace TransmitMii
|
||||
{
|
||||
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)
|
||||
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);
|
||||
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;
|
||||
else
|
||||
e.Effect = DragDropEffects.None;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Net.Sockets;
|
||||
|
||||
@ -22,6 +22,10 @@ namespace TransmitMii
|
||||
{
|
||||
partial class TransmitMii_Main
|
||||
{
|
||||
const bool JODI_Compress = true;
|
||||
const bool HAXX_Compress = false;
|
||||
const bool USBX_Compress = false;
|
||||
|
||||
TcpClient theClient;
|
||||
NetworkStream theStream;
|
||||
System.Diagnostics.Stopwatch stopper = new System.Diagnostics.Stopwatch();
|
||||
@ -30,18 +34,42 @@ namespace TransmitMii
|
||||
private bool usedCompression;
|
||||
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();
|
||||
|
||||
if (!Environment.OSVersion.ToString().Contains("Windows"))
|
||||
compress = false;
|
||||
|
||||
if ((int)(protocol) == 0) compress = false;
|
||||
|
||||
theClient = new TcpClient();
|
||||
|
||||
byte[] compFileData;
|
||||
int Blocksize = 4 * 1024;
|
||||
if (!JODI) Blocksize = 16 * 1024;
|
||||
if (protocol != Protocol.JODI) Blocksize = 16 * 1024;
|
||||
byte[] buffer = new byte[4];
|
||||
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; }
|
||||
|
||||
StatusUpdate("Magic Sent... Sending Version Info...");
|
||||
if (JODI)
|
||||
{
|
||||
buffer[0] = 0;
|
||||
buffer[1] = 5;
|
||||
buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff);
|
||||
buffer[3] = (byte)((fileName.Length + 2) & 0xff);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[0] = 0;
|
||||
buffer[1] = 1;
|
||||
buffer[2] = 0;
|
||||
buffer[3] = 0;
|
||||
}
|
||||
buffer[0] = 0;
|
||||
buffer[1] = protocol == Protocol.JODI ? (byte)5 : (byte)4;
|
||||
buffer[2] = (byte)(((fileName.Length + 2) >> 8) & 0xff);
|
||||
buffer[3] = (byte)((fileName.Length + 2) & 0xff);
|
||||
|
||||
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; }
|
||||
|
||||
if (JODI && compress)
|
||||
if (compress)
|
||||
{
|
||||
StatusUpdate("Version Info Sent... Compressing File...");
|
||||
try { compFileData = zlib.Compress(fileData); }
|
||||
@ -106,7 +125,7 @@ namespace TransmitMii
|
||||
try { theStream.Write(buffer, 0, 4); }
|
||||
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[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; }
|
||||
|
||||
if (JODI)
|
||||
{
|
||||
StatusUpdate("File Sent... Sending Arguments...");
|
||||
byte[] theArgs = new byte[fileName.Length + 2];
|
||||
for (int i = 0; i < fileName.Length; i++) { theArgs[i] = (byte)fileName.ToCharArray()[i]; }
|
||||
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; }
|
||||
}
|
||||
StatusUpdate("File Sent... Sending Arguments...");
|
||||
byte[] theArgs = new byte[fileName.Length + 2];
|
||||
for (int i = 0; i < fileName.Length; i++) { theArgs[i] = (byte)fileName.ToCharArray()[i]; }
|
||||
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; }
|
||||
|
||||
theStream.Close();
|
||||
theClient.Close();
|
||||
@ -164,13 +180,13 @@ namespace TransmitMii
|
||||
return true;
|
||||
}
|
||||
|
||||
//private bool Transmit(string fileName, byte[] fileData, bool JODI)
|
||||
//private bool Transmit(string fileName, byte[] fileData, bool _JODI)
|
||||
//{
|
||||
// TcpClient theClient = new TcpClient();
|
||||
// NetworkStream theStream;
|
||||
|
||||
// int Blocksize = 4 * 1024;
|
||||
// if (!JODI) Blocksize = 16 * 1024;
|
||||
// if (!_JODI) Blocksize = 16 * 1024;
|
||||
// byte[] buffer = new byte[4];
|
||||
// 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; }
|
||||
|
||||
// StatusUpdate("Magic Sent... Sending Version Info...");
|
||||
// if (JODI)
|
||||
// if (_JODI)
|
||||
// {
|
||||
// buffer[0] = 0;
|
||||
// buffer[1] = 5;
|
||||
@ -214,7 +230,7 @@ namespace TransmitMii
|
||||
// try { theStream.Write(buffer, 0, 4); }
|
||||
// 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[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; }
|
||||
|
||||
// if (JODI)
|
||||
// if (_JODI)
|
||||
// {
|
||||
// StatusUpdate("File Sent... Sending Arguments...");
|
||||
// byte[] theArgs = new byte[fileName.Length + 2];
|
||||
|
Loading…
Reference in New Issue
Block a user