| Revision | 251d694a2305bedbf5a5fcddb9d0c42d585b74c4 (tree) |
|---|---|
| Time | 2013-02-28 18:09:41 |
| Author | spoon <spoon78@user...> |
| Commiter | spoon |
Ver.0.6.1 「人大杉」に対応、終了ステータスを返すようにした
| @@ -13,7 +13,7 @@ using System.Net; | ||
| 13 | 13 | /**************** 00:00:00.00 集計ツール ****************/ |
| 14 | 14 | |
| 15 | 15 | [assembly: System.Reflection.AssemblyTitle("00:00:00.00 集計ツール")] |
| 16 | -[assembly: System.Reflection.AssemblyFileVersion("0.6.0")] | |
| 16 | +[assembly: System.Reflection.AssemblyFileVersion("0.6.1")] | |
| 17 | 17 | |
| 18 | 18 | /***** USAGE ***** |
| 19 | 19 | * ex. url => http://hayabusa.2ch.net/test/read.cgi/news4vip/1234567890/ |
| @@ -23,7 +23,7 @@ using System.Net; | ||
| 23 | 23 | |
| 24 | 24 | namespace Vip { |
| 25 | 25 | static class Rank00 { |
| 26 | - const string VERSION = "0.6.0"; | |
| 26 | + const string VERSION = "0.6.1"; | |
| 27 | 27 | |
| 28 | 28 | static string dat, server = "hayabusa.2ch.net", board = "news4vip"; |
| 29 | 29 | static string url; |
| @@ -54,7 +54,7 @@ namespace Vip { | ||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - static void Main(string[] args) { | |
| 57 | + static int Main(string[] args) { | |
| 58 | 58 | // ********** パラメータ取得 ********** |
| 59 | 59 | |
| 60 | 60 | // (Usage) 引数一覧を表示して終了 |
| @@ -63,7 +63,7 @@ namespace Vip { | ||
| 63 | 63 | || Array.IndexOf<string>(args, "--help") != -1) { |
| 64 | 64 | Console.WriteLine("00:00:00.00 集計ツール Ver." + VERSION); |
| 65 | 65 | Console.WriteLine(); |
| 66 | - ShowUsage(); return; | |
| 66 | + ShowUsage(); return 0; | |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | int index; |
| @@ -75,7 +75,7 @@ namespace Vip { | ||
| 75 | 75 | if (index != -1) { |
| 76 | 76 | if (args.Length == index + 1 || !int.TryParse(args[index + 1], out from) || from < 1) { |
| 77 | 77 | Console.Error.WriteLine("Error: --from の値が正しくありません"); |
| 78 | - return; | |
| 78 | + return 64; | |
| 79 | 79 | } |
| 80 | 80 | args[index + 1] = "-"; |
| 81 | 81 | } |
| @@ -88,7 +88,7 @@ namespace Vip { | ||
| 88 | 88 | if (index != -1) { |
| 89 | 89 | if (args.Length == index + 1) { |
| 90 | 90 | Console.Error.WriteLine("Error: -n / --ngid の値が正しくありません"); |
| 91 | - return; | |
| 91 | + return 64; | |
| 92 | 92 | } |
| 93 | 93 | ngId = args[index + 1].Split(','); |
| 94 | 94 | args[index + 1] = "-"; |
| @@ -102,7 +102,7 @@ namespace Vip { | ||
| 102 | 102 | if (index != -1) { |
| 103 | 103 | if (args.Length == index + 1) { |
| 104 | 104 | Console.Error.WriteLine("Error: -r / --range の値が正しくありません"); |
| 105 | - return; | |
| 105 | + return 64; | |
| 106 | 106 | } |
| 107 | 107 | if (args[index + 1].Contains(",")) { |
| 108 | 108 | string[] pair = args[index + 1].Split(','); |
| @@ -110,12 +110,12 @@ namespace Vip { | ||
| 110 | 110 | || !int.TryParse(pair[0], out range) || range < 1 |
| 111 | 111 | || !int.TryParse(pair[1], out countRange) || countRange < range) { |
| 112 | 112 | Console.Error.WriteLine("Error: -r / --range の値が正しくありません"); |
| 113 | - return; | |
| 113 | + return 64; | |
| 114 | 114 | } |
| 115 | 115 | } else { |
| 116 | 116 | if (!int.TryParse(args[index + 1], out range) || range < 1) { |
| 117 | 117 | Console.Error.WriteLine("Error: -r / --range の値が正しくありません"); |
| 118 | - return; | |
| 118 | + return 64; | |
| 119 | 119 | } |
| 120 | 120 | if (countRange < range) countRange = range; |
| 121 | 121 | } |
| @@ -129,7 +129,7 @@ namespace Vip { | ||
| 129 | 129 | if (index != -1) { |
| 130 | 130 | if (args.Length == index + 1 || !int.TryParse(args[index + 1], out rankMax) || rankMax < 1) { |
| 131 | 131 | Console.Error.WriteLine("Error: -m / --max の値が正しくありません"); |
| 132 | - return; | |
| 132 | + return 64; | |
| 133 | 133 | } |
| 134 | 134 | args[index + 1] = "-"; |
| 135 | 135 | } |
| @@ -141,7 +141,7 @@ namespace Vip { | ||
| 141 | 141 | if (index != -1) { |
| 142 | 142 | if (args.Length == index + 1) { |
| 143 | 143 | Console.Error.WriteLine("Error: --local の値が正しくありません"); |
| 144 | - return; | |
| 144 | + return 64; | |
| 145 | 145 | } |
| 146 | 146 | local = true; |
| 147 | 147 | localPath = args[index + 1]; |
| @@ -152,7 +152,7 @@ namespace Vip { | ||
| 152 | 152 | //args = Array.FindAll<string>(args, str => !str.StartsWith("-")); |
| 153 | 153 | if (args.Length == 0) { |
| 154 | 154 | Console.Error.WriteLine("Error: dat または url が指定されていません"); |
| 155 | - ShowUsage(); return; | |
| 155 | + ShowUsage(); return 64; | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 |
| @@ -195,7 +195,7 @@ namespace Vip { | ||
| 195 | 195 | |
| 196 | 196 | if (!File.Exists(path)) { |
| 197 | 197 | Console.Error.WriteLine("Error: ファイルが存在しません"); |
| 198 | - return; | |
| 198 | + return 1; | |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // datの読込 |
| @@ -211,8 +211,10 @@ namespace Vip { | ||
| 211 | 211 | |
| 212 | 212 | Console.Title = "datをダウンロード中… " + path; |
| 213 | 213 | |
| 214 | + string resText; | |
| 215 | + | |
| 214 | 216 | try { |
| 215 | - resLines = client.DownloadString(path).Split('\n'); | |
| 217 | + resText = client.DownloadString(path); | |
| 216 | 218 | } |
| 217 | 219 | catch (WebException e) { |
| 218 | 220 | if (e.Status == WebExceptionStatus.ProtocolError) { |
| @@ -234,16 +236,23 @@ namespace Vip { | ||
| 234 | 236 | } else { |
| 235 | 237 | Console.Error.WriteLine("Error: ダウンロード中にエラーが発生しました ({0})", e.Status); |
| 236 | 238 | } |
| 237 | - return; | |
| 239 | + return 1; | |
| 240 | + } | |
| 241 | + if (resText.Contains("<title>もうずっと人大杉</title>")) { | |
| 242 | + Console.Error.WriteLine("Error: dat (10桁の数字) を間違えていませんか? (人大杉)"); | |
| 243 | + return 1; | |
| 238 | 244 | } |
| 245 | + | |
| 239 | 246 | Console.Title = "datをダウンロードしました"; |
| 247 | + | |
| 248 | + resLines = resText.Split('\n'); | |
| 240 | 249 | } |
| 241 | 250 | |
| 242 | 251 | #if DAT |
| 243 | 252 | Console.WriteLine("---------- DAT ----------"); |
| 244 | 253 | //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; | |
| 247 | 256 | #endif |
| 248 | 257 | |
| 249 | 258 | // ********** datの解析 & レス抽出 ********** |
| @@ -289,7 +298,7 @@ namespace Vip { | ||
| 289 | 298 | |
| 290 | 299 | if (resList.Count == 0) { |
| 291 | 300 | Console.Error.WriteLine("±{0}秒以内のレスがありませんでした", range); |
| 292 | - return; | |
| 301 | + return 2; | |
| 293 | 302 | } |
| 294 | 303 | |
| 295 | 304 | #if DEBUG |
| @@ -362,7 +371,7 @@ namespace Vip { | ||
| 362 | 371 | Console.WriteLine("±{0}秒以内に入った人: {1} 人 本日の参加者: {2} 人 (±{3}秒)", |
| 363 | 372 | range, resList.Count, |
| 364 | 373 | count, countRange); |
| 365 | - | |
| 374 | + return 0; | |
| 366 | 375 | } |
| 367 | 376 | |
| 368 | 377 | private static void ShowUsage() { |
| @@ -8,7 +8,7 @@ | ||
| 8 | 8 | <ProjectGuid>{1FA0AA74-80BB-4FCE-8E87-C7472BBAFCB1}</ProjectGuid> |
| 9 | 9 | <OutputType>Exe</OutputType> |
| 10 | 10 | <AssemblyName>00.00.00.00</AssemblyName> |
| 11 | - <ReleaseVersion>0.5.1</ReleaseVersion> | |
| 11 | + <ReleaseVersion>0.6.1</ReleaseVersion> | |
| 12 | 12 | <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
| 13 | 13 | </PropertyGroup> |
| 14 | 14 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
| @@ -20,6 +20,7 @@ | ||
| 20 | 20 | <ErrorReport>prompt</ErrorReport> |
| 21 | 21 | <WarningLevel>4</WarningLevel> |
| 22 | 22 | <ConsolePause>false</ConsolePause> |
| 23 | + <Commandlineparameters>--help</Commandlineparameters> | |
| 23 | 24 | </PropertyGroup> |
| 24 | 25 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
| 25 | 26 | <DebugType>none</DebugType> |
| @@ -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 | +******************************************************************************** | |
| 4 | 4 | |
| 5 | -某巨大掲示板群のとある板にて毎日開催されている、書き込み時刻で00:00:00.00にどれだけ | |
| 6 | -近づけるかを競う遊びのために作成された集計ツールです。 | |
| 5 | +某巨大掲示板群のとある板にて毎日開催されている、書き込み時刻で00:00:00.00に | |
| 6 | +どれだけ近づけるかを競う遊びのために作成された集計ツールです。 | |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | ■ CUI版の使い方 |
| 10 | 10 | コマンドプロンプトを起動して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/ | |
| 12 | 12 | のように入力しEnter。(URLの部分はスレッドのURLに差し替える) |
| 13 | 13 | すると、datを自動でダウンロードし、集計結果を出力します。 |
| 14 | 14 | |
| 15 | - > 00.00.00.00 -h | |
| 15 | + C:\> 00.00.00.00 -h | |
| 16 | 16 | で、パラメータ一覧が出てきます。 |
| 17 | 17 | |
| 18 | - Windows XPで動作確認。Mono使えばMac/Linuxでも動くかも(後述)。 | |
| 18 | + Windows XPで動作確認。Mono使えばMac/Linuxでも動きます(後述)。 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | ■ GUI版は公開準備中です。 |
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | <UseApplicationTrust>false</UseApplicationTrust> |
| 34 | 34 | <PublishWizardCompleted>true</PublishWizardCompleted> |
| 35 | 35 | <BootstrapperEnabled>true</BootstrapperEnabled> |
| 36 | - <ReleaseVersion>0.5.1</ReleaseVersion> | |
| 36 | + <ReleaseVersion>0.6.1</ReleaseVersion> | |
| 37 | 37 | </PropertyGroup> |
| 38 | 38 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
| 39 | 39 | <DebugSymbols>true</DebugSymbols> |
| @@ -106,7 +106,6 @@ | ||
| 106 | 106 | <None Include="MainForm_backup.Designer.cs"> |
| 107 | 107 | <DependentUpon>MainForm_backup.cs</DependentUpon> |
| 108 | 108 | </None> |
| 109 | - <None Include="Rank00_TemporaryKey.pfx" /> | |
| 110 | 109 | </ItemGroup> |
| 111 | 110 | <ItemGroup> |
| 112 | 111 | <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> |
| @@ -68,7 +68,7 @@ Global | ||
| 68 | 68 | $0.StandardHeader = $9 |
| 69 | 69 | $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. |
| 70 | 70 | $9.IncludeInNewFiles = True |
| 71 | - version = 0.5.1 | |
| 71 | + version = 0.6.1 | |
| 72 | 72 | EndGlobalSection |
| 73 | 73 | GlobalSection(SolutionProperties) = preSolution |
| 74 | 74 | HideSolutionNode = FALSE |
| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <Properties> |
| 2 | - <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> | |
| 2 | + <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" /> | |
| 3 | 3 | <MonoDevelop.Ide.Workbench ActiveDocument="00.00.00.00/00.00.00.00.cs"> |
| 4 | 4 | <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" /> | |
| 7 | 7 | </Files> |
| 8 | 8 | </MonoDevelop.Ide.Workbench> |
| 9 | 9 | <MonoDevelop.Ide.DebuggingService.Breakpoints> |