• <tfoot id='eA3za'></tfoot>

  • <i id='eA3za'><tr id='eA3za'><dt id='eA3za'><q id='eA3za'><span id='eA3za'><b id='eA3za'><form id='eA3za'><ins id='eA3za'></ins><ul id='eA3za'></ul><sub id='eA3za'></sub></form><legend id='eA3za'></legend><bdo id='eA3za'><pre id='eA3za'><center id='eA3za'></center></pre></bdo></b><th id='eA3za'></th></span></q></dt></tr></i><div id='eA3za'><tfoot id='eA3za'></tfoot><dl id='eA3za'><fieldset id='eA3za'></fieldset></dl></div>

    1. <legend id='eA3za'><style id='eA3za'><dir id='eA3za'><q id='eA3za'></q></dir></style></legend>
        • <bdo id='eA3za'></bdo><ul id='eA3za'></ul>
      1. <small id='eA3za'></small><noframes id='eA3za'>

        以编程方式将资源嵌入 .NET 程序集中

        Programmatically embed resources in a .NET assembly(以编程方式将资源嵌入 .NET 程序集中)
        • <bdo id='NK01b'></bdo><ul id='NK01b'></ul>
          <legend id='NK01b'><style id='NK01b'><dir id='NK01b'><q id='NK01b'></q></dir></style></legend>

        • <i id='NK01b'><tr id='NK01b'><dt id='NK01b'><q id='NK01b'><span id='NK01b'><b id='NK01b'><form id='NK01b'><ins id='NK01b'></ins><ul id='NK01b'></ul><sub id='NK01b'></sub></form><legend id='NK01b'></legend><bdo id='NK01b'><pre id='NK01b'><center id='NK01b'></center></pre></bdo></b><th id='NK01b'></th></span></q></dt></tr></i><div id='NK01b'><tfoot id='NK01b'></tfoot><dl id='NK01b'><fieldset id='NK01b'></fieldset></dl></div>

                <small id='NK01b'></small><noframes id='NK01b'>

                <tfoot id='NK01b'></tfoot>
                  <tbody id='NK01b'></tbody>

                1. 本文介绍了以编程方式将资源嵌入 .NET 程序集中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个已编译的 .NET 程序集,其中嵌入了一个特定的资源文件(名为Script.xml").我需要以编程方式将其更改为另一个.

                  I have a compiled .NET assembly with a specific resource file embedded (named 'Script.xml'). I need to programmatically change it out for another.

                  不从源代码重新编译是否可以做到这一点?

                  Is this possible to do without recompiling from source?

                  目前,我搜索我知道文件中的文本,它运行良好.但是我需要为另一个我不知道资源文件的任何内容的项目这样做,我需要找到另一种方法.

                  Currently, I do a search for text I know is in the file and it works well. But I need to do it for another project where I don't know any of the contents of the resource file and I need to find another method.

                  FileStream exe = new FileStream(currentexe, FileMode.Open);
                  
                  //find xml part of exefile
                  string find = "<?xml version="1.0"?>";
                  string lastchars = new string(' ', find.Length);
                  while (exe.CanRead) {
                      lastchars = lastchars.Substring(1) + (char)exe.ReadByte();
                      if (lastchars == find) {
                          exe.Seek(-find.Length, SeekOrigin.Current);
                          break;
                      }
                  }
                  
                  //output serialized script
                  int bytenum = 0;
                  foreach (byte c in xml) {
                      if (c == 0) break;
                      exe.WriteByte(c);
                      bytenum++;
                  }
                  
                  //clean out extra data
                  while (bytenum++ < ScriptFileSize) {
                      exe.WriteByte(0x20);
                  }
                  exe.Close();
                  

                  推荐答案

                  您可以使用 Cecil 打开程序集并插入资源(我这样做).YMMV

                  You could use Cecil to open the assembly and insert a resource (I do). YMMV

                  这篇关于以编程方式将资源嵌入 .NET 程序集中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                  listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                  Cannot remove items from ListBox(无法从列表框中删除项目)
                  Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                  Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                  Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)
                    <bdo id='iPEvs'></bdo><ul id='iPEvs'></ul>

                    <small id='iPEvs'></small><noframes id='iPEvs'>

                          <tbody id='iPEvs'></tbody>

                        <tfoot id='iPEvs'></tfoot>
                        • <i id='iPEvs'><tr id='iPEvs'><dt id='iPEvs'><q id='iPEvs'><span id='iPEvs'><b id='iPEvs'><form id='iPEvs'><ins id='iPEvs'></ins><ul id='iPEvs'></ul><sub id='iPEvs'></sub></form><legend id='iPEvs'></legend><bdo id='iPEvs'><pre id='iPEvs'><center id='iPEvs'></center></pre></bdo></b><th id='iPEvs'></th></span></q></dt></tr></i><div id='iPEvs'><tfoot id='iPEvs'></tfoot><dl id='iPEvs'><fieldset id='iPEvs'></fieldset></dl></div>
                          <legend id='iPEvs'><style id='iPEvs'><dir id='iPEvs'><q id='iPEvs'></q></dir></style></legend>