private void SetSelectedApp()
		{
			SelectedApplication = string.Empty;
			string selected = RegistrySaver.FindSelectedRegValue(RegistrySaver.RegCategoryAppList);
			if (!string.IsNullOrEmpty(selected))
			{
				SelectedApplication = Applications.Find(x => x == selected);
			}
		}
Exemplo n.º 2
0
 private void FixNames(ref string group, ref string log)
 {
     if (log.HasValue())
     {
         var dLog = log;
         var a    = Applications.Find(app => app.Name == dLog) ?? Applications.Find(app => app.ShortName == dLog);
         log = a != null ? a.Name : log;
         if (a != null && group.IsNullOrEmpty())
         {
             // Old links, that didn't know about groups
             var g = ApplicationGroups.Find(gr => gr[a.Name] != null);
             if (g != null)
             {
                 group = g.Name;
             }
         }
     }
 }
Exemplo n.º 3
0
        public IApplication AddApplication <TApp>(TApp app, string executablefilePath) where TApp : IApplication
        {
            var versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(executablefilePath);

            app.Name        = string.IsNullOrWhiteSpace(versionInfo.ProductName) ? Path.GetFileNameWithoutExtension(executablefilePath) : versionInfo.ProductName;
            app.MatchUsing  = MatchUsing.ExecutableFilename;
            app.MatchString = Path.GetFileName(executablefilePath);

            var matchApplications = FindMatchApplications <TApp>(app.MatchUsing, app.MatchString);

            if (matchApplications.Length != 0)
            {
                return(matchApplications[0]);
            }
            var existingApp = Applications.Find(a => a.Name == app.Name && a is TApp);

            if (existingApp != null)
            {
                return(existingApp);
            }
            AddApplication(app);
            SaveApplications();
            return(app);
        }
Exemplo n.º 4
0
 public Application this[string name] =>
 Applications.Find(a => a.Name == name) ?? Applications.Find(a => a.ShortName == name);