Form1.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using Y.Utils.DataUtils.JsonUtils;
  11. using Y.Utils.IOUtils.FileUtils;
  12. using Y.Utils.IOUtils.PathUtils;
  13. using Y.Utils.IOUtils.TxtUtils;
  14. using Y.Utils.UpdateUtils;
  15. namespace Oreo.VersionPackage
  16. {
  17. public partial class Form1 : Form
  18. {
  19. public Form1()
  20. {
  21. InitializeComponent();
  22. }
  23. private void btPackage_Click(object sender, EventArgs e)
  24. {
  25. string src = tbPath.Text;
  26. string file = tbName.Text + "-" + tbVersion.Text.Replace('.', '-') + ".udp";
  27. string dst = DirTool.Combine(DirTool.GetFilePath(tbPath.Text), file);
  28. if (FilePackageTool.Pack(src, dst) > 0 && File.Exists(dst))
  29. {
  30. string md5Code = FileTool.GetMD5(dst);
  31. //设置更新模型,14个属性
  32. AppUpdateInfo aui = new AppUpdateInfo()
  33. {
  34. Name = tbName.Text,
  35. Author = tbAuthor.Text,
  36. Desc = tbDesc.Text,
  37. Version = tbVersion.Text,
  38. ReleasePath = tbReleasePath.Text,
  39. Necessary = cbNecessary.Checked,
  40. DateTime = DateTime.Now,
  41. DownloadMode = rbHttpMode.Checked ? 0 : 1,
  42. HttpUrl = tbHttpUrl.Text,
  43. FtpIp = tbFtpIp.Text,
  44. FtpAccount = tbFtpAccount.Text,
  45. FtpPassword = tbFtpPassword.Text,
  46. FtpFile = tbFtpFile.Text,
  47. Md5 = md5Code,
  48. };
  49. string auiJson = JsonTool.ToStr(aui);
  50. TxtTool.Create(dst + ".txt", auiJson);
  51. }
  52. }
  53. }
  54. }