Exemplo n.º 1
0
        public static List <GitHubApi.GitHubFileInfo> CheckForNewDefinitions([NotNull] IEnumerable <FirmwareDefinition> definitions)
        {
            if (definitions == null)
            {
                throw new ArgumentNullException("definitions");
            }

            s_logger.Info("Checking for definitions updates...");
            var definitionsInRepository = GitHubApi.GetFiles("Definitions");

            if (definitionsInRepository == null)
            {
                s_logger.Info("Definitions repository is not found.");
                return(null);
            }

            var entitiesForUpdate = GitHubApi.GetEntitiesForUpdate(definitionsInRepository, definitions.Select(x => new Updatable <FirmwareDefinition>
            {
                Entity   = x,
                FileName = x.FileName,
                Sha      = x.Sha
            })).ToList();

            if (entitiesForUpdate.Count == 0)
            {
                s_logger.Info("No new definitions were found.");
            }
            return(entitiesForUpdate);
        }
Exemplo n.º 2
0
        public static List <GitHubApi.GitHubFileInfo> CheckForNewPatches([NotNull] FirmwareDefinition definition, [NotNull] IEnumerable <Patch> patches)
        {
            if (definition == null)
            {
                throw new ArgumentNullException("definition");
            }
            if (patches == null)
            {
                throw new ArgumentNullException("patches");
            }

            var patchesInRepository = GitHubApi.GetFiles("Patches/" + definition.Name);

            if (patchesInRepository == null)
            {
                return(null);
            }

            return(GitHubApi.GetEntitiesForUpdate(patchesInRepository, patches.Select(x => new Updatable <Patch>
            {
                Entity = x,
                FileName = x.FileName,
                Sha = x.Sha
            })).ToList());
        }