OSDN Git Service

AppliStation,na-get,プロバイダURLのエラー処理を追加。 v1.3.0
authorttp <ttp@users.sourceforge.jp>
Sun, 21 Jun 2009 11:16:29 +0000 (20:16 +0900)
committerttp <ttp@users.sourceforge.jp>
Sun, 21 Jun 2009 11:16:29 +0000 (20:16 +0900)
 - XML整形式でないソフトリストを読み込むと死亡するバグの修正(WARNINGに変更)
 - ソフトリスト設定GUIにて、URL文法チェックをするように改造

AppliStation/UserPrefForm.Designer.cs
AppliStation/UserPrefForm.cs
AppliStation/UserPrefForm.resx
na-get-lib/NaGet.SubCommands/NaGetUpdate.cs

index 51ef45f..dea19b9 100644 (file)
@@ -57,6 +57,7 @@
                        this.openInternetOptionLinkLabel = new System.Windows.Forms.LinkLabel();\r
                        this.openInternetOptionLinkAdminLabel = new System.Windows.Forms.LinkLabel();\r
                        this.toolTip = new System.Windows.Forms.ToolTip(this.components);\r
+                       this.repoUrlTextBoxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);\r
                        this.tableLayoutPanel.SuspendLayout();\r
                        this.buttonsPanel.SuspendLayout();\r
                        this.tabControl.SuspendLayout();\r
@@ -66,6 +67,7 @@
                        this.networkTabPage.SuspendLayout();\r
                        this.proxyGroupBox.SuspendLayout();\r
                        this.proxyTableLayoutPanel.SuspendLayout();\r
+                       ((System.ComponentModel.ISupportInitialize)(this.repoUrlTextBoxErrorProvider)).BeginInit();\r
                        this.SuspendLayout();\r
                        // \r
                        // proxyURLLabel\r
                        // reposListTabPage\r
                        // \r
                        this.reposListTabPage.Controls.Add(this.repoTableLayoutPanel);\r
-                       this.reposListTabPage.Location = new System.Drawing.Point(4, 22);\r
+                       this.reposListTabPage.Location = new System.Drawing.Point(4, 21);\r
                        this.reposListTabPage.Name = "reposListTabPage";\r
                        this.reposListTabPage.Padding = new System.Windows.Forms.Padding(3);\r
-                       this.reposListTabPage.Size = new System.Drawing.Size(446, 214);\r
+                       this.reposListTabPage.Size = new System.Drawing.Size(446, 215);\r
                        this.reposListTabPage.TabIndex = 0;\r
                        this.reposListTabPage.Text = "レポジトリ";\r
                        this.reposListTabPage.UseVisualStyleBackColor = true;\r
                        this.repoTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
                        this.repoTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
                        this.repoTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
-                       this.repoTableLayoutPanel.Size = new System.Drawing.Size(440, 208);\r
+                       this.repoTableLayoutPanel.Size = new System.Drawing.Size(440, 209);\r
                        this.repoTableLayoutPanel.TabIndex = 1;\r
                        // \r
                        // repoListCheckedListBox\r
                        this.repoListCheckedListBox.Location = new System.Drawing.Point(3, 15);\r
                        this.repoListCheckedListBox.Name = "repoListCheckedListBox";\r
                        this.repoListCheckedListBox.ScrollAlwaysVisible = true;\r
-                       this.repoListCheckedListBox.Size = new System.Drawing.Size(347, 165);\r
+                       this.repoListCheckedListBox.Size = new System.Drawing.Size(347, 166);\r
                        this.repoListCheckedListBox.TabIndex = 1;\r
                        this.repoListCheckedListBox.SelectedIndexChanged += new System.EventHandler(this.RepoListCheckedListBoxSelectedIndexChanged);\r
                        this.repoListCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.RepoListCheckedListBoxItemCheck);\r
                        this.repoUrlTextBox.Dock = System.Windows.Forms.DockStyle.Fill;\r
                        this.repoUrlTextBox.Enabled = false;\r
                        this.repoUrlTextBox.ImeMode = System.Windows.Forms.ImeMode.Off;\r
