Esempio n. 1
0
        public static byte[] InvertBytes(byte[] inByte)
        {
            long num = (long)Math.Round(Conversion.Val("&H" + ConversionUtils.BytesToHexString(inByte)));

            byte[] bytes = BitConverter.GetBytes((long)(-1L ^ num));
            return(new byte[] { bytes[1], bytes[0] });
        }
Esempio n. 2
0
        public static bool WriteBIN(DeviceFilterClass devFilter, string fileName)
        {
            bool flag;

            try
            {
                using (FileStream stream = File.Create(fileName))
                {
                    binWriter = new BinaryWriter(stream);
                    binWriter.Write(0x17042013);
                    binWriter.Write(ConversionUtils.BytesToHexString(Encoding.UTF8.GetBytes(devFilter._displayName)));
                    binWriter.Write(ConversionUtils.BytesToHexString(Encoding.UTF8.GetBytes(devFilter._partToDisp)));
                    binWriter.Write(ConversionUtils.BytesToHexString(Encoding.UTF8.GetBytes(devFilter._description)));
                    binWriter.Write(0x30091989);
                    binWriter.Close();
                }
                flag = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Error writing binary file!", MsgBoxStyle.Critical, null);
                flag = false;
                ProjectData.ClearProjectError();
            }
            return(flag);
        }
Esempio n. 3
0
        public Command WriteNVItem(int item, string value)
        {
            string strConsoleOut = "DIAG_NV_WRITE - Item: " + item.ToString();

            byte[] commandPrefixArray = ConversionUtils.HexStringToBytes("27" + this.ProcessNVItem(item, 4) + value);
            return(new Command(HelperUtils.BuildTermCommand(CommandByteArrays.nullCmd_133_length, commandPrefixArray, HelperUtils.BuildDataArray("0")), strConsoleOut));
        }
Esempio n. 4
0
 public static byte[] FlipByteArray(byte[] inByteArray)
 {
     byte[] testBytes;
     try
     {
         string strInput = "";
         string str      = ConversionUtils.BytesToHexString(inByteArray);
         int    num2     = str.Length - 1;
         for (int i = 0; i <= num2; i++)
         {
             string str3 = FlipByteBitsToString(Conversions.ToString(str[i]));
             string str4 = FlipByteBitsToString(Conversions.ToString(str[i + 1]));
             strInput = strInput + str4 + str3;
             i++;
         }
         testBytes = ConversionUtils.HexStringToBytes(strInput);
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Interaction.MsgBox("Error Flipping Byte Array!", MsgBoxStyle.Critical, null);
         testBytes = CRC.testBytes;
         ProjectData.ClearProjectError();
     }
     return(testBytes);
 }
Esempio n. 5
0
        public static byte[] GenerateNSizeArray(int n)
        {
            string strInput = "";
            int    num2     = n;

            for (int i = 0; i <= num2; i++)
            {
                strInput = strInput + "00";
            }
            return(ConversionUtils.HexStringToBytes(strInput));
        }
 public override object Decode()
 {
     if (this.CurrentQCDMCommand == Qcdm.Cmd.DIAG_NV_READ_F)
     {
         return(ConversionUtils.BytesToHexString(HelperUtils.GetByteArray(this.BytesRX, 3, 7)));
     }
     if (this.CurrentQCDMCommand == Qcdm.Cmd.DIAG_NV_WRITE_F)
     {
         return(ConversionUtils.BytesToHexString(this.BytesRX));
     }
     return("-1");
 }
