6
|
1 using System;
|
5
|
2 using System.Collections.Generic;
|
23
|
3 using Christie_net.daemon;
|
5
|
4
|
4
|
5 namespace Christie_net.datagear.command {
|
18
|
6 public enum CommandType {
|
|
7 PUT = 1,
|
|
8 TAKE,
|
|
9 PEEK,
|
|
10 REMOTETAKE,
|
|
11 REMOTEPEEK,
|
|
12 REPLY,
|
|
13 CLOSE,
|
|
14 FINISH
|
8
|
15 }
|
23
|
16
|
|
17 public static class CommandTypeExt {
|
|
18 public static Dictionary<int, CommandType> hash = new Dictionary<int, CommandType>();
|
|
19
|
|
20 static CommandTypeExt() {
|
|
21 foreach (CommandType value in Enum.GetValues(typeof(CommandType))) {
|
|
22 hash.Add((int)value, value);
|
|
23 }
|
|
24 }
|
|
25
|
|
26 public static CommandType GetCommandTypeFormId(int id) {
|
|
27 return hash[id];
|
|
28 }
|
|
29 }
|
18
|
30 // public class CommandType {
|
|
31 // private static int lastId = 0; // コマンドの総数
|
|
32 // public readonly int id = ++lastId; // コマンドのid コンストラクタが呼ばれるたびにlastIdが++される
|
|
33 // public static readonly Dictionary<int, CommandType> hash = new Dictionary<int, CommandType>();
|
|
34 //
|
|
35 // private CommandType() {
|
|
36 // hash.Add(this.id, this);
|
|
37 // }
|
|
38 //
|
|
39 // /// <summary>
|
|
40 // /// idよりCommandTypeを返す
|
|
41 // /// </summary>
|
|
42 // /// <param name="id"></param>
|
|
43 // /// <returns></returns>
|
|
44 // public static CommandType GetCommandTypeFromId(int id) {
|
|
45 // return hash[id];
|
|
46 // }
|
|
47 //
|
|
48 // public static readonly CommandType PUT = new CommandType();
|
|
49 // public static readonly CommandType TAKE = new CommandType();
|
|
50 // public static readonly CommandType PEEK = new CommandType();
|
|
51 // public static readonly CommandType REMOTETAKE = new CommandType();
|
|
52 // public static readonly CommandType REMOTEPEEK = new CommandType();
|
|
53 // public static readonly CommandType REPLY = new CommandType();
|
|
54 // public static readonly CommandType CLOSE = new CommandType();
|
|
55 // public static readonly CommandType FINISH = new CommandType();
|
|
56 // }
|
4
|
57 } |