示例#1
0
 public static void InvertBit(this ITagOp tagOp, string tag)
 {
     try
     {
         bool current = (bool)tagOp.ReadTag(tag);
         bool toggle  = !current;
         tagOp.WriteTag(tag, toggle);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
示例#2
0
 public static bool?ReadBit(this ITagOp tagOp, string tag)
 {
     try
     {
         var bit = tagOp.ReadTag(tag);
         if (bit == null)
         {
             return(null);
         }
         else
         {
             return((bool)bit);
         }
     }catch (Exception ex)
     {
     }
     return(null);
 }