• R/O
  • HTTP
  • SSH
  • HTTPS

AppliStation: 提交

AppliStation


Commit MetaInfo

修订版6595e9d3e70c3566bc22294f57464ee16ff30fd2 (tree)
时间2009-06-21 20:16:29
作者ttp <ttp@user...>
Commiterttp

Log Message

AppliStation,na-get,プロバイダURLのエラー処理を追加。

- XML整形式でないソフトリストを読み込むと死亡するバグの修正(WARNINGに変更)
- ソフトリスト設定GUIにて、URL文法チェックをするように改造

更改概述

差异

--- a/AppliStation/UserPrefForm.Designer.cs
+++ b/AppliStation/UserPrefForm.Designer.cs
@@ -57,6 +57,7 @@
5757 this.openInternetOptionLinkLabel = new System.Windows.Forms.LinkLabel();
5858 this.openInternetOptionLinkAdminLabel = new System.Windows.Forms.LinkLabel();
5959 this.toolTip = new System.Windows.Forms.ToolTip(this.components);
60+ this.repoUrlTextBoxErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
6061 this.tableLayoutPanel.SuspendLayout();
6162 this.buttonsPanel.SuspendLayout();
6263 this.tabControl.SuspendLayout();
@@ -66,6 +67,7 @@
6667 this.networkTabPage.SuspendLayout();
6768 this.proxyGroupBox.SuspendLayout();
6869 this.proxyTableLayoutPanel.SuspendLayout();
70+ ((System.ComponentModel.ISupportInitialize)(this.repoUrlTextBoxErrorProvider)).BeginInit();
6971 this.SuspendLayout();
7072 //
7173 // proxyURLLabel
@@ -150,10 +152,10 @@
150152 // reposListTabPage
151153 //
152154 this.reposListTabPage.Controls.Add(this.repoTableLayoutPanel);
153- this.reposListTabPage.Location = new System.Drawing.Point(4, 22);
155+ this.reposListTabPage.Location = new System.Drawing.Point(4, 21);
154156 this.reposListTabPage.Name = "reposListTabPage";
155157 this.reposListTabPage.Padding = new System.Windows.Forms.Padding(3);
156- this.reposListTabPage.Size = new System.Drawing.Size(446, 214);
158+ this.reposListTabPage.Size = new System.Drawing.Size(446, 215);
157159 this.reposListTabPage.TabIndex = 0;
158160 this.reposListTabPage.Text = "レポジトリ";
159161 this.reposListTabPage.UseVisualStyleBackColor = true;
@@ -176,7 +178,7 @@
176178 this.repoTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
177179 this.repoTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
178180 this.repoTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
179- this.repoTableLayoutPanel.Size = new System.Drawing.Size(440, 208);
181+ this.repoTableLayoutPanel.Size = new System.Drawing.Size(440, 209);
180182 this.repoTableLayoutPanel.TabIndex = 1;
181183 //
182184 // repoListCheckedListBox
@@ -188,7 +190,7 @@
188190 this.repoListCheckedListBox.Location = new System.Drawing.Point(3, 15);
189191 this.repoListCheckedListBox.Name = "repoListCheckedListBox";
190192 this.repoListCheckedListBox.ScrollAlwaysVisible = true;
191- this.repoListCheckedListBox.Size = new System.Drawing.Size(347, 165);
193+ this.repoListCheckedListBox.Size = new System.Drawing.Size(347, 166);
192194 this.repoListCheckedListBox.TabIndex = 1;
193195 this.repoListCheckedListBox.SelectedIndexChanged += new System.EventHandler(this.RepoListCheckedListBoxSelectedIndexChanged);
194196 this.repoListCheckedListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.RepoListCheckedListBoxItemCheck);
@@ -252,18 +254,19 @@
252254 this.repoUrlTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
253255 this.repoUrlTextBox.Enabled = false;
254256 this.repoUrlTextBox.ImeMode = System.Windows.Forms.ImeMode.Off;
255- this.repoUrlTextBox.Location = new System.Drawing.Point(122, 186);
257+ this.repoUrlTextBox.Location = new System.Drawing.Point(122, 187);
256258 this.repoUrlTextBox.Name = "repoUrlTextBox";
257259 this.repoUrlTextBox.Size = new System.Drawing.Size(315, 19);
258260 this.repoUrlTextBox.TabIndex = 3;
259261 this.repoUrlTextBox.Leave += new System.EventHandler(this.RepoUrlTextBoxLeave);
262+ this.repoUrlTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.RepoUrlTextBoxValidating);
260263 //
261264 // repoUrlLabel
262265 //
263266 this.repoUrlLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
264267 this.repoUrlLabel.AutoSize = true;
265268 this.repoUrlLabel.Enabled = false;
266- this.repoUrlLabel.Location = new System.Drawing.Point(3, 189);
269+ this.repoUrlLabel.Location = new System.Drawing.Point(3, 190);
267270 this.repoUrlLabel.Name = "repoUrlLabel";
268271 this.repoUrlLabel.Size = new System.Drawing.Size(113, 12);
269272 this.repoUrlLabel.TabIndex = 2;
@@ -282,10 +285,10 @@
282285 // networkTabPage
283286 //
284287 this.networkTabPage.Controls.Add(this.proxyGroupBox);
285- this.networkTabPage.Location = new System.Drawing.Point(4, 22);
288+ this.networkTabPage.Location = new System.Drawing.Point(4, 21);
286289 this.networkTabPage.Name = "networkTabPage";
287290 this.networkTabPage.Padding = new System.Windows.Forms.Padding(3);
288- this.networkTabPage.Size = new System.Drawing.Size(446, 214);
291+ this.networkTabPage.Size = new System.Drawing.Size(446, 215);
289292 this.networkTabPage.TabIndex = 1;
290293 this.networkTabPage.Text = "接続";
291294 this.networkTabPage.UseVisualStyleBackColor = true;
@@ -296,7 +299,7 @@
296299 this.proxyGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
297300 this.proxyGroupBox.Location = new System.Drawing.Point(3, 3);
298301 this.proxyGroupBox.Name = "proxyGroupBox";
299- this.proxyGroupBox.Size = new System.Drawing.Size(440, 208);
302+ this.proxyGroupBox.Size = new System.Drawing.Size(440, 209);
300303 this.proxyGroupBox.TabIndex = 1;
301304 this.proxyGroupBox.TabStop = false;
302305 this.proxyGroupBox.Text = "プロキシサーバー";
@@ -325,7 +328,7 @@
325328 this.proxyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
326329 this.proxyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
327330 this.proxyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
328- this.proxyTableLayoutPanel.Size = new System.Drawing.Size(434, 190);
331+ this.proxyTableLayoutPanel.Size = new System.Drawing.Size(434, 191);
329332 this.proxyTableLayoutPanel.TabIndex = 0;
330333 //
331334 // proxySameAsIERadioButton
@@ -411,6 +414,11 @@
411414 this.openInternetOptionLinkAdminLabel.VisitedLinkColor = System.Drawing.SystemColors.HotTrack;
412415 this.openInternetOptionLinkAdminLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.OpenInternetOptionLinkLabelLinkClicked);
413416 //
417+ // repoUrlTextBoxErrorProvider
418+ //
419+ this.repoUrlTextBoxErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.AlwaysBlink;
420+ this.repoUrlTextBoxErrorProvider.ContainerControl = this;
421+ //
414422 // UserPrefForm
415423 //
416424 this.AcceptButton = this.okButton;
@@ -439,8 +447,10 @@
439447 this.proxyGroupBox.ResumeLayout(false);
440448 this.proxyTableLayoutPanel.ResumeLayout(false);
441449 this.proxyTableLayoutPanel.PerformLayout();
450+ ((System.ComponentModel.ISupportInitialize)(this.repoUrlTextBoxErrorProvider)).EndInit();
442451 this.ResumeLayout(false);
443452 }
453+ private System.Windows.Forms.ErrorProvider repoUrlTextBoxErrorProvider;
444454 private System.Windows.Forms.ToolTip toolTip;
445455 private System.Windows.Forms.LinkLabel openInternetOptionLinkAdminLabel;
446456 private System.Windows.Forms.LinkLabel openInternetOptionLinkLabel;
--- a/AppliStation/UserPrefForm.cs
+++ b/AppliStation/UserPrefForm.cs
@@ -303,5 +303,28 @@ namespace AppliStation
303303 void CancelButtonClick(object sender, EventArgs e)
304304 {
305305 }
306+
307+ void RepoUrlTextBoxValidating(object sender, System.ComponentModel.CancelEventArgs e)
308+ {
309+ string urlText = repoUrlTextBox.Text;
310+
311+ if (string.IsNullOrEmpty(urlText)) {
312+ return; // special case.
313+ } if (Uri.IsWellFormedUriString(urlText, UriKind.Absolute) == false) {
314+ repoUrlTextBoxErrorProvider.SetError(repoUrlLabel, "URLの記述が不正です");
315+ e.Cancel = true;
316+ } else {
317+ Uri uri = new Uri(urlText);
318+ if ((uri.Scheme != Uri.UriSchemeFile) &&
319+ (uri.Scheme != Uri.UriSchemeFtp) &&
320+ (uri.Scheme != Uri.UriSchemeHttp) &&
321+ (uri.Scheme != Uri.UriSchemeHttps)){
322+ repoUrlTextBoxErrorProvider.SetError(repoUrlLabel, "URLの記述が不正です");
323+ e.Cancel = true;
324+ } else {
325+ repoUrlTextBoxErrorProvider.Clear();
326+ }
327+ }
328+ }
306329 }
307330 }
--- a/AppliStation/UserPrefForm.resx
+++ b/AppliStation/UserPrefForm.resx
@@ -139,4 +139,7 @@
139139 pwAAAABJRU5ErkJggg==
140140 </value>
141141 </data>
142+ <metadata name="repoUrlTextBoxErrorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
143+ <value>104, 17</value>
144+ </metadata>
142145 </root>
\ No newline at end of file
--- a/na-get-lib/NaGet.SubCommands/NaGetUpdate.cs
+++ b/na-get-lib/NaGet.SubCommands/NaGetUpdate.cs
@@ -121,13 +121,17 @@ namespace NaGet.SubCommands
121121 Downloader.Download(repo.Url.Href, tmpfileName);
122122
123123 if (repo.Type == RepositoryType.APPLISTATION_NATIVE_XML_1_0) {
124- PackageList<Package> pkgList = NaGet.Utils.GetDeserializedObject<PackageList<Package>>(tmpfileName);
125- pkgList.FixPackageListName(); // PackageListNameとの紐付けを行う
126-
127- // RepositoryReferenceの名前を読み込む // TODO RepositoryReferenceの名前を読み込む処理はここでいいのか?
128- repo.Name = (string.IsNullOrEmpty(pkgList.Name))? repo.Name : pkgList.Name;
129-
130- avaiablePackageList.AddPackages(pkgList.Packages);
124+ try {
125+ PackageList<Package> pkgList = NaGet.Utils.GetDeserializedObject<PackageList<Package>>(tmpfileName);
126+ pkgList.FixPackageListName(); // PackageListNameとの紐付けを行う
127+
128+ // RepositoryReferenceの名前を読み込む // TODO RepositoryReferenceの名前を読み込む処理はここでいいのか?
129+ repo.Name = (string.IsNullOrEmpty(pkgList.Name))? repo.Name : pkgList.Name;
130+
131+ avaiablePackageList.AddPackages(pkgList.Packages);
132+ } catch (InvalidOperationException e) {
133+ RaiseTaskSetEvent(NaGetTaskSetEventType.ERROR, string.Format("Repository {0} does not have a AppliStation Native XML softlist.", repo.Name ?? repo.Url.Href));
134+ }
131135 } else {
132136 RaiseTaskSetEvent(NaGetTaskSetEventType.WARNING, string.Format("Repository {0} is illegal type.", repo.Name ?? repo.Url.Href));
133137 }
Show on old repository browser