diff datagear/DataGears.cs @ 17:4a3115ba746d

fix CommandType enum
author riono <e165729@ie.u-ryukyu.ac.jp>
date Tue, 24 Nov 2020 03:11:50 +0900
parents 49521c7269bc
children c9d1a5a79254
line wrap: on
line diff
--- a/datagear/DataGears.cs	Sun Nov 22 01:52:22 2020 +0900
+++ b/datagear/DataGears.cs	Tue Nov 24 03:11:50 2020 +0900
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using Christie_net.annotation;
 using Christie_net.datagear.command;
 using Christie_net.datagear.dg;
 
@@ -71,15 +72,12 @@
     /// <returns></returns>
     public object GetData(Command cm) {
         lock (syncObject) {
-            switch (cm.type.commandType) {
-                case CommandType.TAKE:
-                case CommandType.REMOTETAKE:
-                    return Take(cm.key);
-                case CommandType.PEEK:
-                case CommandType.REMOTEPEEK:
-                    return Peek(cm.key);
+            CommandType type = cm.type;
+            if (type == CommandType.TAKE || type == CommandType.REMOTETAKE) {
+                return Take(cm.key);
+            } else if (type == CommandType.PEEK || type == CommandType.REMOTEPEEK){
+                return Peek(cm.key);
             }
-
             return null;
         }
     }