Пример #1
0
        private void LoadGpioValue(TypeEnum type)
        {
            switch (type)
            {
            case TypeEnum.Q300P:
                char[] val_q300p = Q300P.ReadGpioValues(gpio);
                log_box.Text += "\r\n" + type.ToString() + " GPIO Pin polarity: " + string.Join("", val_q300p);
                FormatGpioValue(val_q300p);
                break;

            case TypeEnum.Q500G6:
                char[] val_q500g6 = Q500G6.ReadGpioValues(gpio);
                log_box.Text += "\r\n" + type.ToString() + " GPIO Pin polarity: " + string.Join("", val_q500g6);
                FormatGpioValue(val_q500g6);
                break;

            case TypeEnum.Q600P:
                char[] val_q600p = Q600P.ReadGpioValues(gpio);
                log_box.Text += "\r\n" + type.ToString() + " GPIO Pin polarity: " + string.Join("", val_q600p);
                FormatGpioValue(val_q600p);
                break;

            default:
                break;
            }
        }
Пример #2
0
        private void LoadGpioModel(TypeEnum type)
        {
            switch (type)
            {
            case TypeEnum.Q300P:
                char[] models_q300p = Q300P.ReadGpioModel(gpio);
                log_box.Text += "\r\n" + type.ToString() + " GPIO Output/Input: " + string.Join("", models_q300p);
                FormatGpioModel(models_q300p);
                break;

            case TypeEnum.Q500G6:
                char[] models_q500g6 = Q500G6.ReadGpioModel(gpio);
                log_box.Text += "\r\n" + type.ToString() + " GPIO Output/Input: " + string.Join("", models_q500g6);
                FormatGpioModel(models_q500g6);
                break;

            case TypeEnum.Q600P:
                char[] models_q600p = Q600P.ReadGpioModel(gpio);
                log_box.Text += "\r\n" + type.ToString() + " GPIO Output/Input: " + string.Join("", models_q600p);
                FormatGpioModel(models_q600p);
                break;

            default:
                break;
            }
        }
Пример #3
0
 /// <summary>
 /// Add one log message
 /// </summary>
 /// <param name="type">Log Level</param>
 /// <param name="text">Log message text</param>
 public static void AddLog(TypeEnum type, string text)
 {
     if (_buffered)
     {
         _sb.Append(DateTime.Now);
         _sb.Append(" ");
         _sb.Append(type.ToString().ToUpper());
         _sb.Append(" ");
         _sb.AppendLine(text);
     }
     else
     {
         File.AppendAllText(_path, DateTime.Now + " " + type.ToString().ToUpper() + " " + text + Environment.NewLine);
     }
 }
Пример #4
0
        public static string TypeEnumToString(TypeEnum InEnum)
        {
            switch (InEnum)
            {
            case TypeEnum.Bool:
                return("bool");

            case TypeEnum.DateTime:
                return("datetime");

            case TypeEnum.Decimal:
                return("decimal");

            case TypeEnum.String:
                return("string");

            case TypeEnum.Size:
                return("Size");

            case TypeEnum.Int:
                return("int");

            case TypeEnum.Int32:
                return("Int32");

            case TypeEnum.Int64:
                return("Int64");

            case TypeEnum.Void:
                return("void");

            default:
                throw new Exception("unexpected TypeEnum " + InEnum.ToString());
            }
        }
Пример #5
0
        private void LoadGpioData(TypeEnum type)
        {
            log_box.AppendText("\r\n");
            log_box.AppendText("Load " + type.ToString() + " GPIO Data.");
            switch (type)
            {
            case TypeEnum.Q300P:
                gpio.SetGpioFunction(0x2c, 0x89);
                LoadGpioModel(TypeEnum.Q300P);
                LoadGpioValue(TypeEnum.Q300P);
                break;

            case TypeEnum.Q500G6:
                LoadGpioModel(TypeEnum.Q500G6);
                LoadGpioValue(TypeEnum.Q500G6);
                break;

            case TypeEnum.Q600P:
                LoadGpioModel(TypeEnum.Q600P);
                LoadGpioValue(TypeEnum.Q600P);
                break;

            default:
                break;
            }
        }
