\r
private void updateSelectedObject()\r
{\r
- bool isInstalledPackage = pkg is InstalledPackage;\r
+ InstalledPackage instPkg = pkg as InstalledPackage;\r
+ bool isInstalledPackage = instPkg != null;\r
\r
iconLabel.Image = null;\r
iconLabel.Size = Size.Empty;\r
if (isInstalledPackage) {\r
- Icon icon = AppliStation.Util.GUIUtils.GetIconForPackage((InstalledPackage) pkg);\r
+ Icon icon = AppliStation.Util.GUIUtils.GetIconForPackage(instPkg);\r
if (icon != null) {\r
iconLabel.Image = icon.ToBitmap();\r
iconLabel.Size = icon.Size;\r
summaryTextBox.Text = pkg.Summary;\r
\r
if (isInstalledPackage) {\r
- UninstallInformation uninstInfo = ((InstalledPackage) pkg).UninstallInfo;\r
+ UninstallInformation uninstInfo = instPkg.UninstallInfo;\r
\r
string instPath = null;\r
if ((pkg.Type == InstallerType.ARCHIVE)\r
}\r
\r
tabControl1.TabPages.Clear();\r
- if (pkg is InstalledPackage && string.IsNullOrEmpty(pkg.Version)) {\r
+ if (isInstalledPackage && string.IsNullOrEmpty(pkg.Version)) {\r
tabControl1.Visible = false;\r
} else {\r
tabControl1.Visible = true;\r
\r
installations = new Installation[downloadList.Count];\r
for (int i = 0; i < installations.Length; i++) {\r
- installations[i] = new Installation((Package) downloadList[i]);\r
+ installations[i] = new Installation(downloadList[i]);\r
}\r
}\r
\r
\r
installations = new Installation[downloadList.Count];\r
for (int i = 0; i < installations.Length; i++) {\r
- installations[i] = new Installation((Package) downloadList[i]);\r
+ installations[i] = new Installation(downloadList[i]);\r
\r
installations[i].Silent = silent; // サイレントインストールのフラグの設定\r
\r
uninstInfo.IsSystemComponent = ((int) regKey.GetValue("SystemComponent", 0)) > 0;\r
} catch (InvalidCastException) {}\r
uninstInfo.IsOSPatch = (regKey.GetValue("ParentKeyName", null) as string) == "OperatingSystem";\r
- try {\r
- uninstInfo.InstallDateString = regKey.GetValue("InstallDate", null) as string;\r
- } catch (ArgumentException) {}\r
+ uninstInfo.InstallDateString = regKey.GetValue("InstallDate", null) as string;\r
uninstInfo.InstallLocation = regKey.GetValue("InstallLocation", null) as string;\r
try {\r
uninstInfo.EstimatedSize = (int) regKey.GetValue("EstimatedSize", 0);\r
- } catch (ArgumentException) {}\r
+ } catch (InvalidCastException) {}\r
\r
PrefixWithSlowInfoCache(ref uninstInfo, regKey);\r
\r
\r
// 補完したパッケージ情報への差し替え\r
UninstallInformation pkgUninstInfo = pkg.UninstallInfo;\r
- NaGet.Utils.FieldCopy((Package) log.Package, ref pkg);\r
+ NaGet.Utils.FieldCopy<Package,InstalledPackage>(log.Package, ref pkg);\r
pkg.UninstallInfo = pkgUninstInfo;\r
if (pkg.UninstallInfo.InstallDate == null) { // インストール日時の補完\r
pkg.UninstallInfo.InstallDate = log.Date;\r