Example #1
0
 /// <summary>
 /// Boolean telling if this node is the current machine.
 /// </summary>
 /// <returns>Boolean</returns>
 public bool IsLocal()
 {
     if (NodeID.Equals(ClusterManager.NodeID))
     {
         return(true);
     }
     return(false);
 }
Example #2
0
        /// <summary>
        /// Determines whether this node is equal to the specified node.
        /// </summary>
        /// <param name="nodeToCompare">Is a specified node to be compared with.</param>
        public bool Equals(DbNode nodeToCompare)
        {
            if (nodeToCompare == null)
            {
                return(false);
            }

            return(NodeID.Equals(nodeToCompare.NodeID));
        }
Example #3
0
        /// <inheritdoc/>
        public override bool Equals(object obj)
        {
            if (!(obj is SceneNode))
            {
                return(false);
            }

            SceneNode other = obj as SceneNode;

            return(NodeID.Equals(other.NodeID));
        }
Example #4
0
        public bool Equals(Node <T> node)
        {
            if (node == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, node))
            {
                return(true);
            }

            return(NodeID.Equals(node.NodeID));
        }
Example #5
0
 public static void Encode(Stream outputStream, NodeID dataType, object value)
 {
     if (dataType.Equals(WellKnownNodeIDs.UInt32))
     {
         BaseType.WriteToStream(outputStream, BitConverter.GetBytes(Convert.ToUInt32(value, CultureInfo.InvariantCulture)));
     }
     else if (dataType.Equals(WellKnownNodeIDs.DateTime))
     {
         BaseType.WriteToStream(outputStream, BitConverter.GetBytes(Convert.ToInt64(value, CultureInfo.InvariantCulture)));
     }
     else if (dataType.Equals(WellKnownNodeIDs.Boolean))
     {
         outputStream.WriteByte((byte)(Convert.ToBoolean(value, CultureInfo.InvariantCulture) ? 1 : 0));
     }
     else if (dataType.Equals(WellKnownNodeIDs.Byte))
     {
         outputStream.WriteByte(Convert.ToByte(value, CultureInfo.InvariantCulture));
     }
     else if (dataType.Equals(WellKnownNodeIDs.Float))
     {
         BaseType.WriteToStream(outputStream, BitConverter.GetBytes(Convert.ToSingle(value, CultureInfo.InvariantCulture)));
     }
     else if (dataType.Equals(WellKnownNodeIDs.Int32))
     {
         BaseType.WriteToStream(outputStream, BitConverter.GetBytes(Convert.ToInt32(value, CultureInfo.InvariantCulture)));
     }
     else if (dataType.Equals(WellKnownNodeIDs.Int64))
     {
         BaseType.WriteToStream(outputStream, BitConverter.GetBytes(Convert.ToInt64(value, CultureInfo.InvariantCulture)));
     }
     else if (dataType.Equals(WellKnownNodeIDs.String))
     {
         byte[] encodedBytes = Encoding.UTF8.GetBytes(value.ToString());
         BaseType.WriteToStream(outputStream, BitConverter.GetBytes(encodedBytes.Length));
         BaseType.WriteToStream(outputStream, encodedBytes);
     }
     else
     {
         Logger.Info("Unsupported data type cannot be encoded");
     }
 }
