示例#1
0
        public void BackupNVItems(long fromRange, long toRange, long skipItemIndex = 0L)
        {
            this._myQueue.Clear();
            this._readNVItems = new SaveFileDialog();
            SaveFileDialog dialog = this._readNVItems;

            dialog.Filter   = "CDMA Workshop Files|*.txt";
            dialog.FileName = "*.txt";
            dialog          = null;
            if (this._readNVItems.ShowDialog() == DialogResult.Cancel)
            {
                this._readNVItems.Dispose();
            }
            else
            {
                this._myQueue.OperationMode  = OperationModes.Backup;
                this._myQueue.DisableLogging = true;
                this._myQueue.CheckNVItems   = true;
                this._myQueue.FileName       = this._readNVItems.FileName;
                this._readNVItems.Dispose();
                long num  = toRange - fromRange;
                long num3 = num + fromRange;
                for (long i = fromRange; i <= num3; i += 1L)
                {
                    string strConsoleOut = "DIAG_NV_READ_F, BackupNVItems - " + i.ToString() + " (" + Conversions.ToString(i) + ")";
                    if (this._enableNVISkip)
                    {
                        _Closure$__18 e$__ = new _Closure$__18 {
                            $VB$Local_currNV = i.ToString()
                        };
                        if (Array.Find <string>(this._nvItemSkipList[(int)skipItemIndex].NVItems.ToArray(), new Predicate <string>(e$__._Lambda$__122)) != e$__.$VB$Local_currNV)
                        {
                            EFS_Professional.Command inCommand = new EFS_Professional.Command(Qcdm.Cmd.DIAG_NV_READ_F, i, new byte[0], strConsoleOut);
                            this._myQueue.Add(ref inCommand);
                        }
                    }
                    else
                    {
                        EFS_Professional.Command command2 = new EFS_Professional.Command(Qcdm.Cmd.DIAG_NV_READ_F, i, new byte[0], strConsoleOut);
                        this._myQueue.Add(ref command2);
                    }
                }
                this._myQueue.Run(true);
            }
        }
示例#2
0
        public void BackupNVItems(List <string> nvList, long skipItemIndex = 0L)
        {
            this._myQueue.Clear();
            this._readNVItems = new SaveFileDialog();
            SaveFileDialog dialog = this._readNVItems;

            dialog.Filter   = "CDMA Workshop Files|*.txt";
            dialog.FileName = "*.txt";
            dialog          = null;
            if (this._readNVItems.ShowDialog() == DialogResult.Cancel)
            {
                this._readNVItems.Dispose();
            }
            else
            {
                this._myQueue.OperationMode  = OperationModes.Backup;
                this._myQueue.DisableLogging = true;
                this._myQueue.CheckNVItems   = true;
                this._myQueue.FileName       = this._readNVItems.FileName;
                this._readNVItems.Dispose();
                foreach (string str in nvList)
                {
                    long   num           = Conversions.ToLong(Enum.Parse(typeof(NVItemList), str));
                    string strConsoleOut = "DIAG_NV_READ_F, BackupNVItems - " + str + " (" + Conversions.ToString(num) + ")";
                    if (this._enableNVISkip)
                    {
                        _Closure$__19 e$__ = new _Closure$__19 {
                            $VB$Local_currNV = Conversions.ToString(num)
                        };
                        if (Array.Find <string>(this._nvItemSkipList[(int)skipItemIndex].NVItems.ToArray(), new Predicate <string>(e$__._Lambda$__123)) != e$__.$VB$Local_currNV)
                        {
                            EFS_Professional.Command inCommand = new EFS_Professional.Command(Qcdm.Cmd.DIAG_NV_READ_F, num, new byte[0], strConsoleOut);
                            this._myQueue.Add(ref inCommand);
                        }
                    }
                    else
                    {
                        EFS_Professional.Command command2 = new EFS_Professional.Command(Qcdm.Cmd.DIAG_NV_READ_F, num, new byte[0], strConsoleOut);
                        this._myQueue.Add(ref command2);
                    }
                }
                this._myQueue.Run(true);
            }
        }
示例#3
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();
        }