Ejemplo n.º 1
0
    public static void GetSegmentAddresses(byte[] buf, PCMinfo P)
    {
        PcmSegments[1].Start  = 0;
        PcmSegments[1].Length = 0x4000;
        PcmSegments[0].Start  = 0x020000;
        if (P.Type == "P59")
        {
            PcmSegments[0].Length = 0xDFFFE;
        }
        else
        {
            PcmSegments[0].Length = 0x5FFFE;
        }
        //EEprom Data:
        PcmSegments[9].Start  = 0x4000;
        PcmSegments[9].Length = 0x4000;

        PcmSegments[1].PN  = BEToUint32(buf, 0x504);
        PcmSegments[1].Ver = System.Text.Encoding.ASCII.GetString(buf, 0x508, 2);

        //Read Segment Addresses from bin, starting at 0x514
        uint offset = 0x514;

        for (int s = 2; s <= 8; s++)
        {
            PcmSegments[s].Start = BEToUint32(buf, offset);
            offset += 4;
            PcmSegments[s].Length = BEToUint32(buf, offset) - PcmSegments[s].Start + 1;
            offset += 4;
            if (PcmSegments[s].Start > P.BinSize || (PcmSegments[s].Start + PcmSegments[s].Length) > P.BinSize)
            {
                throw new Exception("Error: Corrupted file!");
            }
        }
    }
Ejemplo n.º 2
0
    public static string PcmFileInfo(string FileName)
    {
        PCMinfo P = GetPcmType(FileName);

        if (P.Type == "Unknown")
        {
            return("Unknow file");
        }
        byte[] buf = new byte[P.BinSize];
        buf = ReadBin(FileName, 0, P.BinSize);
        return(PcmBufInfo(buf, P));
    }
Ejemplo n.º 3
0
    public static string PcmBufInfo(byte[] buf, PCMinfo P)
    {
        GetSegmentAddresses(buf, P);
        GetSegmentInfo(buf);
        string Finfo = "PCM Model: ".PadRight(20) + P.Model + Environment.NewLine + Environment.NewLine;

        Finfo += " ".PadLeft(20) + "* Segments *" + Environment.NewLine;
        for (int i = 1; i <= 8; i++)
        {
            Finfo += globals.PcmSegments[i].Name.PadRight(15) + globals.PcmSegments[i].PN.ToString().PadRight(8) + " " + globals.PcmSegments[i].Ver;
            Finfo += " Size: " + globals.PcmSegments[i].Length.ToString().PadRight(5) + " (0x" + globals.PcmSegments[i].Length.ToString("X4") + ")" + Environment.NewLine;
        }
        Finfo += Environment.NewLine;
        Finfo += " ".PadLeft(15) + "* Eeprom_data *" + Environment.NewLine + globals.GetEEpromInfo(buf);
        Finfo += "VIN".PadRight(15) + globals.GetVIN(buf) + Environment.NewLine + Environment.NewLine;
        Finfo += GetChecksumStatus(buf);
        return(Finfo);
    }