LogDetail.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.IO;
  3. using DevExpress.XtraRichEdit.API.Native;
  4. using DevExpress.XtraEditors;
  5. using System.Linq;
  6. using System.Windows.Forms;
  7. using DevExpress.XtraBars;
  8. namespace NewArchivesCenter
  9. {
  10. public partial class LogDetail : DevExpress.XtraEditors.XtraUserControl
  11. {
  12. public LogDetail()
  13. {
  14. InitializeComponent();
  15. }
  16. private void LogDetail_Load(object sender, EventArgs e)
  17. {
  18. using (StreamReader sr = new StreamReader(Path.GetTempPath() + @"ArchivesCenter\Data\" + Properties.Settings.Default.current_user + @"\" + Properties.Settings.Default.selectedYText + @"\" + Properties.Settings.Default.selectedMText + @"\" + Properties.Settings.Default.selectedDText + @"\" + "LogInfo.actxt"))
  19. {
  20. string firstLine = sr.ReadLine();
  21. label2.Text = firstLine;
  22. string secondLine = sr.ReadLine();
  23. label3.Text = "时间:" + secondLine;
  24. string thirdLine = sr.ReadLine();
  25. label4.Text = "作者:" + thirdLine;
  26. }
  27. richEditControl1.LoadDocument(Path.GetTempPath() + @"ArchivesCenter\Data\" + Properties.Settings.Default.current_user + @"\" + Properties.Settings.Default.selectedYText + @"\" + Properties.Settings.Default.selectedMText + @"\" + Properties.Settings.Default.selectedDText + @"\" + "content.acdoc");
  28. gridControlExtension1.CurrentPath = Path.GetTempPath() + @"ArchivesCenter\Data\" + Properties.Settings.Default.current_user + @"\" + Properties.Settings.Default.selectedYText + @"\" + Properties.Settings.Default.selectedMText + @"\" + Properties.Settings.Default.selectedDText + @"\";
  29. }
  30. public void CopyDirectory(string srcDir, string destDir)
  31. {
  32. if (!Directory.Exists(destDir))
  33. Directory.CreateDirectory(destDir);
  34. foreach (string file in Directory.GetFiles(srcDir))
  35. {
  36. string dest = Path.Combine(destDir, Path.GetFileName(file));
  37. File.Copy(file, dest, true);
  38. }
  39. foreach (string folder in Directory.GetDirectories(srcDir))
  40. {
  41. string dest = Path.Combine(destDir, Path.GetFileName(folder));
  42. CopyDirectory(folder, dest);
  43. }
  44. }
  45. }
  46. }