Exemple #1
0
 private void CopyFolder(string from, string to)
 {
     try
     {
         DirectoryInfo source      = new DirectoryInfo(from);
         DirectoryInfo destination = new DirectoryInfo(to);
         string        fullpath;
         if (!destination.Exists)
         {
             destination.Create();
         }
         FileInfo[] Files = source.GetFiles();
         foreach (FileInfo fi in Files)
         {
             fullpath = Path.Combine(destination.FullName, fi.Name);
             fi.CopyTo(fullpath, true);
             this.counter++;
             int p = (this.counter * 100) / this.total;
             this.Worker.ReportProgress(p, fullpath);
         }
         // for subfolders
         DirectoryInfo[] folders = source.GetDirectories();
         foreach (DirectoryInfo folder in folders)
         {
             //construct new destination
             string newdestination = Path.Combine(destination.FullName, folder.Name);
             //recursive CopyFolder()
             CopyFolder(folder.FullName, newdestination);
         }
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
 }
Exemple #2
0
        private void InstallHandler(object sender, EventArgs e)
        {
            if (PluginListView.SelectedItems.Count == 0)
            {
                PluginDescription.Text = "No item selected";
                return;
            }
            ListViewItem selectedItem  = PluginListView.SelectedItems[0];
            Uri          fileurl       = new Uri(selectedItem.SubItems[2].Text);
            string       localfile     = Path.GetFileName(selectedItem.SubItems[2].Text);
            string       localfilepath = "";

            if (File.Exists(localfile))
            {
                PluginDescription.Text = "This update is already installed";
                return;
            }
            switch (selectedItem.SubItems[0].Text)
            {
            case "Plugin":
                try
                {
                    localfilepath = Path.GetDirectoryName(Application.ExecutablePath) + AppSettings.GetFolder("plugins") + localfile;
                    DownloadClient.DownloadFileAsync(fileurl, localfilepath);
                }
                catch (Exception ex) { Exceptioner.Log(ex); }
                break;

            case "Update":
                localfilepath = Path.GetDirectoryName(Application.ExecutablePath) + localfile;
                DownloadClient.DownloadFileAsync(fileurl, localfilepath);
                break;
            }
        }
Exemple #3
0
 public static void CopyFolder(string from, string to)
 {
     try
     {
         DirectoryInfo source      = new DirectoryInfo(from);
         DirectoryInfo destination = new DirectoryInfo(to);
         if (!destination.Exists)
         {
             destination.Create();
         }
         FileInfo[] Files = source.GetFiles();
         foreach (FileInfo fi in Files)
         {
             fi.CopyTo(Path.Combine(destination.FullName, fi.Name), false);
         }
         // for subfolders
         DirectoryInfo[] folders = source.GetDirectories();
         foreach (DirectoryInfo folder in folders)
         {
             //construct new destination
             string newdestination = Path.Combine(destination.FullName, folder.Name);
             //recursive CopyFolder()
             CopyFolder(folder.FullName, newdestination);
         }
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
 }
Exemple #4
0
 public static void DeleteFile(string path)
 {
     try
     {
         File.Delete(path);
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
 }
Exemple #5
0
 private void SendReport(object sender, EventArgs e)
 {
     if (Exceptioner.SendLog(BugContentTx.Text, AttachLogCkbx.Checked))
     {
         BugContentTx.Text = "Report Sended Successfully !";
     }
     else
     {
         BugContentTx.Text = "Some Errors ocurrs , please try it later ";
     }
 }
 private static bool IsNetAssembly(string path)
 {
     try {
         AssemblyName testAssembly = AssemblyName.GetAssemblyName(path);
         return(true);
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
     return(false);
 }
Exemple #7
0
 public static string GetContent(string filepath)
 {
     try
     {
         return(File.ReadAllText(filepath));
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
     return(string.Empty);
 }
Exemple #8
0
 private void RequestOpenProject(object sender, EventArgs e)
 {
     if (OpenProjectRequested != null)
     {
         try
         {
             OpenProjectRequested(this, e);
         }
         catch (Exception ex)
         {
             Exceptioner.Log(ex);
         }
     }
 }
Exemple #9
0
 private void RequestNewFile(object sender, EventArgs e)
 {
     if (NewFileRequested != null)
     {
         try
         {
             NewFileRequested(this, e);
         }
         catch (Exception ex)
         {
             Exceptioner.Log(ex);
         }
     }
 }
Exemple #10
0
 private void RequestOpenSelectedFile(string itemTag)
 {
     if (OpenSelectedFileRequested != null)
     {
         try
         {
             OpenSelectedFileRequested(itemTag);
         }
         catch (Exception e)
         {
             Exceptioner.Log(e);
         }
     }
 }
Exemple #11
0
 public static void EmptyFolder(string folder)
 {
     try {
         DirectoryInfo di = new DirectoryInfo(folder);
         foreach (FileInfo fi in di.GetFiles())
         {
             fi.Delete();
         }
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
 }
Exemple #12
0
 private void RequestInsertSelectedBrunchNode(string itemTag)
 {
     if (InsertSelectedBrunchNodeRequested != null)
     {
         try
         {
             InsertSelectedBrunchNodeRequested(itemTag);
         }
         catch (Exception e)
         {
             Exceptioner.Log(e);
         }
     }
 }
Exemple #13
0
 private void RequestNewProject(object sender, EventArgs e)
 {
     if (NewProjectRequested != null)
     {
         try
         {
             NewProjectRequested(this, e);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message + ex.Source);
             Exceptioner.Log(ex);
         }
     }
 }
Exemple #14
0
 private void CaretPositionChangedEmiter(object sender, EventArgs e)
 {
     //fire the event
     if (CaretPositionChanged != null)
     {
         try
         {
             CaretPositionChanged(this.EditorView.Caret.LineNumber, this.EditorView.Caret.Position);
         }
         catch (Exception ex)
         {
             Exceptioner.Log(ex);
         }
     }
 }
Exemple #15
0
 public static bool Save(string filepath, string content)
 {
     try
     {
         using (StreamWriter sw = new StreamWriter(filepath))
         {
             sw.Write(content);
             return(true);
         }
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
     return(false);
 }
Exemple #16
0
        public void CopyTemplate(string from, string to)
        {
            this.Show();
            this.from    = from;
            this.to      = to;
            this.counter = 0;
            try
            {
                this.total = new DirectoryInfo(from).GetFiles("*.*", SearchOption.AllDirectories).Length;
            }
            catch (Exception e)
            {
                Exceptioner.Log(e);
            }

            this.Worker.RunWorkerAsync();
        }
Exemple #17
0
        public static List <string> GetFolderFileList(string folder, string filter, SearchOption so)
        {
            List <string> FileList = new List <string>();

            try
            {
                DirectoryInfo di    = new DirectoryInfo(folder);
                FileInfo[]    files = di.GetFiles(filter, so);
                foreach (FileInfo fi in files)
                {
                    FileList.Add(fi.FullName);
                }
            }
            catch (Exception e)
            {
                Exceptioner.Log(e);
            }
            return(FileList);
        }
 private static void GetAssemblies(string folder, ref List <string> ListAssembly)
 {
     try
     {
         DirectoryInfo di    = new DirectoryInfo(folder);
         FileInfo[]    files = di.GetFiles("*.dll", SearchOption.AllDirectories);
         foreach (FileInfo fi in files)
         {
             if (IsNetAssembly(fi.FullName))
             {
                 ListAssembly.Add(fi.FullName);
             }
         }
     }
     catch (Exception e)
     {
         Exceptioner.Log(e);
     }
 }
Exemple #19
0
 private void InsertBrunchHandler(object sender, EventArgs e)
 {
     if (this.BrunchBrowserTree.SelectedNode == null)
     {
         return;
     }
     if (this.BrunchBrowserTree.SelectedNode.Level == 2)
     {
         if (InsertSelectedBrunchNodeRequested != null)
         {
             try
             {
                 InsertSelectedBrunchNodeRequested(this.BrunchBrowserTree.SelectedNode.Tag.ToString());
             }
             catch (Exception ex)
             {
                 Exceptioner.Log(ex);
             }
         }
     }
 }