Ejemplo n.º 1
0
        public IGitHubEntry GetUpdate(IProgramEntry entry)
        {
            string repo;

            if (entry == null)
            {
                return(null);
            }
            try
            {
                if (entry.ComponentType == ProgramType.VoukoderCore)
                {
                    repo = "voukoder";
                    Release re = new Release();
                    if (AllowPreReleaseVersion)
                    {
                        re = _client.Repository.Release.GetAll("Vouk", repo).Result[0];
                    }
                    else
                    {
                        re = _client.Repository.Release.GetLatest("Vouk", repo).Result;
                    }
                    OnRequest(this, new ApiRequestEventArgs(_client.GetLastApiInfo()));

                    var entr = new VKGithubEntry(re.Name, new Models.Version(re.TagName))
                    {
                        DownloadUrl = new Uri(re.Assets[0].BrowserDownloadUrl),
                        Changelog   = re.Body
                    };
                    if (entry.Version.CompareTo(entr.Version) < 0)
                    {
                        return(entr);
                    }
                    return(null);
                }
                else
                {
                    repo = "voukoder-connectors";
                    string repopath;
                    repopath = entry.ComponentType.ToString().ToLower();
                    var content = GetContent(entry.ComponentType, "Vouk", repo, repopath, 1, false);
                    if (content != null && entry.Version.CompareTo(content[0].Version) < 0)
                    {
                        return(content[0]);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            catch (AggregateException ex)
            {
                var v = _client.GetLastApiInfo();
                Log.Error(ex, ex.Message);
                return(null);
            }
        }
 protected virtual void OnProgramEntryChanged(IProgramEntry oldEntry, IProgramEntry newEntry)
 {
     _entry = newEntry;
     if (this.IsInitialized)
     {
         _programName.Text   = newEntry.Name;
         _programLogo.Source = newEntry.Logo;
     }
 }
Ejemplo n.º 3
0
        private void AddItem(IProgramEntry entry)
        {
            var i = new VoukoderItemControl
            {
                Name = "item" + entry.ToString(),
                VoukoderProgramData = entry,
                Margin = new System.Windows.Thickness(0, 10, 0, 0)
            };

            VoukoderItemControls.Add(i);
        }
Ejemplo n.º 4
0
 private static void ConvertFromRegistryEntry(out IProgramEntry entry, RegistryEntry regEntry, ProgramType type)
 {
     entry = new VKProgramEntry(regEntry.DisplayName, new Models.Version(regEntry.DisplayVersion, regEntry.PreRelease));
     entry.ComponentType    = type;
     entry.InstallationDate = regEntry.InstallationDate;
     entry.InstallationPath = regEntry.InstallationPath;
     entry.ModifyPath       = regEntry.ModifyPath;
     entry.Publisher        = regEntry.Publisher;
     entry.UninstallString  = regEntry.UninstallString;
     entry.WindowsInstaller = regEntry.WindowsInstaller;
     if (entry.ComponentType == ProgramType.MediaEncoder)
     {
         entry.Hide = true;
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns the connector for the given type if installed on the system
        /// </summary>
        /// <param name="connectorType"></param>
        /// <returns></returns>
        public static IProgramEntry GetVoukoderComponent(ProgramType connectorType)
        {
            var programs = RegistryHelper.GetPrograms();

            Log.Debug("Received registry program list for GetVoukoderComponent");
            IProgramEntry        entry       = null;
            List <RegistryEntry> vComponents = null;

            foreach (RegistryEntry e in programs)
            {
                var displayname = e.DisplayName;
                if (displayname.Contains("Voukoder"))
                {
                    if (vComponents == null)
                    {
                        vComponents = new List <RegistryEntry>();
                    }
                    vComponents.Add(e);
                }
            }
            if (vComponents == null)
            {
                return(null);
            }
            try
            {
                var ad = vComponents.Single(x => x.DisplayName.Any(char.IsDigit));
                ConvertFromRegistryEntry(out entry, ad, ProgramType.VoukoderCore);
            }
            catch (InvalidOperationException ex) { }
            try
            {
                var re = vComponents.Single(x => x.DisplayName.Contains(connectorType.ToString()));
                ConvertFromRegistryEntry(out entry, re, connectorType);
            }
            catch (InvalidOperationException ex) { }
            if (entry != null && connectorType == entry.ComponentType)
            {
                return(entry);
            }

            Log.Debug("No match for searching voukoder component");
            return(null);
        }