jjjjjkhg 发表于 2022-12-25 17:55:13

如果要让修改后的文件成功导入,应该怎么做?


00                              nop
                              .try {
00                              nop
73 37 01 00 0A                  newobj   instance void System.Windows.Forms.OpenFileDialog::.ctor()
0A                              stloc.0
06                              ldloc.0
72 11 43 00 70                  ldstr    aFileEltElt                // "File(*.elt)|*.elt"
6F 38 01 00 0A                  callvirt instance void System.Windows.Forms.FileDialog::set_Filter(string)

00                              nop
06                              ldloc.0
6F 39 01 00 0A                  callvirt instance valuetype System.Windows.Forms.DialogResult System.Windows.Forms.CommonDialog::ShowDialog()

17                              ldc.i4.1
FE 01                           ceq
0B                              stloc.1
07                              ldloc.1
39 91 00 00 00                  brfalseloc_7415

00                              nop
73 78 00 00 0A                  newobj   instance void System.Runtime.Serialization.Formatters.Binary.BinaryFormatter::.ctor()
0C                              stloc.2
06                              ldloc.0
6F 3A 01 00 0A                  callvirt instance string System.Windows.Forms.FileDialog::get_FileName()

19                              ldc.i4.3
17                              ldc.i4.1
17                              ldc.i4.1
73 3B 01 00 0A                  newobj   instance void System.IO.FileStream::.ctor(string, valuetype System.IO.FileMode, valuetype System.IO.FileAccess, valuetype System.IO.FileShare)
0D                              stloc.3
08                              ldloc.2
09                              ldloc.3
6F 3C 01 00 0A                  callvirt instance object System.Runtime.Serialization.IFormatter::Deserialize(class System.IO.Stream)

74 4B 00 00 02                  castclass ElitechLog.Models.Parameters
13 04                           stloc.s4
09                              ldloc.3
6F 3D 01 00 0A                  callvirt instance void System.IO.Stream::Close()

00                              nop
02                              ldarg.0
7B 3E 00 00 04                  ldfld    class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters> ElitechLog.MainForm::allParameters
6F 13 01 00 0A                  callvirt instance void class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters>::Clear()

00                              nop
02                              ldarg.0
7B 3E 00 00 04                  ldfld    class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters> ElitechLog.MainForm::allParameters
11 04                           ldloc.s4
6F D2 00 00 0A                  callvirt instance void class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters>::Add(var<u1>)

00                              nop
02                              ldarg.0
02                              ldarg.0
7B 3E 00 00 04                  ldfld    class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters> ElitechLog.MainForm::allParameters
28 AB 00 00 06                  call   instance void ElitechLog.MainForm::ShowChartForm(class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters> parameters)

00                              nop
72 35 43 00 70                  ldstr    asc_DF318                  // "导入成功"
28 66 00 00 06                  call   string ElitechLog.T::_(string text)

28 FB 02 00 06                  call   void ElitechLog.Utils.Message::ShowInfo(string msg)

00                              nop
72 3F 43 00 70                  ldstr    a0_11                      // "导入了 {0} 条数据"
28 66 00 00 06                  call   string ElitechLog.T::_(string text)

02                              ldarg.0
7B 3E 00 00 04                  ldfld    class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters> ElitechLog.MainForm::allParameters
6F 36 01 00 0A                  callvirt instance int32 class System.Collections.Generic.List`1<class ElitechLog.Models.Parameters>::get_Count()

8C 3F 01 00 01                  box      System.Int32
28 68 00 00 0A                  call   string System.String::Format(string, object)

13 05                           stloc.s5
20 BC 0B 00 00                  ldc.i4   0xBBC
11 05                           ldloc.s5
28 74 00 00 06                  call   void ElitechLog.logger::Info(valuetype ElitechLog.Actions action, string msg)

00                              nop
00                              nop


                              loc_7415:                               // CODE XREF: ElitechLog.MainForm__sbtnImport_Click+1F↑j
00                              nop
DE 32                           leave.sloc_744A
                              }

                              catch System.Exception {
13 06                           stloc.s6
00                              nop
72 57 43 00 70                  ldstr    asc_DF33A                  // "导入失败"
28 66 00 00 06                  call   string ElitechLog.T::_(string text)

28 FB 02 00 06                  call   void ElitechLog.Utils.Message::ShowInfo(string msg)

00                              nop
20 BC 0B 00 00                  ldc.i4   0xBBC
72 57 43 00 70                  ldstr    asc_DF33A                  // "导入失败"
11 06                           ldloc.s6
6F 4A 00 00 0A                  callvirt instance string System.Object::ToString()

28 38 00 00 0A                  call   string System.String::Concat(string, string)

28 74 00 00 06                  call   void ElitechLog.logger::Info(valuetype ElitechLog.Actions action, string msg)

00                              nop
00                              nop
DE 00                           leave.sloc_744A
                              }


                              loc_744A:                               // CODE XREF: ElitechLog.MainForm__sbtnImport_Click+B6↑j
                                                                      // ElitechLog.MainForm__sbtnImport_Click+E8↑j
2A                              ret

jackz007 发表于 2022-12-25 18:37:02

      这个代码你能也能看懂?还是换 C# 或 VB.NET 吧。

不二猫猫 发表于 2023-3-25 16:11:52

根据提供的代码,导入文件的过程似乎涉及打开一个文件对话框,选择一个扩展名为.elt的文件,反序列化文件内容,然后将结果数据添加到参数列表中。

要修改代码以成功导入文件,可能需要对以下几个方面进行更改:

文件扩展名:当前代码正在查找扩展名为.elt的文件。如果要导入的文件具有不同的扩展名,则需要相应地修改筛选器字符串。

文件格式:当前代码使用二进制格式化程序对文件内容进行反序列化。如果要导入的文件不是二进制格式,则需要使用不同的方法对文件内容进行反序列化。

数据结构:当前代码将反序列化后的数据添加到参数列表中。如果文件中的数据具有不同的结构或格式,则需要修改代码以正确解析和存储数据。
页: [1]
查看完整版本: 如果要让修改后的文件成功导入,应该怎么做?