• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision251d694a2305bedbf5a5fcddb9d0c42d585b74c4 (tree)
Time2013-02-28 18:09:41
Authorspoon <spoon78@user...>
Commiterspoon

Log Message

Ver.0.6.1 「人大杉」に対応、終了ステータスを返すようにした

Change Summary

Incremental Difference

--- a/00.00.00.00/00.00.00.00.cs
+++ b/00.00.00.00/00.00.00.00.cs
@@ -13,7 +13,7 @@ using System.Net;
1313 /**************** 00:00:00.00 集計ツール ****************/
1414
1515 [assembly: System.Reflection.AssemblyTitle("00:00:00.00 集計ツール")]
16-[assembly: System.Reflection.AssemblyFileVersion("0.6.0")]
16+[assembly: System.Reflection.AssemblyFileVersion("0.6.1")]
1717
1818 /***** USAGE *****
1919 * ex. url => http://hayabusa.2ch.net/test/read.cgi/news4vip/1234567890/
@@ -23,7 +23,7 @@ using System.Net;
2323
2424 namespace Vip {
2525 static class Rank00 {
26- const string VERSION = "0.6.0";
26+ const string VERSION = "0.6.1";
2727
2828 static string dat, server = "hayabusa.2ch.net", board = "news4vip";
2929 static string url;
@@ -54,7 +54,7 @@ namespace Vip {
5454 }
5555 }
5656
57- static void Main(string[] args) {
57+ static int Main(string[] args) {
5858 // ********** パラメータ取得 **********
5959
6060 // (Usage) 引数一覧を表示して終了
@@ -63,7 +63,7 @@ namespace Vip {
6363 || Array.IndexOf<string>(args, "--help") != -1) {
6464 Console.WriteLine("00:00:00.00 集計ツール Ver." + VERSION);
6565 Console.WriteLine();
66- ShowUsage(); return;
66+ ShowUsage(); return 0;
6767 }
6868
6969 int index;
@@ -75,7 +75,7 @@ namespace Vip {
7575 if (index != -1) {
7676 if (args.Length == index + 1 || !int.TryParse(args[index + 1], out from) || from < 1) {
7777 Console.Error.WriteLine("Error: --from の値が正しくありません");
78- return;
78+ return 64;
7979 }
8080 args[index + 1] = "-";
8181 }
@@ -88,7 +88,7 @@ namespace Vip {
8888 if (index != -1) {
8989 if (args.Length == index + 1) {
9090 Console.Error.WriteLine("Error: -n / --ngid の値が正しくありません");
91- return;
91+ return 64;
9292 }
9393 ngId = args[index + 1].Split(',');
9494 args[index + 1] = "-";
@@ -102,7 +102,7 @@ namespace Vip {
102102 if (index != -1) {
103103 if (args.Length == index + 1) {
104104 Console.Error.WriteLine("Error: -r / --range の値が正しくありません");
105- return;
105+ return 64;
106106 }
107107 if (args[index + 1].Contains(",")) {
108108 string[] pair = args[index + 1].Split(',');
@@ -110,12 +110,12 @@ namespace Vip {
110110 || !int.TryParse(pair[0], out range) || range < 1
111111 || !int.TryParse(pair[1], out countRange) || countRange < range) {
112112 Console.Error.WriteLine("Error: -r / --range の値が正しくありません");
113- return;
113+ return 64;
114114 }
115115 } else {
116116 if (!int.TryParse(args[index + 1], out range) || range < 1) {
117117 Console.Error.WriteLine("Error: -r / --range の値が正しくありません");
118- return;
118+ return 64;
119119 }
120120 if (countRange < range) countRange = range;
121121 }
@@ -129,7 +129,7 @@ namespace Vip {
129129 if (index != -1) {
130130 if (args.Length == index + 1 || !int.TryParse(args[index + 1], out rankMax) || rankMax < 1) {
131131 Console.Error.WriteLine("Error: -m / --max の値が正しくありません");
132- return;
132+ return 64;
133133 }
134134 args[index + 1] = "-";
135135 }
@@ -141,7 +141,7 @@ namespace Vip {
141141 if (index != -1) {
142142 if (args.Length == index + 1) {
143143 Console.Error.WriteLine("Error: --local の値が正しくありません");
144- return;
144+ return 64;
145145 }
146146 local = true;
147147 localPath = args[index + 1];
@@ -152,7 +152,7 @@ namespace Vip {
152152 //args = Array.FindAll<string>(args, str => !str.StartsWith("-"));
153153 if (args.Length == 0) {
154154 Console.Error.WriteLine("Error: dat または url が指定されていません");
155- ShowUsage(); return;
155+ ShowUsage(); return 64;
156156 }
157157
158158
@@ -195,7 +195,7 @@ namespace Vip {
195195
196196 if (!File.Exists(path)) {
197197 Console.Error.WriteLine("Error: ファイルが存在しません");
198- return;
198+ return 1;
199199 }
200200
201201 // datの読込
@@ -211,8 +211,10 @@ namespace Vip {
211211
212212 Console.Title = "datをダウンロード中… " + path;
213213
214+ string resText;
215+
214216 try {
215- resLines = client.DownloadString(path).Split('\n');
217+ resText = client.DownloadString(path);
216218 }
217219 catch (WebException e) {
218220 if (e.Status == WebExceptionStatus.ProtocolError) {
@@ -234,16 +236,23 @@ namespace Vip {
234236 } else {
235237 Console.Error.WriteLine("Error: ダウンロード中にエラーが発生しました ({0})", e.Status);
236238 }
237- return;
239+ return 1;
240+ }
241+ if (resText.Contains("<title>もうずっと人大杉</title>")) {
242+ Console.Error.WriteLine("Error: dat (10桁の数字) を間違えていませんか? (人大杉)");
243+ return 1;
238244 }
245+
239246 Console.Title = "datをダウンロードしました";
247+
248+ resLines = resText.Split('\n');
240249 }
241250
242251 #if DAT
243252 Console.WriteLine("---------- DAT ----------");
244253 //Console.WriteLine(File.ReadAllText(path, Encoding.GetEncoding("Shift_JIS")));
245- Console.WriteLine(File.ReadAllLines(path, Encoding.GetEncoding("Shift_JIS"))[0]);
246- return;
254+ Console.WriteLine(string.Join("\n", resLines));
255+ return 0;
247256 #endif
248257
249258 // ********** datの解析 & レス抽出 **********
@@ -289,7 +298,7 @@ namespace Vip {
289298
290299 if (resList.Count == 0) {
291300 Console.Error.WriteLine("±{0}秒以内のレスがありませんでした", range);
292- return;
301+ return 2;
293302 }
294303
295304 #if DEBUG
@@ -362,7 +371,7 @@ namespace Vip {
362371 Console.WriteLine("±{0}秒以内に入った人: {1} 人  本日の参加者: {2} 人 (±{3}秒)",
363372 range, resList.Count,
364373 count, countRange);
365-
374+ return 0;
366375 }
367376
368377 private static void ShowUsage() {
--- a/00.00.00.00/00.00.00.00.csproj
+++ b/00.00.00.00/00.00.00.00.csproj
@@ -8,7 +8,7 @@
88 <ProjectGuid>{1FA0AA74-80BB-4FCE-8E87-C7472BBAFCB1}</ProjectGuid>
99 <OutputType>Exe</OutputType>
1010 <AssemblyName>00.00.00.00</AssemblyName>
11- <ReleaseVersion>0.5.1</ReleaseVersion>
11+ <ReleaseVersion>0.6.1</ReleaseVersion>
1212 <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
1313 </PropertyGroup>
1414 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -20,6 +20,7 @@
2020 <ErrorReport>prompt</ErrorReport>
2121 <WarningLevel>4</WarningLevel>
2222 <ConsolePause>false</ConsolePause>
23+ <Commandlineparameters>--help</Commandlineparameters>
2324 </PropertyGroup>
2425 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2526 <DebugType>none</DebugType>
Binary files a/00.00.00.00/00.00.00.00.pidb and b/00.00.00.00/00.00.00.00.pidb differ
--- a/00.00.00.00/readme.txt
+++ b/00.00.00.00/readme.txt
@@ -1,21 +1,21 @@
1-************************************************************
2- 00:00:00.00 集計ツール Ver.0.6.0
3-************************************************************
1+********************************************************************************
2+ 00:00:00.00 集計ツール Ver.0.6.1
3+********************************************************************************
44
5-某巨大掲示板群のとある板にて毎日開催されている、書き込み時刻で00:00:00.00にどれだけ
6-近づけるかを競う遊びのために作成された集計ツールです。
5+某巨大掲示板群のとある板にて毎日開催されている、書き込み時刻で00:00:00.00に
6+どれだけ近づけるかを競う遊びのために作成された集計ツールです。
77
88
99 ■ CUI版の使い方
1010 コマンドプロンプトを起動して00.00.00.00.exeのあるディレクトリに移動し、
11- > 00.00.00.00 http://***.2ch.net/test/read.cgi/news4vip/0000000000/
11+ C:\> 00.00.00.00 http://***.2ch.net/test/read.cgi/news4vip/0000000000/
1212 のように入力しEnter。(URLの部分はスレッドのURLに差し替える)
1313 すると、datを自動でダウンロードし、集計結果を出力します。
1414
15- > 00.00.00.00 -h
15+ C:\> 00.00.00.00 -h
1616 で、パラメータ一覧が出てきます。
1717
18- Windows XPで動作確認。Mono使えばMac/Linuxでも動くかも(後述)。
18+ Windows XPで動作確認。Mono使えばMac/Linuxでも動きます(後述)。
1919
2020
2121 ■ GUI版は公開準備中です。
--- a/Rank00.csproj
+++ b/Rank00.csproj
@@ -33,7 +33,7 @@
3333 <UseApplicationTrust>false</UseApplicationTrust>
3434 <PublishWizardCompleted>true</PublishWizardCompleted>
3535 <BootstrapperEnabled>true</BootstrapperEnabled>
36- <ReleaseVersion>0.5.1</ReleaseVersion>
36+ <ReleaseVersion>0.6.1</ReleaseVersion>
3737 </PropertyGroup>
3838 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
3939 <DebugSymbols>true</DebugSymbols>
@@ -106,7 +106,6 @@
106106 <None Include="MainForm_backup.Designer.cs">
107107 <DependentUpon>MainForm_backup.cs</DependentUpon>
108108 </None>
109- <None Include="Rank00_TemporaryKey.pfx" />
110109 </ItemGroup>
111110 <ItemGroup>
112111 <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
Binary files a/Rank00.pidb and b/Rank00.pidb differ
--- a/Rank00.sln
+++ b/Rank00.sln
@@ -68,7 +68,7 @@ Global
6868 $0.StandardHeader = $9
6969 $9.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) ${Year} ${CopyrightHolder}\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.
7070 $9.IncludeInNewFiles = True
71- version = 0.5.1
71+ version = 0.6.1
7272 EndGlobalSection
7373 GlobalSection(SolutionProperties) = preSolution
7474 HideSolutionNode = FALSE
--- a/Rank00.userprefs
+++ b/Rank00.userprefs
@@ -1,9 +1,9 @@
11 <Properties>
2- <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
2+ <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" />
33 <MonoDevelop.Ide.Workbench ActiveDocument="00.00.00.00/00.00.00.00.cs">
44 <Files>
5- <File FileName="00.00.00.00/00.00.00.00.cs" Line="12" Column="1" />
6- <File FileName="00.00.00.00/readme.txt" Line="14" Column="1" />
5+ <File FileName="00.00.00.00/00.00.00.00.cs" Line="374" Column="25" />
6+ <File FileName="00.00.00.00/readme.txt" Line="43" Column="25" />
77 </Files>
88 </MonoDevelop.Ide.Workbench>
99 <MonoDevelop.Ide.DebuggingService.Breakpoints>