/// <summary> /// Creates a copy of a rom with a given binary pattern /// </summary> /// <param name="inFile">the file to convert</param> /// <param name="inO">Endian order of the file</param> /// <param name="outFile">the stream to write the copy file</param> /// <param name="outO">Output file endian order</param> /// <returns>True if the copy was created. No copy will be created if inO == outO</returns> private static bool ConvertData(Stream inFile, Endian.Order inO, Stream outFile, Endian.Order outO) { Endian.Order outWord; outWord = (Endian.Order)((int)outO & 0x7F); if (inO == outO) { return(false); } if (inO == Endian.Order.Big16 && outO == Endian.Order.Big32) { FlipDataByHalfword(inFile, outFile); return(true); } //if word size does not match else if (((int)inO & 0x7F) != ((int)outO & 0x7F)) { return(false); } else { switch (outWord) { case Endian.Order.Big16: FlipData(inFile, outFile, 2); break; case Endian.Order.Big32: FlipData(inFile, outFile, 4); break; default: return(false); } return(true); } }
/// <summary> /// Creates a copy of a rom with a given binary pattern /// </summary> /// <param name="inFile">the file to convert</param> /// <param name="inO">Endian order of the file</param> /// <param name="outFile">the stream to write the copy file</param> /// <param name="outO">Output file endian order</param> /// <returns>True if the copy was created. No copy will be created if inO == outO</returns> private static bool ConvertData(Stream inFile, Endian.Order inO, Stream outFile, Endian.Order outO) { if (inO == outO) { return(false); } if (inO == Endian.Order.Big16 && outO == Endian.Order.Big32) { FlipDataByHalfword(inFile, outFile); return(true); } //if word size does not match else if (((int)inO & 0x7F) != ((int)outO & 0x7F)) { return(false); } else { if ((outO & Endian.Order.Size16) == Endian.Order.Size16) { FlipData(inFile, outFile, 2); } else if ((outO & Endian.Order.Size32) == Endian.Order.Size32) { FlipData(inFile, outFile, 4); } else { return(false); } return(true); } }