コード例 #1
0
 //vormals GetApplicationNameForExe
 public Application getDescription(string application)
 {
     if (Utils.IsBlank(application))
     {
         return(Application.notfound);
     }
     if (!applicationNameCache.contains(application))
     {
         string path = WindowsApplicationLauncher.GetExecutableCommand(application);
         if (File.Exists(path))
         {
             FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);
             if (Utils.IsBlank(info.FileDescription))
             {
                 // Does not contain version information
                 applicationNameCache.put(application, new Application(
                                              application.ToLower(),
                                              FilenameUtils.getName(application)));
             }
             else
             {
                 applicationNameCache.put(application, new Application(
                                              application.ToLower(),
                                              info.FileDescription));
             }
         }
         else
         {
             applicationNameCache.put(application, new Application(
                                          application.ToLower(),
                                          FilenameUtils.getName(application)));
         }
     }
     return(applicationNameCache.get(application) as Application);
 }
コード例 #2
0
        //vormals GetApplicationNameForExe
        public Application getDescription(string application)
        {
            if (!applicationNameCache.ContainsKey(application))
            {
                string path = WindowsApplicationLauncher.GetExecutableCommand(application);
                if (File.Exists(path))
                {
                    FileVersionInfo info = FileVersionInfo.GetVersionInfo(path);
                    applicationNameCache.Add(new KeyValuePair <string, Application>(application,
                                                                                    new Application(
                                                                                        application.ToLower(),
                                                                                        info.FileDescription)));
                }
                else
                {
                    applicationNameCache.Add(new KeyValuePair <string, Application>(application,
                                                                                    new Application(
                                                                                        application.ToLower(),
                                                                                        FilenameUtils.getName(application))));
                }
            }
            Application result;

            applicationNameCache.TryGetValue(application, out result);
            return(result);
        }