Example #1
0
        public void InsertMatchedApplication(MatchedApplication info)
        {
            if (MatchedAppInfos.Items.All(i => i.ApplicationId != info.ApplicationId))
            {
                var fileInfo       = new FileInfo(info.OriginalFile);
                var dirName        = Path.GetFileNameWithoutExtension(info.OriginalFile);
                var applicationDir = $"{RootApplicationDirectory}{dirName}\\";

                FileService.DirectoryCopy(fileInfo.DirectoryName, applicationDir, true);
                info.ExecuteFile = $"{applicationDir}{info.ApplicationName}";

                Observable.Start(() =>
                {
                    info.SetIcon(info.ExecuteFile);
                    MatchedAppInfos.Add(info);
                }, RxApp.MainThreadScheduler);
            }
            else
            {
                var targetInfo = MatchedAppInfos.Items.FirstOrDefault(i => i.ApplicationId == info.ApplicationId);
                if (targetInfo != null)
                {
                    targetInfo.OriginalFile = info.OriginalFile;
                    var fileInfo       = new FileInfo(targetInfo.OriginalFile);
                    var dirName        = Path.GetFileNameWithoutExtension(info.OriginalFile);
                    var applicationDir = $"{RootApplicationDirectory}{dirName}\\";

                    FileService.DirectoryCopy(fileInfo.DirectoryName, applicationDir, true);
                    info.ExecuteFile = $"{applicationDir}{info.ApplicationName}";
                }
            }
        }
Example #2
0
 public void Dispose()
 {
     _updateCheckerStop?.Dispose();
     MatchedAppInfos?.Dispose();
 }
Example #3
0
 public void MatchedAppClear()
 {
     MatchedAppInfos.Clear();
 }