Пример #6
0
        public static string ToDeclareTypeName(TypeEnum type)
        {
            switch (type)
            {
            case TypeEnum.INT64:
                return("__int64");

            case TypeEnum.STRING:
                return("std::string");

            case TypeEnum.BIN:
                return("msg::bin_t");

            case TypeEnum.ENTITY_ID:
                return("entity_id_t");

            case TypeEnum.DATA_ID:
                return("data::id_t");

            case TypeEnum.DATA_POS:
                return("data::xyz_t");

            case TypeEnum.DATA_EXPRESSION:
                return("double");
            }
            return(type.ToString().ToLower());
        }
Пример #7
0
        /// <summary>
        /// 返回状态信息(后期扩展为与支付单一起做判断)
        /// </summary>
        public static string GetStatus(M_OrderList orderMod, TypeEnum type)
        {
            switch (type)
            {
            case TypeEnum.Pay:
                return(GetPayStatus(orderMod.Paymentstatus));

            case TypeEnum.Order:
            {
                if (orderMod.Aside > 0)
                {
                    return(GetOrderStatus(orderMod.OrderStatus, orderMod.Aside, orderMod.StateLogistics));
                }
                //订单已处理,但用户尚未签收
                else if (orderMod.OrderStatus == 99 &&
                         (orderMod.StateLogistics == (int)M_OrderList.ExpEnum.NoSend || orderMod.StateLogistics == (int)M_OrderList.ExpEnum.HasSend))
                {
                    return(GetOrderStatus(2));
                }
                return(GetOrderStatus(orderMod.OrderStatus));
            }

            case TypeEnum.Express:
                return(GetExpStatus(orderMod.StateLogistics));

            case TypeEnum.Aside:
                return(GetOrderStatus(orderMod.OrderStatus, orderMod.Aside, orderMod.StateLogistics));

            case TypeEnum.PayType:
                return(OrderConfig.GetPayType(orderMod.PayType));

            default:
                throw new Exception(type.ToString() + "状态码错误");
            }
        }
Пример #8
0
 public void WriteXml(XmlTextWriter writer)
 {
     writer.WriteStartElement("group");
     writer.WriteElementString("id", m_id.ToString());
     writer.WriteElementString("key", m_key.ToString());
     writer.WriteElementString("showfooter", m_showfooter.ToString());
     writer.WriteElementString("showheader", m_showheader.ToString());
     writer.WriteElementString("datatype", m_type.ToString());
     writer.WriteEndElement();
 }
Пример #9
0
        public Declare(string name, TypeEnum type)
        {
            this.type = new TypeIdentifier
            {
                TypeEnum = type,
                TypeName = type.ToString() 
            };

            this.name = name;
        }
Пример #10
0
 protected override void Write(XmlWriter writer)
 {
     writer.WriteElementString("_type", "1");
     writer.WriteElementString("alignment", m_align.ToString());
     writer.WriteElementString("calc", m_calcType.ToString());
     writer.WriteStartElement("dataformat");
     writer.WriteCData(m_dataFormat);
     writer.WriteEndElement();
     writer.WriteElementString("datatype", m_type.ToString());
     writer.WriteElementString("reset", m_resetType.ToString());
     writer.WriteElementString("datamember", m_columnName);
     writer.WriteElementString("datasource", m_tableName);
     writer.WriteElementString("noduplicates", m_noduplicates.ToString());
     writer.WriteElementString("arrayindex", m_index.ToString());
 }
Пример #11
0
        public static string CreatePathFromType(TypeEnum moduleType, string moduleSubtype, string targetFolder, bool tests = false)
        {
            // create path from types
            string testFolderIfRequired = "";

            if (tests == true)
            {
                testFolderIfRequired = $"/{TentaclesManagerVars.TENTACLES_TEST_PATH}";
            }

            string value = "";

            string mt  = moduleType.ToString();
            string mtv = "";
            string mst = "";

            foreach (var index in TentaclesManagerVars.TENTACLE_TYPES)
            {
                foreach (var subIndex in index)
                {
                    if (subIndex.Key == mt)
                    {
                        mtv = subIndex.Value;
                    }
                    if (subIndex.Key == moduleSubtype)
                    {
                        mst = subIndex.Value;
                    }
                }
            }

            if (moduleSubtype != "")
            {
                value = $"{TentaclesManagerVars.TENTACLES_PATH}{testFolderIfRequired}/{mtv}/" + $"{mst}/{targetFolder}";
            }
            else
            {
                value = $"{TentaclesManagerVars.TENTACLES_PATH}{testFolderIfRequired}/{mtv}/{targetFolder}";
            }

            return(value);
        }
