customizemii-wiidb/CustomizeMii/CustomizeMii_Forwarders.cs

115 lines
3.9 KiB
C#
Raw Permalink Normal View History

/* This file is part of CustomizeMii
* Copyright (C) 2009 Leathl
*
* CustomizeMii is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CustomizeMii is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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 ForwardMii;
namespace CustomizeMii
{
namespace Forwarder
{
//Let's use this kind of wrapper, so CustomizeMii can still run, if the ForwardMii.dll is missing...
internal class Complex
{
2010-02-06 00:09:36 +01:00
private string[] paths = new string[16];
private bool[] packs = new bool[3];
private string image43;
private string image169;
2010-02-06 00:09:36 +01:00
public bool[] Packs { get { return packs; } set { packs = value; } }
public string[] Paths { get { return paths; } set { paths = value; } }
public string Image43 { get { return image43; } set { image43 = value; } }
public string Image169 { get { return image169; } set { image169 = value; } }
public Complex()
{
2010-02-06 00:09:36 +01:00
paths[0] = "SD:/apps/example/boot.dol";
paths[1] = "SD:/apps/example/boot.elf";
paths[2] = "USB:/apps/example/boot.dol";
paths[3] = "USB:/apps/example/boot.elf";
}
public string GetPath(int pathNum)
{
return paths[pathNum];
}
2010-02-06 00:09:36 +01:00
public void SetPath(int pathNum, string forwardPath)
{
paths[pathNum] = forwardPath;
}
public void Save(string Destination)
{
2010-02-06 00:09:36 +01:00
GXForwarder Forwarder = new GXForwarder(image43, image169, paths);
Forwarder.Save(Destination, true);
}
2010-03-28 20:29:30 +02:00
public byte[] ToByteArray()
{
GXForwarder Forwarder = new GXForwarder(image43, image169, paths);
return Forwarder.ToByteArray();
}
public void Clear()
{
2010-02-06 00:09:36 +01:00
paths[0] = "SD:/apps/example/boot.dol";
paths[1] = "SD:/apps/example/boot.elf";
paths[2] = "USB:/apps/example/boot.dol";
paths[3] = "USB:/apps/example/boot.elf";
packs[0] = false;
packs[1] = false;
packs[2] = false;
for (int i = 4; i < paths.Length; i++)
paths[i] = string.Empty;
image43 = string.Empty;
image169 = string.Empty;
}
}
internal class Simple
{
private string thisAppFolder;
private bool toElf = false;
public string AppFolder { get { return thisAppFolder; } set { thisAppFolder = value; } }
public bool ForwardToElf { get { return toElf; } set { toElf = value; } }
2010-03-28 20:29:30 +02:00
public Simple() { }
public void Save(string Destination)
{
SDSDHC_Forwarder Forwarder = new SDSDHC_Forwarder(thisAppFolder, toElf);
Forwarder.Save(Destination, true);
}
2010-03-28 20:29:30 +02:00
public byte[] ToByteArray()
{
SDSDHC_Forwarder Forwarder = new SDSDHC_Forwarder(thisAppFolder, toElf);
return Forwarder.ToByteArray();
}
public void Clear()
{
thisAppFolder = string.Empty;
toElf = false;
}
}
}
}