Ejemplo n.º 1
0
 public HttpUpdateClient(Uri uri, IUpdateApplier updateApplier, NoteType changelogKind = NoteType.Markdown)
     : base(updateApplier)
 {
     _httpClient = new HttpClient {
         BaseAddress = uri
     };
     NoteType = changelogKind;
 }
Ejemplo n.º 2
0
 public LocalUpdateClient(string folderLocation, IUpdateApplier updateApplier, NoteType changelogKind = NoteType.Markdown) : base(updateApplier)
 {
     _folderLocation   = folderLocation;
     _releaseFile      = Path.Combine(folderLocation, "RELEASE");
     _updateFileFolder = Path.Combine(AppMetadata.ApplicationFolder, "packages");
     _changelogKind    = changelogKind;
     if (!Directory.Exists(folderLocation))
     {
         Logger.Warning("{0} directory doesn't exist, this will cause this UpdateClient to not function", folderLocation);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a github client
        /// </summary>
        /// <param name="updateApplier">Update Applier that will apply updates after being downloaded</param>
        /// <param name="organization">Organization that contains the application update files</param>
        /// <param name="repository">Application's repository</param>
        /// <param name="useGraphQl">If we should use <see cref="GithubApiGraphQl"/> (This will require a <see cref="personalToken"/> which has public_repo)</param>
        /// <param name="personalToken">Personal token for accessing the repo if needed</param>
        public GithubUpdateClient(
            IUpdateApplier updateApplier,
            string organization,
            string repository,
            bool useGraphQl      = false,
            string?personalToken = null)
            : base("https://blank.org", updateApplier, NoteType.Markdown)
        {
            _organization = organization;
            _repository   = repository;
            var canUseGraphQl = useGraphQl && !string.IsNullOrWhiteSpace(personalToken);

            if (!canUseGraphQl)
            {
                Logger.Warning("No personal token was given, going to fall back to REST");
            }

            //Get what api we should use and setup httpClient
            _githubApi = canUseGraphQl ? new GithubApiGraphQl(personalToken !, _httpClient, this) : new GithubApiRest(this, _httpClient);
        }
Ejemplo n.º 4
0
 protected UpdateClient(IUpdateApplier updateApplier)
 {
     UpdateApplier = updateApplier;
     AppMetadata   = new ApplicationMetadata();
     Logger        = LoggingCreator.CreateLogger(GetType().Name);
 }
Ejemplo n.º 5
0
 protected IUpdateApplierTest(IUpdateApplier updateApplier)
 {
     _updateApplier = updateApplier;
 }
Ejemplo n.º 6
0
 public HttpUpdateClient(string uri, IUpdateApplier updateApplier, NoteType changelogKind = NoteType.Markdown)
     : this(new Uri(uri), updateApplier, changelogKind)
 {
 }