Пример #12
0
 public static string ToDeclareTypeName(TypeEnum type)
 {
     switch (type)
     {
         case TypeEnum.INT64:
             return "__int64";
         case TypeEnum.STRING:
             return "std::string";
         case TypeEnum.BIN:
             return "msg::bin_t";
         case TypeEnum.ENTITY_ID:
             return "entity_id_t";
         case TypeEnum.DATA_ID:
             return "data::id_t";
         case TypeEnum.DATA_POS:
             return "data::xyz_t";
         case TypeEnum.DATA_EXPRESSION:
             return "double";
     }
     return type.ToString().ToLower();
 }
Пример #13
0
    public static int GetSpriteId(TypeEnum type, OwnerEnum owner)
    {
        string spriteName;

        if (type == TypeEnum.Bread)
        {
            spriteName = "bread_bounce";
        }
        else if (type == TypeEnum.Void)
        {
            spriteName = "void";
        }
        else if (type == TypeEnum.Tile)
        {
            spriteName = "tile";
        }
        else
        {
            spriteName = type.ToString().ToLower() + ((int)owner).ToString();
        }
        return(GlobalInfo.Instance.storage.unitPrefab.GetComponent <tk2dAnimatedSprite>().GetClipIdByName(spriteName));
    }
Пример #14
0
        /// <summary>
        /// 返回状态信息
        /// </summary>
        public static string GetStatus(M_OrderList orderMod, TypeEnum type)
        {
            switch (type)
            {
            case TypeEnum.Pay:
                return(GetPayStatus(orderMod.Paymentstatus));

            case TypeEnum.Order:
                return(GetOrderStatus(orderMod.OrderStatus));

            case TypeEnum.Express:
                return(GetExpStatus(orderMod.StateLogistics));

            case TypeEnum.Aside:
                return(GetOrderStatus(orderMod.OrderStatus, orderMod.Aside, orderMod.StateLogistics));

            case TypeEnum.PayType:
                return(GetPayType(orderMod.PayType, orderMod.PreMoney));

            default:
                throw new Exception(type.ToString() + "状态码错误");
            }
        }
Пример #15
0
 public override string ToString()
 {
     return(base.ToString() + ":" + Type.ToString());
 }
Пример #16
0
 public Schema(string title, TypeEnum type)
 {
     Title = title;
     Type  = type.ToString().ToLower();
 }
Пример #17
0
 public Property(TypeEnum type, string description)
 {
     this.Type        = type.ToString().ToLower();
     this.Description = description;
 }
Пример #18
0
 public static int GetSpriteId(TypeEnum type, OwnerEnum owner)
 {
     string spriteName;
     if (type == TypeEnum.Bread)
         spriteName = "bread_bounce";
     else if (type == TypeEnum.Void)
         spriteName = "void";
     else if (type == TypeEnum.Tile)
         spriteName = "tile";
     else
         spriteName = type.ToString().ToLower() + ((int)owner).ToString();
     return GlobalInfo.Instance.storage.unitPrefab.GetComponent<tk2dAnimatedSprite>().GetClipIdByName(spriteName);
 }
Пример #19
0
 private static void ThrowInvalidOperationExceptionTypesDoNotMatch(TypeEnum first, TypeEnum second)
 {
     throw new InvalidOperationException($"Variant types do not match: {first.ToString()} vs {second.ToString()}");
 }
Пример #20
0
 private static void ThrowNotSupportedException(TypeEnum typeEnum)
 {
     throw new NotSupportedException($"Comparison not supported for the type {typeEnum.ToString()}");
 }
Пример #21
0
 /// <inheritdoc />
 public Note(TypeEnum type, string description)
 {
     Type        = type.ToString();
     Description = description;
 }