Run Exe file as an Embedded Resource in C#

后端 未结 3 1091
礼貌的吻别
礼貌的吻别 2020-12-05 15:16

I have a 3rd party EXE. I just need to run this from my C# application.

My prime target is to copyright that 3rd party executable from my C# file..

Is

3条回答
  •  时光取名叫无心
    2020-12-05 15:43

    One could write a simpler

    private void ExtractResource(string resName, string fName)
     {
          object ob = Properties.Resources.ResourceManager.GetObject(resName, originalCulture);
          byte[] myResBytes = (byte[])ob;
          using (FileStream fsDst = new FileStream(fName, FileMode.CreateNew, FileAccess.Write))
          {
             byte[] bytes = myResBytes;
             fsDst.Write(bytes, 0, bytes.Length);
             fsDst.Close();
             fsDst.Dispose();
          }
    }
    

提交回复
热议问题