• 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

Revisiona7ea60106d30345d5b632b5cd4a4d7f2d62a3379 (tree)
Time2012-11-11 03:07:56
Authorspoon <spoon78@user...>
Commiterspoon

Log Message

Ver.0.6.0 -r/--range, -m/--max を追加

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,21 +13,21 @@ using System.Net;
1313 /**************** 00:00:00.00 集計ツール ****************/
1414
1515 [assembly: System.Reflection.AssemblyTitle("00:00:00.00 集計ツール")]
16-[assembly: System.Reflection.AssemblyFileVersion("0.5.1")]
16+[assembly: System.Reflection.AssemblyFileVersion("0.6.0")]
1717
1818 /***** USAGE *****
19- * ex. url => http://ex14.vip2ch.com/test/read.cgi/news4vip/1292079479/
20- * > 00.00.00.00 http://ex14.vip2ch.com/test/read.cgi/news4vip/1292079479/
21- * > 00.00.00.00 1292079479 ex14.vip2ch.com
19+ * ex. url => http://hayabusa.2ch.net/test/read.cgi/news4vip/1234567890/
20+ * > 00.00.00.00 http://hayabusa.2ch.net/test/read.cgi/news4vip/1234567890/
21+ * > 00.00.00.00 1234567890 hayabusa.2ch.net
2222 */
2323
2424 namespace Vip {
2525 static class Rank00 {
26- const string VERSION = "0.5.1";
26+ const string VERSION = "0.6.0";
2727
2828 static string dat, server = "hayabusa.2ch.net", board = "news4vip";
2929 static string url;
30- static int range = 1, rankMax = 20, from = 1, count, countRange = 10;
30+ static int range = 1, rankMax = 20, from = 1, count, countRange = 5;
3131 static string[] ngId;
3232 static bool local = false;
3333 static string localPath;
@@ -82,17 +82,58 @@ namespace Vip {
8282
8383 // * NGID
8484 // 除外したい ID:*** をカンマ区切りで指定
85- // ex. -ng oBJccH+E0,7DnAJlQ/P
86- index = Array.IndexOf<string>(args, "--ngid");
85+ // ex. --ngid oBJccH+E0,7DnAJlQ/P
86+ index = Array.IndexOf<string>(args, "-n");
87+ if (index == -1) index = Array.IndexOf<string>(args, "--ngid");
8788 if (index != -1) {
8889 if (args.Length == index + 1) {
89- Console.Error.WriteLine("Error: --ngid の値が正しくありません");
90+ Console.Error.WriteLine("Error: -n / --ngid の値が正しくありません");
9091 return;
9192 }
9293 ngId = args[index + 1].Split(',');
9394 args[index + 1] = "-";
9495 }
9596
97+ // * 集計対象 / 参加人数の対象範囲
98+ // ±(range)秒以内を集計対象に (デフォルト値: 1)
99+ // ±(countRange)秒以内を参加人数の対象に (デフォルト値: 5)
100+ index = Array.IndexOf<string>(args, "-r");
101+ if (index == -1) index = Array.IndexOf<string>(args, "--range");
102+ if (index != -1) {
103+ if (args.Length == index + 1) {
104+ Console.Error.WriteLine("Error: -r / --range の値が正しくありません");
105+ return;
106+ }
107+ if (args[index + 1].Contains(",")) {
108+ string[] pair = args[index + 1].Split(',');
109+ if (pair.Length != 2
110+ || !int.TryParse(pair[0], out range) || range < 1
111+ || !int.TryParse(pair[1], out countRange) || countRange < range) {
112+ Console.Error.WriteLine("Error: -r / --range の値が正しくありません");
113+ return;
114+ }
115+ } else {
116+ if (!int.TryParse(args[index + 1], out range) || range < 1) {
117+ Console.Error.WriteLine("Error: -r / --range の値が正しくありません");
118+ return;
119+ }
120+ if (countRange < range) countRange = range;
121+ }
122+ args[index + 1] = "-";
123+ }
124+
125+ // * 最大順位
126+ // 表示する最大の順位を指定
127+ index = Array.IndexOf<string>(args, "-m");
128+ if (index == -1) index = Array.IndexOf<string>(args, "--max");
129+ if (index != -1) {
130+ if (args.Length == index + 1 || !int.TryParse(args[index + 1], out rankMax) || rankMax < 1) {
131+ Console.Error.WriteLine("Error: -m / --max の値が正しくありません");
132+ return;
133+ }
134+ args[index + 1] = "-";
135+ }
136+
96137 // * ローカルdat利用
97138 // ローカルのdatを利用する
98139 // (指定されない場合は、datをダウンロードする)
@@ -191,7 +232,7 @@ namespace Vip {
191232 } else if (e.Status == WebExceptionStatus.NameResolutionFailure) {
192233 Console.Error.WriteLine("Error: DNSエラー URLを確認してください (NameResolutionFailure)");
193234 } else {
194- Console.Error.WriteLine("Error: エラーが発生しました ({0})", e.Status);
235+ Console.Error.WriteLine("Error: ダウンロード中にエラーが発生しました ({0})", e.Status);
195236 }
196237 return;
197238 }
@@ -283,7 +324,7 @@ namespace Vip {
283324 else if (duration == lastDuration)
284325 rankString = "     ";
285326 else {
286- if (i >= rankMax) break;
327+ if (i >= rankMax) break; // 最大順位オーバー
287328 rankString = (i < 9 ? ". " : null) + (i + 1) + "位 ";
288329 lastDuration = duration;
289330 }
@@ -318,16 +359,16 @@ namespace Vip {
318359 "#{arr[2]} (#{device})#{" おめでとう!" if arr[1].zero?}"
319360 */
320361
321- Console.WriteLine("±1秒以内に入った人: {0} 人  本日の参加者: {1} 人 (±{2}秒)",
322- resList.Count,
362+ Console.WriteLine("±{0}秒以内に入った人: {1} 人  本日の参加者: {2} 人 (±{3}秒)",
363+ range, resList.Count,
323364 count, countRange);
324365
325366 }
326367
327368 private static void ShowUsage() {
328369 Console.Error.WriteLine(@"引数: 00.00.00.00 (<dat> [<server> [<board>]] | <url>) [--from <n>]
329- [(-i | --ngid) <id>[,<id>...]] [--local <path> | --dl]
330- [-h | -?]
370+ [(-n | --ngid) <id>[,<id>...]] [(-r | --range) <sec>[,<sec2>]]
371+ [(-m | --max) <rank>] [--local <path> | --dl] [-h | -?]
331372
332373 <dat> URLの10桁の数字
333374 <server> URLのドメインの部分
@@ -335,9 +376,14 @@ namespace Vip {
335376 <url> URLを直接指定 (http://<server>/test/read.cgi/<board>/<dat>/)
336377
337378 --from <n>レス目以降を判定に利用
338- -i, --ngid 除外したい ID:<id> を , で区切って指定 (ex. oBJccH+E0,7DnAJlQ/P)
379+ -n, --ngid 除外したい ID:<id> を , で区切って指定 (ex. oBJccH+E0,7DnAJlQ/P)
380+ -r, --range 集計対象となる範囲を±<sec>秒で指定 (デフォルト値: 1)
381+ オプションで参加人数の対象になる範囲を±<sec2>秒で指定できる
382+ (デフォルト値: 5) ※ <sec> は <sec2> 以下であること
383+ -m, --max 表示する最大の順位(<rank>位まで)を指定
339384 --local ローカルのdatを利用する datへのパスを<path>で指定
340- --dl datをダウンロードして利用する (両方未指定なら --dl を指定として扱う)
385+ --dl datをダウンロードして利用する (両方未指定なら --dl を指定したと
386+ して扱う)
341387 -h, -? この引数一覧を表示する
342388
343389 Example: 00.00.00.00 1234567890
--- a/00.00.00.00/readme.txt
+++ b/00.00.00.00/readme.txt
@@ -1,5 +1,5 @@
11 ************************************************************
2- 00:00:00.00 集計ツール Ver.0.5.1
2+ 00:00:00.00 集計ツール Ver.0.6.0
33 ************************************************************
44
55 某巨大掲示板群のとある板にて毎日開催されている、書き込み時刻で00:00:00.00にどれだけ