Example #1
0
 public static void AskPCMModel(ref PCMData PCM, bool P01)
 {
     PCMBinBuilder.frmPCMModel frmP = new PCMBinBuilder.frmPCMModel();
     if (P01)
     {
         frmP.radioP59.Visible = false;
     }
     if (frmP.ShowDialog() == DialogResult.OK)
     {
         if (frmP.radioP59.Checked)
         {
             PCM.Type       = "P59";
             PCM.Model      = "P59";
             PCM.BinSize    = (512 * 1024);
             PCM.EepromType = 2001;
         }
         else if (frmP.radioP01.Checked)
         {
             PCM.Type       = "P01";
             PCM.BinSize    = (512 * 1024);
             PCM.Model      = "P01(01-03)";
             PCM.EepromType = 2001;
         }
         else if (frmP.radioP0199.Checked)
         {
             PCM.Type       = "P01";
             PCM.BinSize    = (512 * 1024);
             PCM.Model      = "P01(99-00)";
             PCM.EepromType = 1999;
         }
     }
     frmP.Dispose();
 }
Example #2
0
    public static PCMinfo GetPcmType(string FileName)
    {
        PCMinfo tmp;

        tmp.Type       = "Unknown";
        tmp.BinSize    = 0;
        tmp.Model      = "";
        tmp.EepromType = 0;

        long fsize = new System.IO.FileInfo(FileName).Length;

        if (fsize != (512 * 1024) && fsize != (1024 * 1024) && fsize != 16384)
        {
            return(tmp);
        }
        if (fsize == (512 * 1024)) //P01
        {
            tmp.Type    = "P01";
            tmp.BinSize = (512 * 1024);
            byte[] buf = ReadBin(FileName, 0, (uint)fsize);
            tmp.EepromType = GetModelFromEeprom(buf);
            if (tmp.EepromType == 1999)
            {
                tmp.Model = "P01(99-00)";
            }
            else
            {
                tmp.Model = "P01(01-03)";
            }
        }
        if (fsize == (1024 * 1024)) //P59
        {
            tmp.Type       = "P59";
            tmp.Model      = "P59";
            tmp.BinSize    = (1024 * 1024);
            tmp.EepromType = 2001;
        }
        if (fsize == 16384) //OS segment
        {
            if (Path.GetFileName(FileName).EndsWith("ossegment1") && Path.GetFileName(FileName).StartsWith("P59"))
            {
                tmp.Type       = "P59";
                tmp.Model      = "P59";
                tmp.BinSize    = (1024 * 1024);
                tmp.EepromType = 2001;
            }
            else if (Path.GetFileName(FileName).EndsWith("ossegment1") && Path.GetFileName(FileName).StartsWith("P01(01-03)"))
            {
                tmp.Type       = "P01";
                tmp.BinSize    = (512 * 1024);
                tmp.Model      = "P01(01-03)";
                tmp.EepromType = 2001;
            }
            else if (Path.GetFileName(FileName).EndsWith("ossegment1") && Path.GetFileName(FileName).StartsWith("P01(99-00)"))
            {
                tmp.Type       = "P01";
                tmp.BinSize    = (512 * 1024);
                tmp.Model      = "P01(99-00)";
                tmp.EepromType = 1999;
            }
            else
            {
                PCMBinBuilder.frmPCMModel frmP = new PCMBinBuilder.frmPCMModel();
                if (frmP.ShowDialog() == DialogResult.OK)
                {
                    if (frmP.radioP59.Checked)
                    {
                        tmp.Type       = "P59";
                        tmp.Model      = "P59";
                        tmp.BinSize    = (512 * 1024);
                        tmp.EepromType = 2001;
                    }
                    else if (frmP.radioP01.Checked)
                    {
                        tmp.Type       = "P01";
                        tmp.BinSize    = (512 * 1024);
                        tmp.Model      = "P01(01-03)";
                        tmp.EepromType = 2001;
                    }
                    else if (frmP.radioP0199.Checked)
                    {
                        tmp.Type       = "P01";
                        tmp.BinSize    = (512 * 1024);
                        tmp.Model      = "P01(99-00)";
                        tmp.EepromType = 1999;
                    }
                }
            }
        }
        return(tmp);
    }