Esempio n. 7
0
 public NVItem(Command cmd)
 {
     try
     {
         string str2;
         string str3;
         if (cmd.ErrorResponse == Qcdm.NV_Response.NV_ERR_BAD_SECURITY_MODE)
         {
             str2 = ConversionUtils.BytesToHexString(cmd.BytesTX).Substring(4, 2);
             str3 = ConversionUtils.BytesToHexString(cmd.BytesTX).Substring(2, 2);
         }
         else
         {
             str2 = ConversionUtils.BytesToHexString(cmd.BytesRX).Substring(4, 2);
             str3 = ConversionUtils.BytesToHexString(cmd.BytesRX).Substring(2, 2);
         }
         long num = long.Parse(str2 + str3, NumberStyles.HexNumber);
         this._itemNumber = num;
         if (cmd.ErrorResponse == Qcdm.NV_Response.NV_ERR_BAD_PARAM)
         {
             this._itemStatus = NVStatus.BadParameter;
             this._itemData   = "";
         }
         else if (cmd.ErrorResponse == Qcdm.NV_Response.NV_ERR_BAD_SECURITY_MODE)
         {
             this._itemStatus = NVStatus.AccessDenied;
             this._itemData   = "";
         }
         else if (cmd.ErrorResponse == Qcdm.NV_Response.NV_ERR_INACTIVE_NV_ITEM)
         {
             this._itemStatus = NVStatus.InactiveItem;
             this._itemData   = "";
         }
         else
         {
             this._itemStatus = NVStatus.Okay;
         }
         if (this._itemStatus == NVStatus.Okay)
         {
             this._itemData = ConversionUtils.BytesToHexString(cmd.BytesRX).Substring(6, 0x100);
         }
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         Interaction.MsgBox("Error Parsing NV Item!", MsgBoxStyle.Critical, null);
         ProjectData.ClearProjectError();
     }
 }
 public override object Decode()
 {
     using (MemoryStream stream = new MemoryStream(this.BytesRX))
     {
         using (BinaryReader reader = new BinaryReader(stream))
         {
             if (stream.Length <= 3L)
             {
                 return(new DIAG_VERNO_F_CLS("-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1", "-1"));
             }
             reader.BaseStream.Position = 1L;
             this.compileDate           = ConversionUtils.GetASCIIString(reader.ReadBytes(11));
             this.compileTime           = ConversionUtils.GetASCIIString(reader.ReadBytes(8));
             this.releaseDate           = ConversionUtils.GetASCIIString(reader.ReadBytes(11));
             this.releaseTime           = ConversionUtils.GetASCIIString(reader.ReadBytes(8));
             this.verDir           = ConversionUtils.GetASCIIString(reader.ReadBytes(8));
             this.stationClassMark = Conversions.ToString(reader.ReadByte());
             if (File.Exists(this.fileMobCAIRev))
             {
                 this.mobCAIRev = HelperUtils.GetEnumValue(reader.ReadByte(), this.fileMobCAIRev, EnumFileParser.ParseType.Dec);
             }
             else
             {
                 this.mobCAIRev = Conversions.ToString(reader.ReadByte());
             }
             if (File.Exists(this.fileMobModel))
             {
                 this.mobModel = HelperUtils.GetEnumValue(reader.ReadByte(), this.fileMobModel, EnumFileParser.ParseType.Dec);
             }
             else
             {
                 this.mobModel = Conversions.ToString(reader.ReadByte());
             }
             this.mobFWRev       = Conversions.ToString((int)reader.ReadInt16());
             this.slotCycleIndex = reader.ReadByte().ToString();
             if (File.Exists(this.fileMSMRev))
             {
                 this.msmRev = HelperUtils.GetEnumValue(ConversionUtils.BytesToHexString(reader.ReadBytes(2).Reverse <byte>().ToArray <byte>()), this.fileMSMRev, EnumFileParser.ParseType.Hex);
             }
             else
             {
                 this.msmRev = "0x" + ConversionUtils.BytesToHexString(reader.ReadBytes(2).Reverse <byte>().ToArray <byte>());
             }
             return(new DIAG_VERNO_F_CLS(this.compileDate, this.compileTime, this.releaseDate, this.releaseTime, this.verDir, this.stationClassMark, this.mobCAIRev, this.mobModel, this.mobFWRev, this.slotCycleIndex, this.msmRev));
         }
     }
 }
