Esempio n. 1
0
 public void CreateXmlDocument(Patch patch)
 {
     var doc = new XmlDocument();
     doc.InnerXml = patch.GetXml();
     doc.Save(Path.Combine(txtDestination.Text, XmlFileName));
 }
Esempio n. 2
0
        public Patch CreatePatch()
        {
            var patch = new Patch();

            var zipfileName = string.Format("{0}-{1}.zip", Regex.Replace(txtNom.Text, @"\s", string.Empty), txtVersion.Text);

            patch.LocalFile = Path.Combine(txtDestination.Text, zipfileName);  //prepare path
            if (!Directory.Exists(txtDestination.Text))
                Directory.CreateDirectory(txtDestination.Text);

            if (Files.Count == 0)
                Utils.ZipFileUil.Compress(Directory.GetFiles(txtSource.Text), patch.LocalFile);
            else
                Utils.ZipFileUil.Compress(txtSource.Text, Files, patch.LocalFile);

            patch.NomApplication = txtNom.Text;

            //checksum
            patch.Checksum = FileChecksum.GetSHA256Checksum(patch.LocalFile);

            patch.Description = txtDescription.Text;

            patch.FileLength = new FileInfo(patch.LocalFile).Length.ToString();

            txtUrl.Text = txtUrl.Text + Path.GetFileName(patch.LocalFile);

            patch.Url = txtUrl.Text;

            patch.Version = txtVersion.Text;

            return patch;
        }