Example #6
0
        /// <summary>
        /// In addition to checking if the NodeIDs match, like in Equals, this
        /// method also checks if all properties for these nodes and all child
        /// nodes also match.
        /// </summary>
        /// <param name="other">The scene node to compare against.</param>
        /// <returns></returns>
        public virtual bool DeepEquals(SceneNode other)
        {
            if (!NodeID.Equals(other.NodeID) || Name != other.Name ||
                Enabled != other.Enabled || !Transform.Equals(other.Transform) ||
                Children.Count != other.Children.Count)
            {
                return(false);
            }

            for (int i = 0; i < Children.Count; i++)
            {
                if (!Children[i].DeepEquals(other.Children[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #7
0
 internal bool Equals(DB3 nodeID, CrudProcedureType procedureType)
 {
     return(NodeID.Equals(nodeID) && ProcedureType == procedureType);
 }
Example #8
0
 internal bool Equals(CrudProcedure other)
 {
     return(NodeID.Equals(other.NodeID) && ProcedureType == other.ProcedureType);
 }
Example #9
0
 public static void Decode(Stream inputStream, Dictionary <string, object> fields, NodeID dataType, string name)
 {
     if (dataType.Equals(WellKnownNodeIDs.UInt32))
     {
         uint?readMDSPQuality = BaseType.ReadUInt32(inputStream);
         if (readMDSPQuality != null)
         {
             fields[name] = readMDSPQuality.Value;
         }
     }
     else if (dataType.Equals(WellKnownNodeIDs.DateTime))
     {
         long?readInt64 = BaseType.ReadInt64(inputStream);
         if (readInt64 != null)
         {
             fields[name] = readInt64.Value;
         }
     }
     else if (dataType.Equals(WellKnownNodeIDs.Boolean))
     {
         fields[name] = inputStream.ReadByte() != 0;
     }
     else if (dataType.Equals(WellKnownNodeIDs.Byte))
     {
         fields[name] = Convert.ToByte(inputStream.ReadByte());
     }
     else if (dataType.Equals(WellKnownNodeIDs.Float))
     {
         float?readFloat = BaseType.ReadFloat(inputStream);
         if (readFloat != null)
         {
             fields[name] = readFloat.Value;
         }
     }
     else if (dataType.Equals(WellKnownNodeIDs.Int32))
     {
         int?readInt32 = BaseType.ReadInt32(inputStream);
         if (readInt32 != null)
         {
             fields[name] = readInt32.Value;
         }
     }
     else if (dataType.Equals(WellKnownNodeIDs.Int64))
     {
         long?readInt64 = BaseType.ReadInt64(inputStream);
         if (readInt64 != null)
         {
             fields[name] = readInt64.Value;
         }
     }
     else if (dataType.Equals(WellKnownNodeIDs.String))
     {
         String readString = BaseType.ReadString(inputStream);
         if (readString != null)
         {
             fields[name] = readString.Value;
         }
     }
     else /*enum - backward compatibility*/
     {
         int?readInt32 = BaseType.ReadInt32(inputStream);
         if (readInt32 != null)
         {
             fields[name] = readInt32.Value;
         }
     }
 }
Example #10
0
        private DataTable SelPage(out int count)
        {
            string where = "1=1 ";
            if (!string.IsNullOrEmpty(NodeID) && !NodeID.Equals("0"))
            {
                SafeSC.CheckIDSEx(NodeID);
                where += " AND p_class IN(" + NodeID + ")";
            }
            if (Diffcult.Contains("-"))
            {
                //基础(0.91-1.00)容易(0.81-0.90)中等(0.51-0.80)偏难(0.31-0.50)极难(0.01-0.30)
                double sdiff = DataConverter.CDouble(Diffcult.Split('-')[0]);
                double ediff = DataConverter.CDouble(Diffcult.Split('-')[1]);
                //if (sdiff < 0) { sdiff = 0; }
                //if (ediff <= 0) { ediff = 1; }
                where += " AND (p_Difficulty>=" + sdiff + " AND p_Difficulty<=" + ediff + ")";
            }
            if (Grade > 0)
            {
                where += " AND p_Views=" + Grade;
            }
            if (p_Type > 0)//除非选择了大题,才允许输出大题
            {
                where += " AND p_Type=" + p_Type;
            }
            else
            {
                where += " AND p_type!=10";
            }
            List <SqlParameter> splist = new List <SqlParameter>();

            if (!string.IsNullOrEmpty(KeyWord))
            {
                string[] keys     = KeyWord.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                string   keyWhere = "";
                for (int i = 0; i < keys.Length; i++)
                {
                    keyWhere += " OR ','+TagKey+',' LIKE @key" + i;
                    splist.Add(new SqlParameter("key" + i, "%," + keys[i] + ",%"));
                }
                if (!string.IsNullOrEmpty(keyWhere))
                {
                    where += " AND (" + keyWhere.Substring(3, keyWhere.Length - 3) + ") ";
                }
            }
            if (Version > 0)
            {
                where += " AND Version=" + Version;
            }
            //return PageHelper.SelPage(psize, PageCommon.GetCPage(), out count, "p_id", "*", "ZL_Exam_Sys_Questions", where, "ORDER BY p_id DESC", sp);
            PageSetting config = new PageSetting()
            {
                psize  = psize,
                cpage  = PageCommon.GetCPage(),
                pk     = "p_id",
                fields = "A.*,B.C_ClassName",
                t1     = "ZL_Exam_Sys_Questions",
                t2     = "ZL_Exam_Class",
                on     = "A.p_class=B.c_id",
                where  = where,
                order  = "p_id DESC",
                sp     = splist.ToArray()
            };
            DataTable dt = DBCenter.SelPage(config);

            count = config.itemCount;
            return(dt);
        }