当前位置: 首页>>代码示例>>C#>>正文


C# Condition.part_count方法代码示例

本文整理汇总了C#中System.Condition.part_count方法的典型用法代码示例。如果您正苦于以下问题:C# Condition.part_count方法的具体用法?C# Condition.part_count怎么用?C# Condition.part_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Condition的用法示例。


在下文中一共展示了Condition.part_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: buttonConditionApply_Click

 private void buttonConditionApply_Click(object sender, EventArgs e)
 {
     if (this.treeView.SelectedNode.Level == 3)
     {
         TreeNode selectedNode = this.treeView.SelectedNode;
         TreeNode parent = selectedNode.Parent;
         TreeNode parent2 = parent.Parent;
         TreeNode parent3 = parent2.Parent;
         if (parent.Index == 0)
         {
             if (this.richTextBoxDataDump.Enabled)
             {
                 string[] array = this.richTextBoxDataDump.Text.Split(new char[]
                 {
                     '-'
                 });
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].length = array.Length + 8;
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data = new byte[this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].length - 8];
                 for (int num = 0; num != array.Length; num++)
                 {
                     this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num] = byte.Parse(array[num], NumberStyles.HexNumber);
                 }
             }
             else
             {
                 string[] array2 = new string[0];
                 string[] array3 = new string[0];
                 Condition condition = new Condition();
                 condition.part_count("0x" + this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].command.ToString("X"), ref array2, ref array3, this.executableDirectoryName);
                 int num2 = 0;
                 for (int num = 0; num != array3.Length; num++)
                 {
                     if (array3[num] == "Int32")
                     {
                         int value = Convert.ToInt32(this.dataGridView.Rows[0].Cells[num].Value);
                         byte[] bytes = BitConverter.GetBytes(value);
                         for (int num3 = 0; num3 != 4; num3++)
                         {
                             this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = bytes[num3];
                             num2++;
                         }
                     }
                     else if (array3[num] == "Int16")
                     {
                         short value2 = Convert.ToInt16(this.dataGridView.Rows[0].Cells[num].Value);
                         byte[] bytes2 = BitConverter.GetBytes(value2);
                         for (int num3 = 0; num3 != 2; num3++)
                         {
                             this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = bytes2[num3];
                             num2++;
                         }
                     }
                     else if (array3[num] == "Byte")
                     {
                         this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = Convert.ToByte(this.dataGridView.Rows[0].Cells[num].Value);
                         num2++;
                     }
                     else if (array3[num] == "Operator32")
                     {
                         this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = this.operator_to_byte(this.dataGridView.Rows[0].Cells[num].Value.ToString());
                         num2 += 4;
                     }
                     else if (array3[num] == "Operator16")
                     {
                         this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = this.operator_to_byte(this.dataGridView.Rows[0].Cells[num].Value.ToString());
                         num2 += 2;
                     }
                     else if (array3[num] == "Operator")
                     {
                         this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = this.operator_to_byte(this.dataGridView.Rows[0].Cells[num].Value.ToString());
                         num2++;
                     }
                     else if (array3[num] == "Trigger")
                     {
                         short num4 = Convert.ToInt16(this.dataGridView.Rows[0].Cells[num].Value.ToString().Length + 1);
                         byte[] data = this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data;
                         this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data = new byte[num2 + 2 + (int)num4 + 1];
                         for (int num5 = 0; num5 != num2; num5++)
                         {
                             this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num5] = data[num5];
                         }
                         char[] array4 = this.dataGridView.Rows[0].Cells[num].Value.ToString().ToCharArray();
                         byte[] bytes3 = BitConverter.GetBytes(num4);
                         for (int num3 = 0; num3 != 2; num3++)
                         {
                             this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = bytes3[num3];
                             num2++;
                         }
                         for (int num3 = 0; num3 != this.dataGridView.Rows[0].Cells[num].Value.ToString().Length; num3++)
                         {
                             int value3 = Convert.ToInt32(array4[num3].ToString()) + 48;
                             this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data[num2] = Convert.ToByte(value3);
                             num2++;
                         }
                         this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].length = num2 + 2 + 8;
                     }
                 }
             }
         }
         else if (parent.Index == 1)