Esempio n. 9
0
 public override object Decode()
 {
     using (MemoryStream stream = new MemoryStream(this.BytesRX))
     {
         using (BinaryReader reader = new BinaryReader(stream))
         {
             if (stream.Length <= 3L)
             {
                 return(new DIAG_EXT_BUILD_ID_F_CLS("-1", "-1", "-1"));
             }
             reader.BaseStream.Position = 1L;
             byte[] byteInput = reader.ReadBytes(3).Reverse <byte>().ToArray <byte>();
             this.reserved = "0x00" + ConversionUtils.BytesToHexString(byteInput);
             byteInput     = BitConverter.GetBytes(reader.ReadInt32()).Reverse <byte>().ToArray <byte>();
             if (File.Exists(this.fileMSMHWRev))
             {
                 this.msmHWRev = HelperUtils.GetEnumValue(ConversionUtils.BytesToHexString(byteInput), this.fileMSMHWRev, EnumFileParser.ParseType.Hex);
             }
             else
             {
                 this.msmHWRev = "0x" + ConversionUtils.BytesToHexString(byteInput);
             }
             if (File.Exists(this.fileMobModelID))
             {
                 this.mobModelID = HelperUtils.GetEnumValue(reader.ReadInt32(), this.fileMobModelID, EnumFileParser.ParseType.Dec);
             }
             else
             {
                 this.mobModelID = Conversions.ToString(reader.ReadInt32());
             }
             List <byte> list = new List <byte>();
             while (reader.BaseStream.Position < (reader.BaseStream.Length - 1L))
             {
                 byte num = reader.ReadByte();
                 if (Convert.ToChar(num) == '\0')
                 {
                     break;
                 }
                 list.Add(num);
             }
             this.mobSWRev = ConversionUtils.GetASCIIString(list.ToArray());
             return(new DIAG_EXT_BUILD_ID_F_CLS(this.msmHWRev, this.mobModelID, this.mobSWRev));
         }
     }
 }
Esempio n. 10
0
        public override object Decode()
        {
            object obj2;

            try
            {
                string str  = ConversionUtils.BytesToHexString(this.BytesRX);
                string str2 = "";
                obj2 = str2 + Conversions.ToString(str[7]) + Conversions.ToString(str[9]) + Conversions.ToString(str[11]) + Conversions.ToString(str[13]);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                obj2 = "-1";
                ProjectData.ClearProjectError();
            }
            return(obj2);
        }
Esempio n. 11
0
        public static bool ReadBIN(string fileName, ref DeviceFilterClass devFilter)
        {
            bool flag;

            try
            {
                string str;
                string str2;
                string str3;
                using (FileStream stream = File.OpenRead(fileName))
                {
                    binReader = new BinaryReader(stream);
                    if (binReader.ReadInt32() != 0x17042013)
                    {
                        Interaction.MsgBox("Device Filter contains an invalid header!", MsgBoxStyle.Critical, null);
                        return(false);
                    }
                    str2 = Encoding.UTF8.GetString(ConversionUtils.HexStringToBytes(binReader.ReadString()));
                    str3 = Encoding.UTF8.GetString(ConversionUtils.HexStringToBytes(binReader.ReadString()));
                    str  = Encoding.UTF8.GetString(ConversionUtils.HexStringToBytes(binReader.ReadString()));
                    binReader.BaseStream.Position = binReader.BaseStream.Length - 4L;
                    if (binReader.ReadInt32() != 0x30091989)
                    {
                        Interaction.MsgBox("Device Filter contains an invalid signature!", MsgBoxStyle.Critical, null);
                        return(false);
                    }
                    binReader.Close();
                }
                devFilter = new DeviceFilterClass(fileName, str2, str3, str);
                flag      = true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                Interaction.MsgBox("Error reading binary file!", MsgBoxStyle.Critical, null);
                flag = false;
                ProjectData.ClearProjectError();
            }
            return(flag);
        }
Esempio n. 12
0
        public Command ReadNVItem(int item)
        {
            string strConsoleOut = "DIAG_NV_WRITE - Item: " + item.ToString();

            byte[]      buffer3 = new byte[3];
            byte[]      buffer2 = ConversionUtils.HexStringToBytes("26" + this.ProcessNVItem(item, 6));
            List <byte> list    = new List <byte>();

            foreach (byte num in buffer2)
            {
                list.Add(num);
            }
            while (list.Count < 0x85)
            {
                list.Add(0);
            }
            byte[] cRCAsByteFromByte = CRC.GetCRCAsByteFromByte(list.ToArray());
            list.Add(cRCAsByteFromByte[0]);
            list.Add(cRCAsByteFromByte[1]);
            list.Add(0x7e);
            return(new Command(list.ToArray(), strConsoleOut));
        }
        public override object Decode()
        {
            object obj2;

            try
            {
                if (this.BytesRX[0] == 0x42)
                {
                    Interaction.MsgBox("Error! SPC Not Found!", MsgBoxStyle.Critical, null);
                    return("-1");
                }
                string str  = ConversionUtils.BytesToHexString(this.BytesRX);
                string str2 = "";
                obj2 = str2 + Conversions.ToString(str[7]) + Conversions.ToString(str[9]) + Conversions.ToString(str[11]) + Conversions.ToString(str[13]) + Conversions.ToString(str[15]) + Conversions.ToString(str[0x11]);
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                obj2 = "-1";
                ProjectData.ClearProjectError();
            }
            return(obj2);
        }
