本文整理汇总了C#中X360.IO.DJsIO类的典型用法代码示例。如果您正苦于以下问题:C# DJsIO类的具体用法?C# DJsIO怎么用?C# DJsIO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DJsIO类属于X360.IO命名空间,在下文中一共展示了DJsIO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addFileToolStripMenuItem_Click
private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Multiselect = true;
ofd.Title = "Open Xbox Live Packages";
ofd.Filter = "";
if (ofd.ShowDialog() != DialogResult.OK)
return;
menuStrip1.Enabled = groupPanel1.Enabled = listBox1.Enabled = false;
progressBarX1.Value = 0;
progressBarX1.Maximum = ofd.FileNames.Length;
foreach (string x in ofd.FileNames)
{
DJsIO y = null;
try { y = new DJsIO(x, DJFileMode.Open, true); }
catch { progressBarX1.Value++; continue; }
if (!y.Accessed)
{
progressBarX1.Value++;
continue;
}
y.Position = 0;
if (y.ReadUInt32() == (uint)AllMagic.CON)
listBox1.Items.Add(x);
y.Dispose();
if (checkBoxX3.Checked)
fix(listBox1.Items.Count - 1);
progressBarX1.Value++;
}
menuStrip1.Enabled = groupPanel1.Enabled = listBox1.Enabled = true;
}
示例2: Package
internal Package(STFSPackage pk, bool readData = true, DJsIO dj = null)
{
this.package = pk;
this.dj = dj;
ReadData(readData, this);
}
示例3: MusicFile
/// <summary>
/// Initializes this object
/// </summary>
/// <param name="FileLocale"></param>
public MusicFile(string FileLocale)
{
xActive = true;
DJsIO xIO = new DJsIO(FileLocale, DJFileMode.Open, true);
if (!xIO.Accessed)
throw STFSExcepts.ParseError;
try
{
xIO.Position = 0;
xIO.IsBigEndian = true;
if (xIO.ReadUInt32() != 0x464D494D)
throw MusicExcepts.NotMusic;
xIO.Position = 0xC;
so = xIO.ReadString(StringForm.Unicode, 0x100);
al = xIO.ReadString(StringForm.Unicode, 0x100);
ar = xIO.ReadString(StringForm.Unicode, 0x100);
xIO.Position += 0x200;
ge = xIO.ReadString(StringForm.Unicode, 0x100);
IO = xIO;
xActive = false;
}
catch { xIO.Dispose(); throw STFSExcepts.ParseError; }
}
示例4: listView1_DragDrop
private void listView1_DragDrop(object sender, DragEventArgs e)
{
List<string> xData = new List<string>((string[])e.Data.GetData(DataFormats.FileDrop));
List<DJsIO> xIO = new List<DJsIO>();
for (int i = 0; i < xData.Count; i++)
{
DJsIO blah = new DJsIO(xData[i], DJFileMode.Open, true);
if (blah.Accessed)
xIO.Add(blah);
}
if (xIO.Count == 0)
return;
if (MessageBox.Show("Are you sure you want to add " + ((xIO.Count == 1) ? "this accessed file?" : ("these " + xIO.Count.ToString() + " accessed files?")), "Rawr?", MessageBoxButtons.YesNo) != DialogResult.Yes)
return;
foreach (DJsIO x in xIO)
xPackage.MakeFile(x.FileNameShort, x, ((FolderEntry)advTree1.SelectedNode.DataKey).EntryID, AddType.NoOverWrite);
xReturn_NodeClick(advTree1.SelectedNode, null);
}
示例5: addFileToolStripMenuItem_Click
private void addFileToolStripMenuItem_Click(object sender, EventArgs e)
{
DJsIO x = new DJsIO(DJFileMode.Open, "Open", "", true);
if (!x.Accessed)
return;
Renamer rename = new Renamer(x.FileNameShort, true);
if (rename.ShowDialog() != DialogResult.OK)
{
x.Close();
return;
}
xPackage.MakeFile(rename.FileName, x, ((FolderEntry)advTree1.SelectedNode.DataKey).EntryID, AddType.NoOverWrite);
Log("Done adding");
}
示例6: KerberosDecrypt
/// <summary>
/// Runs a Kerberos implemented RC4 decryption
/// </summary>
/// <param name="xConfounder">The confounder input</param>
/// <param name="xPayload">The payload input</param>
/// <param name="x">RC4 reference</param>
/// <param name="xData">Data to be decrypted</param>
/// <param name="xConLen">Length of the Confounder</param>
/// <returns></returns>
public static bool KerberosDecrypt(this RC4 x, byte[] xData, out byte[] xConfounder, int xConLen, out byte[] xPayload)
{
xPayload = new byte[0];
xConfounder = new byte[0];
try
{
DJsIO xOut = new DJsIO(x.RunAlgorithm(xData), true);
xOut.Position = 0;
xConfounder = xOut.ReadBytes(xConLen);
xPayload = xOut.ReadBytes(xData.Length - xConLen);
xOut.Dispose();
}
catch { return false; }
return true;
}
示例7: xExtract
bool xExtract(string xOut, bool Sub)
{
if (!VariousFunctions.xCheckDirectory(xOut))
return false;
FATXReadContents xread = xRead();
if (xread == null)
return false;
foreach (FATXFileEntry x in xread.Files)
{
DJsIO xIOOut = new DJsIO(xOut + "/" + x.Name, DJFileMode.Create, true);
if (!xIOOut.Accessed)
continue;
x.xExtract(ref xIOOut);
xIOOut.Dispose();
}
if (!Sub)
return true;
foreach (FATXFolderEntry x in xread.Folders)
x.xExtract(xOut + "/" + x.Name, Sub);
return true;
}
示例8: AddFile
/// <summary>
/// Adds a file
/// </summary>
/// <param name="FileName"></param>
/// <param name="FileLocation"></param>
/// <param name="xType"></param>
/// <returns></returns>
public bool AddFile(string FileName, string FileLocation, AddType xType)
{
FileName.IsValidXboxName();
if (xDrive.ActiveCheck())
return false;
DJsIO xIOIn = null;
try { xIOIn = new DJsIO(FileLocation, DJFileMode.Open, true); }
catch { return (xDrive.xActive = false); }
try
{
FATXReadContents xconts = xRead();
foreach (FATXFileEntry x in xconts.xfiles)
{
if (x.Name == FileName)
{
bool xreturn = false;
if (xType == AddType.NoOverWrite)
return (xDrive.xActive = false);
else if (xType == AddType.Inject)
xreturn = x.xInject(xIOIn);
else xreturn = x.xReplace(xIOIn);
return (xreturn & !(xDrive.xActive = false));
}
}
uint xnew = 0;
long xpos = GetNewEntryPos(out xnew);
if (xpos == -1)
return (xDrive.xActive = false);
uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), xnew + 1);
if (blocks.Length == 0)
return (xDrive.xActive = false);
if (!Partition.WriteFile(blocks, ref xIOIn))
return (xDrive.xActive = false);
FATXEntry y = new FATXEntry(FileName, blocks[0], (int)xIOIn.Length, xpos, false, ref xDrive);
if (!y.xWriteEntry())
return (xDrive.xActive = false);
if (xnew > 0)
{
List<uint> fileblocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
fileblocks.Add(xnew);
uint[] xtemp = fileblocks.ToArray();
if (!Partition.xTable.WriteChain(ref xtemp))
return (xDrive.xActive = false);
}
if (!Partition.xTable.WriteChain(ref blocks))
return (xDrive.xActive = false);
if (Partition.WriteAllocTable())
return !(xDrive.xActive = false);
return (xDrive.xActive = false);
}
catch { xIOIn.Close(); return (xDrive.xActive = false); }
}
示例9: xInject
internal bool xInject(DJsIO xIOIn)
{
List<uint> blocks = new List<uint>(Partition.xTable.GetBlocks(xStartBlock));
if (blocks.Count == 0)
throw new Exception();
uint xct = xIOIn.BlockCountFATX(Partition);
if (blocks.Count < xct)
{
uint[] blocks2 = Partition.xTable.GetNewBlockChain((uint)(xct - blocks.Count), 1);
if (blocks2.Length == 0)
throw new Exception();
blocks.AddRange(blocks2);
uint[] x = blocks.ToArray();
if (!Partition.xTable.WriteChain(ref x))
throw new Exception();
}
else if (blocks.Count > xct)
{
uint[] xUnneeded = new uint[blocks.Count - xct];
for (uint i = xct; i < blocks.Count; i++)
{
xUnneeded[(int)i] = i;
blocks.RemoveAt((int)i--);
}
if (!Partition.xTable.DC(ref xUnneeded))
throw new Exception();
}
xIOIn.Position = 0;
xDrive.GetIO();
foreach (uint i in blocks)
{
xDrive.xIO.Position = Partition.BlockToOffset(i);
xDrive.xIO.Write(xIOIn.ReadBytes(Partition.xBlockSize));
}
if ((xSize == 0 || (uint)(((xSize - 1) / Partition.xBlockSize) + 1) != xct) &&
!Partition.WriteAllocTable())
throw new Exception();
xSize = (int)xIOIn.Length;
xIOIn.Close();
return xWriteEntry();
}
示例10: extractimg
bool extractimg(DJsIO xIOOut)
{
extthrd(xIOOut);
//System.Threading.Thread x = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(extthrd));
// x.Start(xIOOut);
//while (x.IsAlive)
// System.Windows.Forms.Application.DoEvents();
if (xactive)
return (xactive = false);
return (!xactive);
}
示例11: ExtractImage
/// <summary>
/// Extract a binary image of your FATX Drive
/// </summary>
/// <param name="xIOOut"></param>
/// <returns></returns>
public bool ExtractImage(DJsIO xIOOut)
{
if (ActiveCheck())
return false;
return extractimg(xIOOut);
}
示例12: FATXDrive
/// <summary>
/// Read a FATX Image
/// </summary>
/// <param name="xImage"></param>
public FATXDrive(DJsIO xImage)
{
if (xImage == null || !xImage.Accessed)
return;
if (!FATXManagement.IsFATX(ref xImage, out xType))
throw new Exception("Drive is not FATX");
xIO = xImage;
LoadPartitions();
}
示例13: Replace
/// <summary>
/// Replace the file
/// </summary>
/// <param name="FileIn"></param>
/// <returns></returns>
public bool Replace(string FileIn)
{
if (xDrive.ActiveCheck())
return false;
DJsIO xIOIn = null;
try { xIOIn = new DJsIO(FileIn, DJFileMode.Open, true); }
catch { return (xDrive.xActive = false); }
if (xIOIn == null || !xIOIn.Accessed)
return (xDrive.xActive = false);
return xReplace(xIOIn) & !(xDrive.xActive = false);
}
示例14: AddFile
public bool AddFile(string FileName, byte[] fileData, AddType xType)
{
if (!VariousFunctions.IsValidXboxName(FileName))
return false;
if (xDrive.ActiveCheck())
return false;
DJsIO xIOIn = null;
byte[] b = fileData;
xIOIn = new DJsIO(b, true);
try
{
FATXReadContents xconts = xRead();
foreach (FATXFileEntry x in xconts.xfiles)
{
if (string.Compare(x.Name, FileName, true) == 0)
{
bool xreturn = false;
if (xType == AddType.NoOverWrite)
{
xIOIn.Close();
return (xDrive.xActive = false);
}
else if (xType == AddType.Inject)
{
xreturn = x.xInject(xIOIn);
}
else
{
xreturn = x.xReplace(xIOIn);
}
xIOIn.Close();
return (xreturn & !(xDrive.xActive = false));
}
}
uint xnew = 0;
long xpos = GetNewEntryPos(out xnew);
if (xpos == -1)
return (xDrive.xActive = false);
var count = xIOIn.BlockCountFATX(Partition);
uint[] blocks = Partition.xTable.GetNewBlockChain(count, xnew + 1);
if (blocks.Length == 0)
return (xDrive.xActive = false);
if (!Partition.WriteFile(blocks, ref xIOIn))
return (xDrive.xActive = false);
FATXEntry y = new FATXEntry(this,
FileName,
blocks[0], (int)xIOIn.Length,
xpos, false, ref xDrive);
if (!y.xWriteEntry())
return (xDrive.xActive = false);
if (xnew > 0)
{
var filebx = Partition.xTable.GetBlocks(xStartBlock);
List<uint> fileblocks = new List<uint>(filebx);
fileblocks.Add(xnew);
uint[] xtemp = fileblocks.ToArray();
if (!Partition.xTable.WriteChain(ref xtemp))
return (xDrive.xActive = false);
}
if (!Partition.xTable.WriteChain(ref blocks))
return (xDrive.xActive = false);
if (Partition.WriteAllocTable())
return !(xDrive.xActive = false);
return (xDrive.xActive = false);
}
catch { xIOIn.Close(); return (xDrive.xActive = false); }
}
示例15: xReplace
internal bool xReplace(DJsIO xIOIn)
{
uint bu = xStartBlock;
int size = xSize;
try
{
uint[] curblocks = Partition.xTable.GetBlocks(xStartBlock);
uint[] blocks = Partition.xTable.GetNewBlockChain(xIOIn.BlockCountFATX(Partition), 1);
if (blocks.Length == 0)
throw new Exception();
if (!Partition.xTable.WriteChain(ref blocks))
throw new Exception();
if (!Partition.xTable.DC(ref curblocks))
throw new Exception();
xIOIn.Position = 0;
xDrive.GetIO();
if (!Partition.WriteFile(blocks, ref xIOIn))
throw new Exception();
if (!Partition.WriteAllocTable())
throw new Exception();
base.xStartBlock = blocks[0];
base.xSize = (int)xIOIn.Length;
xIOIn.Close();
return xWriteEntry();
}
catch { xIOIn.Close(); base.xStartBlock = bu; base.xSize = size; return false; }
}