//.........这里部分代码省略.........
开发者ID:Jiwan,项目名称:ROSE-Dev-Workshop,代码行数:101,代码来源:AIPEditorForm.cs

示例2: changeByToolStripMenuItem_Click

 private void changeByToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TreeNode selectedNode = this.treeView.SelectedNode;
     TreeNode parent = selectedNode.Parent;
     TreeNode parent2 = parent.Parent;
     TreeNode parent3 = parent2.Parent;
     if (parent.Index == 0)
     {
         ChangeDataDialog changeDataDialog = new ChangeDataDialog();
         changeDataDialog.import_opcode_condition(this.executableDirectoryName);
         if (changeDataDialog.ShowDialog() == DialogResult.OK)
         {
             selectedNode.Text = changeDataDialog.data_select + " (" + changeDataDialog.opcode_select + ")";
             if (changeDataDialog.data_select == "Unknow Opcode")
             {
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].command = int.Parse(changeDataDialog.opcode_select.Remove(0, 2), NumberStyles.HexNumber);
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].length = 8;
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data = new byte[1];
             }
             else
             {
                 string[] array = new string[0];
                 string[] array2 = new string[0];
                 Condition condition = new Condition();
                 condition.part_count(changeDataDialog.opcode_select, ref array, ref array2, this.executableDirectoryName);
                 this.dataGridView.ColumnCount = array.Length;
                 this.richTextBoxDataDump.Text = "";
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].command = int.Parse(changeDataDialog.opcode_select.Remove(0, 2), NumberStyles.HexNumber);
                 int num = 0;
                 for (int num2 = 0; num2 != array.Length; num2++)
                 {
                     if (array2[num2] == "Int32")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "0-0-0-0";
                         num += 4;
                         this.dataGridView.Rows[0].Cells[num2].Value = 0;
                     }
                     else if (array2[num2] == "Byte")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "-0";
                         num++;
                         this.dataGridView.Rows[0].Cells[num2].Value = 0;
                     }
                     else if (array2[num2] == "Int16")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "-0-0";
                         num += 2;
                         this.dataGridView.Rows[0].Cells[num2].Value = 0;
                     }
                     else if (array2[num2] == "Operator32")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "0-0-0-0";
                         num += 4;
                         this.dataGridView.Rows[0].Cells[num2].Value = "==";
                     }
                     else if (array2[num2] == "Operator16")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "-0-0";
                         num += 2;
                         this.dataGridView.Rows[0].Cells[num2].Value = "==";
                     }
                     else if (array2[num2] == "Operator")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "-0";
                         num++;
                         this.dataGridView.Rows[0].Cells[num2].Value = "==";
                     }
                     else if (array2[num2] == "Trigger")
                     {
                         this.dataGridView.Columns[num2].Name = array[num2] + " (" + array2[num2] + ")";
                         this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "-02-0-30-0-0";
                         num += 5;
                         this.dataGridView.Rows[0].Cells[num2].Value = "Null(Give it a value rapidly)";
                     }
                 }
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].length = num + 8;
                 this.block[parent3.Index].record[parent2.Index].condition[selectedNode.Index].data = new byte[num];
             }
         }
     }
     else if (parent.Index == 1)
     {
         ChangeDataDialog changeDataDialog = new ChangeDataDialog();
         changeDataDialog.import_opcode_action(this.executableDirectoryName);
         if (changeDataDialog.ShowDialog() == DialogResult.OK)
         {
             selectedNode.Text = changeDataDialog.data_select + " (" + changeDataDialog.opcode_select + ")";
             if (changeDataDialog.data_select == "Unknow Opcode")
             {
                 this.block[parent3.Index].record[parent2.Index].action[selectedNode.Index].command = int.Parse(changeDataDialog.opcode_select.Remove(0, 2), NumberStyles.HexNumber);
                 this.block[parent3.Index].record[parent2.Index].action[selectedNode.Index].length = 8;
                 this.block[parent3.Index].record[parent2.Index].action[selectedNode.Index].data = new byte[1];
             }
             else
//.........这里部分代码省略.........
开发者ID:Jiwan,项目名称:ROSE-Dev-Workshop,代码行数:101,代码来源:AIPEditorForm.cs

示例3: treeView_AfterSelect

 private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (this.treeView.SelectedNode.Level == 0)
     {
         this.treeView.ContextMenuStrip = this.contextMenuStripBlock;
     }
     else if (this.treeView.SelectedNode.Level == 1)
     {
         this.treeView.ContextMenuStrip = this.contextMenuStripRecord;
     }
     else if (this.treeView.SelectedNode.Level == 2 && this.treeView.SelectedNode.Index == 0)
     {
         this.treeView.ContextMenuStrip = this.contextMenuStripCondition;
     }
     else if (this.treeView.SelectedNode.Level == 2 && this.treeView.SelectedNode.Index == 1)
     {
         this.treeView.ContextMenuStrip = this.contextMenuStripAction;
     }
     else if (this.treeView.SelectedNode.Level == 3)
     {
         this.treeView.ContextMenuStrip = this.contextMenuStripData;
         TreeNode parent = this.treeView.SelectedNode.Parent;
         if (parent.Index == 0)
         {
             TreeNode parent2 = parent.Parent;
             TreeNode parent3 = parent2.Parent;
             this.richTextBoxDataDump.Text = "";
             this.richTextBoxDataDump.Text = this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[0].ToString("X");
             for (int num = 1; num != this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data.Length; num++)
             {
                 this.richTextBoxDataDump.Text = this.richTextBoxDataDump.Text + "-" + this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[num].ToString("X");
             }
             string[] array = new string[0];
             string[] array2 = new string[0];
             Condition condition = new Condition();
             if (condition.part_count("0x" + this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].command.ToString("X"), ref array, ref array2, this.executableDirectoryName))
             {
                 this.richTextBoxDataDump.Enabled = false;
                 this.dataGridView.Show();
                 this.dataGridView.ColumnCount = array.Length;
                 int num2 = 0;
                 for (int num = 0; num != array.Length; num++)
                 {
                     this.dataGridView.Columns[num].Name = array[num] + " (" + array2[num] + ")";
                     if (array2[num] == "Int32")
                     {
                         int num3 = BitConverter.ToInt32(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data, num2);
                         this.dataGridView.Rows[0].Cells[num].Value = num3.ToString();
                         num2 += 4;
                     }
                     else if (array2[num] == "Byte")
                     {
                         byte b = this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[num2];
                         this.dataGridView.Rows[0].Cells[num].Value = b.ToString();
                         num2++;
                     }
                     else if (array2[num] == "Int16")
                     {
                         short num4 = BitConverter.ToInt16(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data, num2);
                         this.dataGridView.Rows[0].Cells[num].Value = num4.ToString();
                         num2 += 2;
                     }
                     else if (array2[num] == "Operator32")
                     {
                         string value = this.byte_to_operator(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[num2]);
                         this.dataGridView.Rows[0].Cells[num].Value = value;
                         num2 += 4;
                     }
                     else if (array2[num] == "Operator16")
                     {
                         string value = this.byte_to_operator(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[num2]);
                         this.dataGridView.Rows[0].Cells[num].Value = value;
                         num2 += 2;
                     }
                     else if (array2[num] == "Operator")
                     {
                         string value = this.byte_to_operator(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[num2]);
                         this.dataGridView.Rows[0].Cells[num].Value = value;
                         num2++;
                     }
                     else if (array2[num] == "Trigger")
                     {
                         short num5 = BitConverter.ToInt16(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data, num2);
                         if (num5 >= 2)
                         {
                             num2 += 2;
                             int num6 = 0;
                             for (int num7 = 0; num7 != (int)(num5 - 2); num7++)
                             {
                                 num6 += (int)(this.block[parent3.Index].record[parent2.Index].condition[this.treeView.SelectedNode.Index].data[num2] - 30);
                             }
                             this.dataGridView.Rows[0].Cells[num].Value = num6;
                             num2 += (int)num5;
                         }
                     }
                     else
                     {
                         this.dataGridView.Rows[0].Cells[num].Value = "Null(Give it a value rapidly)";
                     }
                 }
//.........这里部分代码省略.........
开发者ID:Jiwan,项目名称:ROSE-Dev-Workshop,代码行数:101,代码来源:AIPEditorForm.cs


注:本文中的System.Condition.part_count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。