-                       this.repoUrlTextBox.Location = new System.Drawing.Point(122, 186);\r
+                       this.repoUrlTextBox.Location = new System.Drawing.Point(122, 187);\r
                        this.repoUrlTextBox.Name = "repoUrlTextBox";\r
                        this.repoUrlTextBox.Size = new System.Drawing.Size(315, 19);\r
                        this.repoUrlTextBox.TabIndex = 3;\r
                        this.repoUrlTextBox.Leave += new System.EventHandler(this.RepoUrlTextBoxLeave);\r
+                       this.repoUrlTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.RepoUrlTextBoxValidating);\r
                        // \r
                        // repoUrlLabel\r
                        // \r
                        this.repoUrlLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));\r
                        this.repoUrlLabel.AutoSize = true;\r
                        this.repoUrlLabel.Enabled = false;\r
-                       this.repoUrlLabel.Location = new System.Drawing.Point(3, 189);\r
+                       this.repoUrlLabel.Location = new System.Drawing.Point(3, 190);\r
                        this.repoUrlLabel.Name = "repoUrlLabel";\r
                        this.repoUrlLabel.Size = new System.Drawing.Size(113, 12);\r
                        this.repoUrlLabel.TabIndex = 2;\r
                        // networkTabPage\r
                        // \r
                        this.networkTabPage.Controls.Add(this.proxyGroupBox);\r
-                       this.networkTabPage.Location = new System.Drawing.Point(4, 22);\r
+                       this.networkTabPage.Location = new System.Drawing.Point(4, 21);\r
                        this.networkTabPage.Name = "networkTabPage";\r
                        this.networkTabPage.Padding = new System.Windows.Forms.Padding(3);\r
-                       this.networkTabPage.Size = new System.Drawing.Size(446, 214);\r
+                       this.networkTabPage.Size = new System.Drawing.Size(446, 215);\r
                        this.networkTabPage.TabIndex = 1;\r
                        this.networkTabPage.Text = "接続";\r
                        this.networkTabPage.UseVisualStyleBackColor = true;\r
                        this.proxyGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;\r
                        this.proxyGroupBox.Location = new System.Drawing.Point(3, 3);\r
                        this.proxyGroupBox.Name = "proxyGroupBox";\r
-                       this.proxyGroupBox.Size = new System.Drawing.Size(440, 208);\r
+                       this.proxyGroupBox.Size = new System.Drawing.Size(440, 209);\r
                        this.proxyGroupBox.TabIndex = 1;\r
                        this.proxyGroupBox.TabStop = false;\r
                        this.proxyGroupBox.Text = "プロキシサーバー";\r
                        this.proxyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
                        this.proxyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());\r
                        this.proxyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
-                       this.proxyTableLayoutPanel.Size = new System.Drawing.Size(434, 190);\r
+                       this.proxyTableLayoutPanel.Size = new System.Drawing.Size(434, 191);\r
                        this.proxyTableLayoutPanel.TabIndex = 0;\r
                        // \r
                        // proxySameAsIERadioButton\r
                        this.openInternetOptionLinkAdminLabel.VisitedLinkColor = System.Drawing.SystemColors.HotTrack;\r
                        this.openInternetOptionLinkAdminLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OpenInternetOptionLinkLabelLinkClicked);\r
                        // \r
+                       // repoUrlTextBoxErrorProvider\r
+                       // \r
+                       this.repoUrlTextBoxErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.AlwaysBlink;\r
+                       this.repoUrlTextBoxErrorProvider.ContainerControl = this;\r
+                       // \r
                        // UserPrefForm\r
                        // \r
                        this.AcceptButton = this.okButton;\r
                        this.proxyGroupBox.ResumeLayout(false);\r
                        this.proxyTableLayoutPanel.ResumeLayout(false);\r
                        this.proxyTableLayoutPanel.PerformLayout();\r
+                       ((System.ComponentModel.ISupportInitialize)(this.repoUrlTextBoxErrorProvider)).EndInit();\r
                        this.ResumeLayout(false);\r
                }\r