Esempio n. 14
0
 public static byte[] GetBufferWithCRC(string s) =>
 GetBufferWithCRC(ConversionUtils.HexStringToBytes(s), (int)Math.Round((double)(((double)s.Length) / 2.0)));
Esempio n. 15
0
        public static string GetCRCAsStringFromString(string incomingString)
        {
            CDMACRC cdmacrc = new CDMACRC(CDMACRC.InitialCrcValue.NonZero1);

            return(ConversionUtils.BytesToHexString(FlipByteArray(InvertBytes(cdmacrc.ComputeChecksumBytes(FlipByteArray(ConversionUtils.HexStringToBytes(incomingString)))))));
        }
        private void ProcessCommandQueue(AsyncOperation asyncOp)
        {
            this._isBusy        = true;
            this._commandOutput = new ArrayList();
            long      count          = this.GetCount();
            long      num2           = 0L;
            long      position       = 0L;
            string    consoleTX      = string.Empty;
            string    consoleRX      = string.Empty;
            string    consoleRXASCII = string.Empty;
            Exception exc            = null;

            try
            {
                object syncRoot = this.cmdQueue.SyncRoot;
                ObjectFlowControl.CheckForSyncLockOnValueType(syncRoot);
                lock (syncRoot)
                {
                    while (this.cmdQueue.Count != 0)
                    {
                        if (this.Cancelled())
                        {
                            this.CompletionMethod(null, true, asyncOp);
                            return;
                        }
                        Command command = (Command)this.cmdQueue.Dequeue();
                        this._qcdmCmd.Add(command.CurrentQCDMCommand);
                        this._nvCmd.Add(command.CurrentNVItem);
                        if (!command.TransmitTX(this._instance, asyncOp))
                        {
                            throw new Exception("Phone connection has been lost!");
                        }
                        object objectValue = RuntimeHelpers.GetObjectValue(command.Decode());
                        if (command.BytesRX.Length == 0x88)
                        {
                            this._errorResponse.Add((Qcdm.NV_Response)command.BytesRX[0x83]);
                        }
                        else if (command.BytesRX.Length == 0x89)
                        {
                            this._errorResponse.Add((Qcdm.NV_Response)command.BytesRX[0x84]);
                        }
                        else if (command.BytesRX.Length < 0x88)
                        {
                            this._errorResponse.Add((Qcdm.NV_Response)command.BytesRX[0]);
                        }
                        if (objectValue == null)
                        {
                            throw new Exception("Error decoding command output!");
                        }
                        this._commandOutput.Add(RuntimeHelpers.GetObjectValue(objectValue));
                        if (!this._disableLogging && !string.IsNullOrEmpty(command.ConsoleOutput))
                        {
                            consoleTX      = ConversionUtils.FormatHexStr(ConversionUtils.BytesToHexString(command.BytesTX));
                            consoleRX      = ConversionUtils.FormatHexStr(ConversionUtils.BytesToHexString(command.BytesRX));
                            consoleRXASCII = ConversionUtils.GetASCIIString(command.BytesRX);
                        }
                        position += 1L;
                        CommandQueueProgressChangedEventArgs arg = new CommandQueueProgressChangedEventArgs(command.ConsoleOutput, consoleTX, consoleRX, consoleRXASCII, (int)command.CurrentNVItem, (int)position, (int)count, (int)Math.Round((double)((((float)position) / ((float)count)) * 100f)), RuntimeHelpers.GetObjectValue(asyncOp.UserSuppliedState));
                        asyncOp.Post(this.onProgressReportDelegate, arg);
                    }
                }
                if (this._chkNVItems)
                {
                    position = 0L;
                    long   badParamNVItems = 0L;
                    long   badSecNVItems   = 0L;
                    long   inactiveNVItems = 0L;
                    long   okayNVItems     = 0L;
                    object expression      = this.cmdNVQueue.SyncRoot;
                    ObjectFlowControl.CheckForSyncLockOnValueType(expression);
                    lock (expression)
                    {
                        IEnumerator enumerator;
                        try
                        {
                            enumerator = this.cmdNVQueue.GetEnumerator();
                            while (enumerator.MoveNext())
                            {
                                byte    num6;
                                Command current = (Command)enumerator.Current;
                                if (this.Cancelled())
                                {
                                    this.CompletionMethod(null, true, asyncOp);
                                    return;
                                }
                                if (current.BytesRX.Length == 0x88)
                                {
                                    num6 = current.BytesRX[0x83];
                                }
                                else if (current.BytesRX.Length == 0x89)
                                {
                                    num6 = current.BytesRX[0x84];
                                }
                                else if (current.BytesRX.Length < 0x88)
                                {
                                    num6 = current.BytesRX[0];
                                }
                                if (((num6 == 20) | (num6 == 5)) | (num6 == 6))
                                {
                                    current.ErrorResponse = (Qcdm.NV_Response)num6;
                                    num2 += 1L;
                                }
                            }
                        }
                        finally
                        {
                            if (enumerator is IDisposable)
                            {
                                (enumerator as IDisposable).Dispose();
                            }
                        }
                    }
                    object obj5 = this.cmdNVQueue.SyncRoot;
                    ObjectFlowControl.CheckForSyncLockOnValueType(obj5);
                    lock (obj5)
                    {
                        IEnumerator enumerator2;
                        if (string.IsNullOrEmpty(this._fileName))
                        {
                            throw new FileNotFoundException();
                        }
                        StreamWriter writer = new StreamWriter(this.FileName, false);
                        writer.Write("[NV items]\r\n");
                        writer.Write(("[Complete items - " + ((count - num2)).ToString() + ", Items size - 128]") + "\r\n\r\n");
                        try
                        {
                            enumerator2 = this.cmdNVQueue.GetEnumerator();
                            while (enumerator2.MoveNext())
                            {
                                string        str6;
                                Command       command3 = (Command)enumerator2.Current;
                                List <string> list     = new List <string>();
                                if (command3.BytesRX[0] == 20)
                                {
                                    str6 = ConversionUtils.BytesToHexString(command3.BytesTX).Substring(2, 4);
                                }
                                else
                                {
                                    str6 = ConversionUtils.BytesToHexString(command3.BytesRX).Substring(2, 4);
                                }
                                string s    = ConversionUtils.ReverseHex(str6).Replace(" ", "");
                                long   num9 = long.Parse(s, NumberStyles.HexNumber);
                                if (command3.ErrorResponse == Qcdm.NV_Response.NV_ERR_BAD_PARAM)
                                {
                                    writer.Write((num9.ToString("d5") + " (0x" + s + ")   -   Parameter bad") + "\r\n\r\n");
                                    badParamNVItems += 1L;
                                }
                                else if (command3.ErrorResponse == Qcdm.NV_Response.NV_ERR_BAD_SECURITY_MODE)
                                {
                                    writer.Write((num9.ToString("d5") + " (0x" + s + ")   -   Access denied") + "\r\n\r\n");
                                    badSecNVItems += 1L;
                                }
                                else if (command3.ErrorResponse == Qcdm.NV_Response.NV_ERR_INACTIVE_NV_ITEM)
                                {
                                    writer.Write((num9.ToString("d5") + " (0x" + s + ")   -   Inactive item") + "\r\n\r\n");
                                    inactiveNVItems += 1L;
                                }
                                else
                                {
                                    string str11 = ConversionUtils.BytesToHexString(command3.BytesRX).Substring(6, 0x100);
                                    writer.Write((num9.ToString("d5") + " (0x" + s + ")   -   OK") + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0x20, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0x40, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0x60, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0x40, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(80, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0x60, 0x20)) + "\r\n");
                                    writer.Write(ConversionUtils.FormatHexStr(str11.Substring(0x80, 0x20)) + "\r\n\r\n");
                                    okayNVItems += 1L;
                                }
                                position += 1L;
                                NVItemsStatusEventArgs args2 = new NVItemsStatusEventArgs(position, badParamNVItems, badSecNVItems, inactiveNVItems, okayNVItems, count, (long)Math.Round((double)((((float)position) / ((float)count)) * 100f)));
                                asyncOp.Post(this.onNVItemsStatusDelegate, args2);
                            }
                        }
                        finally
                        {
                            if (enumerator2 is IDisposable)
                            {
                                (enumerator2 as IDisposable).Dispose();
                            }
                        }
                        writer.Close();
                    }
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                exc = exception1;
                ProjectData.ClearProjectError();
            }
            this.CompletionMethod(exc, this.Cancelled(), asyncOp);
        }
