Exemplo n.º 1
0
        private void ItemOpenYamlFolder_Click(object sender, EventArgs e)
        {
            ManifestPackageVM row = GetFocusedRow();

            if (row == null)
            {
                return;
            }

            OpenFileOrUrl(Path.GetDirectoryName(row.FilePath));
        }
Exemplo n.º 2
0
        private void ItemOpenGitRepo_Click(object sender, EventArgs e)
        {
            ManifestPackageVM row = GetFocusedRow();

            if (row == null)
            {
                return;
            }
            string[] parts  = row.Id.Split('.');
            string   vendor = parts[0];
            string   name   = parts[1];
            string   url    = cGitRepoBaseUrl + $"/tree/master/manifests/{vendor.ToLower()[0]}/{vendor}/{name}/{row.Version}";

            OpenFileOrUrl(url);
        }
Exemplo n.º 3
0
        private static List <NewDownload> FindNewDownloads(YamlFileHelper yamlFileHelper, Dictionary <string, string> packageIds, IEnumerable <ManifestPackageVM> manifestPackages)
        {
            List <Tuple <ManifestPackageVM, string> > idFileTuples = manifestPackages.Join(packageIds, manifestPackage => manifestPackage.Id.ToLower(), i => i.Key, (mpvm, kvp) => Tuple.Create(mpvm, kvp.Value)).ToList();

            List <NewDownload> result = new List <NewDownload>();

            foreach (Tuple <ManifestPackageVM, string> idFileTuple in idFileTuples)
            {
                ManifestPackageVM manifestPackage = idFileTuple.Item1;
                string            idFilePath      = idFileTuple.Item2;

                string[] versionsToIgnoreDownload = Helpers.GetVersionsToIgnoreDownload(idFilePath);

                string idFileFolder  = Path.GetDirectoryName(idFilePath);
                string versionFolder = Path.Combine(idFileFolder, ConvertVersionToDirectoryName(manifestPackage.Version));                 // illegal chars in version shouldn't be a problem, because yaml files are stored in folders with version as name
                bool   exists        = versionsToIgnoreDownload.Any(v => v == manifestPackage.Version) || Directory.Exists(versionFolder);
                //if (manifestPackage.Version == "latest" && exists)
                if (false)                //TODO: the following code crashes when downloaded yaml-files are not version 1.0.0
                {
                    string downloadedYamlFilePath = Path.Combine(versionFolder, "latest.yaml");
                    ManifestPackage_1_0_0 downloadedManifestPackage = yamlFileHelper.ReadYamlFile(downloadedYamlFilePath).Manifest;
                    //TODO test all installers when winget supports multiple installers
                    if (manifestPackage.Installers[0].Sha256 != downloadedManifestPackage.Installers[0].InstallerSha256)
                    {
                        FileInfo fi            = new FileInfo(downloadedYamlFilePath);
                        string   versionSuffix = fi.LastWriteTime.ToString("_yyyy-MM-dd");
                        downloadedManifestPackage.PackageVersion += versionSuffix;
                        yamlFileHelper.WriteYamlFile(downloadedYamlFilePath, downloadedManifestPackage);
                        Directory.Move(versionFolder, versionFolder + versionSuffix);
                        exists = Directory.Exists(versionFolder);
                    }
                }
                if (manifestPackage.Version != "latest")                //TODO!!!!
                {
                    if (!exists)
                    {
                        NewDownload dl = new NewDownload()
                        {
                            MultiFileYaml = manifestPackage.MultiFileYaml,
                            VersionFolder = versionFolder,
                            IdFilePath    = idFilePath
                        };
                        result.Add(dl);
                    }
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        private void gridView1_MasterRowGetChildList(object sender, MasterRowGetChildListEventArgs e)
        {
            ManifestPackageVM row = gridView1.GetRow(e.RowHandle) as ManifestPackageVM;

            e.ChildList = row.Installers;
        }