+               private System.Windows.Forms.ErrorProvider repoUrlTextBoxErrorProvider;\r
                private System.Windows.Forms.ToolTip toolTip;\r
                private System.Windows.Forms.LinkLabel openInternetOptionLinkAdminLabel;\r
                private System.Windows.Forms.LinkLabel openInternetOptionLinkLabel;\r
index f3234ad..43e5b76 100644 (file)
@@ -303,5 +303,28 @@ namespace AppliStation
                void CancelButtonClick(object sender, EventArgs e)\r
                {\r
                }\r
+               \r
+               void RepoUrlTextBoxValidating(object sender, System.ComponentModel.CancelEventArgs e)\r
+               {\r
+                       string urlText = repoUrlTextBox.Text;\r
+                       \r
+                       if (string.IsNullOrEmpty(urlText)) {\r
+                               return; // special case.\r
+                       } if (Uri.IsWellFormedUriString(urlText, UriKind.Absolute) == false) {\r
+                               repoUrlTextBoxErrorProvider.SetError(repoUrlLabel, "URLの記述が不正です");\r
+                               e.Cancel = true;\r
+                       } else {\r
+                               Uri uri = new Uri(urlText);\r
+                               if ((uri.Scheme != Uri.UriSchemeFile) &&\r
+                                   (uri.Scheme != Uri.UriSchemeFtp) &&\r
+                                   (uri.Scheme != Uri.UriSchemeHttp) &&\r
+                                   (uri.Scheme != Uri.UriSchemeHttps)){\r
+                                       repoUrlTextBoxErrorProvider.SetError(repoUrlLabel, "URLの記述が不正です");\r
+                                       e.Cancel = true;\r
+                               } else {\r
+                                       repoUrlTextBoxErrorProvider.Clear();\r
+                               }\r
+                       }\r
+               }\r
        }\r
 }\r
index 5416f48..51f6c08 100644 (file)
         pwAAAABJRU5ErkJggg==\r
 </value>\r
   </data>\r
+  <metadata name="repoUrlTextBoxErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">\r
+    <value>104, 17</value>\r
+  </metadata>\r
 </root>
\ No newline at end of file
index 43ca4a4..68a05d8 100644 (file)
@@ -121,13 +121,17 @@ namespace NaGet.SubCommands
                                        Downloader.Download(repo.Url.Href, tmpfileName);\r
                                        \r
                                        if (repo.Type == RepositoryType.APPLISTATION_NATIVE_XML_1_0) {\r
-                                               PackageList<Package> pkgList = NaGet.Utils.GetDeserializedObject<PackageList<Package>>(tmpfileName);\r
-                                               pkgList.FixPackageListName(); // PackageListNameとの紐付けを行う\r
-                                               \r
-                                               // RepositoryReferenceの名前を読み込む // TODO RepositoryReferenceの名前を読み込む処理はここでいいのか?\r
-                                               repo.Name = (string.IsNullOrEmpty(pkgList.Name))? repo.Name : pkgList.Name;\r
-                                               \r
-                                               avaiablePackageList.AddPackages(pkgList.Packages);\r
+                                               try {\r
+                                                       PackageList<Package> pkgList = NaGet.Utils.GetDeserializedObject<PackageList<Package>>(tmpfileName);\r
+                                                       pkgList.FixPackageListName(); // PackageListNameとの紐付けを行う\r
+                                                       \r
+                                                       // RepositoryReferenceの名前を読み込む // TODO RepositoryReferenceの名前を読み込む処理はここでいいのか?\r
+                                                       repo.Name = (string.IsNullOrEmpty(pkgList.Name))? repo.Name : pkgList.Name;\r
+                                                       \r
+                                                       avaiablePackageList.AddPackages(pkgList.Packages);\r
+                                               } catch (InvalidOperationException e) {\r
+                                                       RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, string.Format("Repository {0} does not have a AppliStation Native XML softlist.", repo.Name ?? repo.Url.Href));\r
+                                               }\r
                                        } else {\r
                                                RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, string.Format("Repository {0} is illegal type.", repo.Name ?? repo.Url.Href));\r
                                        }\r