Esempio n. 17
0
        public void DoRestoreNVItems()
        {
            long         position    = 0L;
            long         totalLength = 0L;
            int          num         = 0;
            int          num2        = 0;
            int          num4        = 0;
            int          num5        = 0;
            StreamReader reader      = new StreamReader(this._writeNVItems.FileName);
            ArrayList    list        = new ArrayList();

            totalLength = reader.BaseStream.Length;
            while (reader.Peek() != -1)
            {
                string str = reader.ReadLine();
                if (str.Contains("Parameter bad"))
                {
                    num++;
                }
                else if (str.Contains("Access denied"))
                {
                    num2++;
                }
                else if (str.Contains("Inactive item"))
                {
                    num4++;
                }
                else if (str.Contains("OK"))
                {
                    num5++;
                }
                list.Add(str);
                position = reader.BaseStream.Position;
                NVItemsStatusEventArgs arg = new NVItemsStatusEventArgs(position, (long)num, (long)num2, (long)num4, (long)num5, totalLength, (long)Math.Round((double)((((float)position) / ((float)totalLength)) * 100f)));
                this._asyncOp.Post(this.onNVItemsStatusDelegate, arg);
            }
            reader.Close();
            this._writeNVItems.Dispose();
            if (Operators.ConditionalCompareObjectEqual(list[0], "[NV items]", false))
            {
                int num9 = list.Count - 1;
                for (int i = 3; i <= num9; i++)
                {
                    string left     = "";
                    string strInput = "";
                    string str2     = "";
                    int    num10    = Conversions.ToInteger(Operators.SubtractObject(NewLateBinding.LateGet(list[i], null, "IndexOf", new object[] { "(" }, null, null, null), 1));
                    for (int j = 0; j <= num10; j++)
                    {
                        left = Conversions.ToString(Operators.AddObject(left, NewLateBinding.LateIndexGet(list[i], new object[] { j }, null)));
                    }
                    if (list[i].ToString().Contains("OK"))
                    {
                        if (list[i + 1].ToString().Contains("|"))
                        {
                            str2     = list[i + 1].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 2].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 3].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 4].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 5].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 6].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 7].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                            str2     = list[i + 8].ToString();
                            strInput = strInput + str2.Remove(str2.IndexOf("|")).TrimEnd(new char[0]);
                        }
                        else
                        {
                            strInput = (((strInput + list[i + 1].ToString() + list[i + 2].ToString()) + list[i + 3].ToString() + list[i + 4].ToString()) + list[i + 5].ToString() + list[i + 6].ToString()) + list[i + 7].ToString() + list[i + 8].ToString();
                        }
                        strInput = strInput.Replace(" ", "");
                        string strConsoleOut = "DIAG_NV_READ_F, RestoreNVItems - " + left.ToString();
                        EFS_Professional.Command inCommand = new EFS_Professional.Command(Qcdm.Cmd.DIAG_NV_WRITE_F, ConversionUtils.HexStringToBytes(strInput), strConsoleOut);
                        this._myQueue.Add(ref inCommand);
                    }
                    i++;
                }
            }
            else
            {
                Interaction.MsgBox("Invalid NV Items file!", MsgBoxStyle.Critical, "Error!");
                return;
            }
            this._asyncOp.Post(this.onPrepareForRestoreCompleted, new EventArgs());
            this._asyncOp.OperationCompleted();
        }