2015-02-07 4 views
-3

나는 최근에 this tutorial을 보았습니다 (진행하기 전에 참조하십시오). 나는 그것을 시도하고 잘 작동합니다. GUI를 사용하여 동일한 결과를 얻을 수있는 프로그램을 작성하고 싶습니다. 화상 -어떻게 jpg 파일을 rar 파일에 추가합니까?

enter image description here

구체적으로, 난의 C# 1 당량 할 참조 : SrcImage, SrcArchiveResult 세 파일을 가리키는 문자열

Copy \B SrcImage + SrcArchive Result 

.

내가 할 수있는 것을 아는 사람이 있습니까?

업데이트 # 1 :

 //Writing a batch file containing the desired code in batch file 
     //language, and running it from a c# form. 
     string BackSlashB = "-b"; 
     string lines = "@echo off \r copy "+ BackSlashB +" " + SrcJpg + " + " + SrcRar + " " + Destfile + " \r pause"; 
     MessageBox.Show(lines); 
     System.IO.StreamWriter batchfile = new System.IO.StreamWriter("c:\\temp.bat"); 
     batchfile.WriteLine(lines); 
     batchfile.Close(); 
     System.Diagnostics.Process.Start("c:\\temp.bat"); 

콘솔 창이 열리고 다음 내가 그것을 내용 ... 어떤 아이디어의 읽을 수 전에 사라 : 나는이 시도?

+0

미안, 그것을 고정. 여기 http://computer-pranks.wonderhowto.com/how-to/hide-your-secret-files-jpg-image-without-exposing-anything-ads-alternate-data-streams-0135035/ –

+0

이니? 지금까지 아무 것도 시도하지 않았 니? –

+0

정말로 ... 나는 프로그램이 새로운 배치 파일을 만들어 외부에서 실행하는 것을 고려해 보았다. 그러나 그것은 지저분 할 것이다. –

답변

0

좋아, 마침내 작동하게되었습니다.

문제는 \ r 이탈로 인한 것입니다. 이상한 이유로, \ r \ n이어야합니다. 그렇지 않으면 배치 파일에 코드가 한 줄로 포함됩니다. 또한 각 파일 이름에 아포스트로피를 추가해야했습니다. 마지막으로, 작업이 완료되었다는 메시지를 사용자에게 제공하기 위해 일시 ​​중지 및 디버그 상자를 제거하고 "파일이 있는지 확인하십시오"라는 메시지로 대체했습니다.

전체 코드 : 그것에 대해

string lines = "@echo off" + "\r\n copy /b " + "\"" + SrcJpg + "\"" + " + " + "\"" + SrcRar + "\"" + " " + "\"" + Destfile + "\""; 
     //MessageBox.Show(lines); 
     System.IO.StreamWriter batchfile = new System.IO.StreamWriter("c:\\temp.bat"); 
     batchfile.WriteLine(lines); 
     batchfile.Close(); 
     System.Diagnostics.Process.Start("c:\\temp.bat"); 

     if (File.Exists(Destfile)) 
     { 
      MessageBox.Show("File Created!"); 
     } 
관련 문제