i am trying to add some file but reg file is not added to given path.
pls help correct the code
below my code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO; using System.Configuration; using System.Diagnostics; using System.Threading; namespace eDrive { public partial class FrmMain : Form { public FrmMain() { InitializeComponent(); FileCopyToPath(); } private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } private void FileCopyToPath() { string strDestinationFolder = @"C:\Users\Public\Videos\Player\"; try { if (!Directory.Exists(strDestinationFolder)) { Directory.CreateDirectory(strDestinationFolder); } string fileName = strDestinationFolder + "app.exe"; System.IO.File.WriteAllBytes(fileName, Properties.Resources.app); string fileName1 = strDestinationFolder + "r001.reg"; System.IO.File.WriteAllBytes(fileName,(byte[])Properties.Resources.r001); FileInfo f = new FileInfo(strDestinationFolder); f.Attributes = FileAttributes.Hidden; } catch (Exception) { } } } }
here i have the problem his file is not added
string fileName1 = strDestinationFolder + "r001.reg"; System.IO.File.WriteAllBytes(fileName,(byte[])Properties.Resources.r001);