Exemplo n.º 1
0
        private void bntnReadMemory_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            try
            {
                mbSession.SetAttributeBoolean(AttributeType.DmaAllowEn, true);
                var    cmd            = "DB" + (radioButton2.Checked ? "A" : "B") + "?";//ToDo: Rename Radio
                var    responseString = mbSession.Query(cmd);
                byte[] toBytes        = Encoding.ASCII.GetBytes(responseString);
                string something      = Encoding.ASCII.GetString(toBytes);

                // tmpByteArray = mbSession.ReadByteArray(1024);
                //.ReadToFile("martin");
                //var a = mbSession.ReadString(1024);

                //string textToWrite = ReplaceCommonEscapeSequences(writeTextBox.Text);

                readTextBox.Text = InsertCommonEscapeSequences(responseString);
                if (checkBoxLog.Checked)
                {
                    Log.WriteLog(cmd, responseString, txtFile.Text + ".txt");
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }