Exemplo n.º 1
0
    /// <summary> Creates the lookup table for what types inherit from what. This would be hard-coded if C# would allow. </summary>
    public static void InitInheritanceTree()
    {
        for (StandardType st = StandardType.anything; st < StandardType.Count; st++)
        {
            var it = new InheritedType()
            {
                name = st.ToString(), subtypes = null, typeid = st
            };
            switch (st)
            {
            case StandardType.anything: it.parent = null; break;

            case StandardType.something:
            case StandardType.nothing: it.parent = StandardType.anything.ToString(); break;

            case StandardType.valueType:
            case StandardType.referenceType: it.parent = StandardType.something.ToString(); break;

            case StandardType.number:
            case StandardType.discrete:
            case StandardType.reference:
            case StandardType.structure: it.parent = StandardType.valueType.ToString(); break;

            case StandardType.homogene:
            case StandardType.heterogene:
            case StandardType.value: it.parent = StandardType.referenceType.ToString(); break;

            case StandardType.percent:
            case StandardType.money: it.parent = StandardType.number.ToString(); break;

            case StandardType.position:
            case StandardType.boole: it.parent = StandardType.discrete.ToString(); break;

            case StandardType.time: it.parent = StandardType.structure.ToString(); break;

            case StandardType.text:
            case StandardType.list: it.parent = StandardType.homogene.ToString(); break;

            case StandardType.sequence:
            case StandardType.Object: it.parent = StandardType.heterogene.ToString(); break;

            default: Console.WriteLine("ERROR IN COMPILER: unknown base type {0}", st); break;
            }
            InheritanceTree.Add(it);
        }
        //TestInheritanceTree();
    }
Exemplo n.º 2
0
 public override bool Initialize(DllSettings settings)
 {
     SetProtocol(settings.ProtocolIndex);
     _iStandard = settings.StandardIndex;
     if (settings.ComPort > 0)
     {
         // 使用串口连接ELM327
         _log.TraceInfo(string.Format("Attempting initialization on port {0}", settings.HardwareIndex.ToString()));
         return(Initialize(settings.ComPort, settings.BaudRate));
     }
     else
     {
         // 使用TCP连接ELM327
         _log.TraceInfo(string.Format("Attempting initialization on remote server {0}:{1}", settings.RemoteIP, settings.RemotePort.ToString()));
         return(Initialize(settings.RemoteIP, settings.RemotePort));
     }
 }
Exemplo n.º 3
0
        /// Gets the GraphML string representation of the type of this property.
        private static string TypeToGraphML(StandardType type)
        {
            switch (type)
            {
            case StandardType.Bool: return("boolean");                    // !

            case StandardType.Double: return("double");

            case StandardType.Float: return("float");

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

            case StandardType.Long: return("long");

            default: return("string");
            }
        }
Exemplo n.º 4
0
    /// <summary>Returns the parent of the passed-in type. Returns Anything for unrecognized types as well as Anything
    /// itself.  Returns Object (which is assumed) for types which claim to have no parent.  (Those were implicitly
    /// created by a "list of" construction, and will presumably be filled in later.) </summary>
    public static StandardType ParentOf(StandardType st)
    {
        if (st == StandardType.anything)
        {
            return(StandardType.anything);                             // anything is anything, the root type
        }
        InheritedType it = InheritanceTree.Find(item => item.typeid == st);

        if (it == null)
        {
            return(StandardType.anything);
        }
        if (it.parent == null)
        {
            return(StandardType.Object);                   // only happens with used but undefined types
        }
        return(InheritanceTree.Find(item => item.name == it.parent).typeid);
    }
Exemplo n.º 5
0
        public override void WriteJson(JsonWriter writer,
                                       object untypedValue,
                                       JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer,
                                     null);

                return;
            }

            StandardType value = (StandardType)untypedValue;

            switch (value)
            {
            case StandardType.Nominal:
                serializer.Serialize(writer,
                                     "nominal");

                return;

            case StandardType.Ordinal:
                serializer.Serialize(writer,
                                     "ordinal");

                return;

            case StandardType.Quantitative:
                serializer.Serialize(writer,
                                     "quantitative");

                return;

            case StandardType.Temporal:
                serializer.Serialize(writer,
                                     "temporal");

                return;
            }

            throw new Exception("Cannot marshal type StandardType");
        }
Exemplo n.º 6
0
 public OBDInterface(Logger log)
 {
     _log = log;
     _log.TraceInfo("=======================================================================");
     _log.TraceInfo("==================== START DllVersion: " + DllVersion <OBDInterface> .AssemblyVersion + " ====================");
     _dbc              = new Parser(".\\Configs\\dllvalue.xml", ".\\Configs\\dllsignal.xml");
     _netWork          = _dbc.ParseFile(".\\Configs\\OBD_CMD.dbc");
     _obdInterpreter   = new OBDInterpreter(_netWork, _dbc);
     DllSettingsResult = true;
     DllSettings       = LoadDllSettings();
     string[] strAttr = DllSettings.AutoProtocolOrder.Split(',');
     _xattr = new int[strAttr.Length];
     for (int i = 0; i < strAttr.Length; i++)
     {
         int.TryParse(strAttr[i], out _xattr[i]);
     }
     SetDevice(HardwareType.ELM327);
     Disconnect();
     STDType = StandardType.Automatic;
 }
Exemplo n.º 7
0
 //
 public bool Update(StandardType model)
 {
     try
     {
         StringBuilder strSql = new StringBuilder();
         strSql.Append("update T_StandardType set ");
         strSql.Append("StandardTypeName=@StandardTypeName,");
         strSql.Append("Editor=@Editor,");
         strSql.Append("CreateDate=@CreateDate");
         strSql.Append(" where Id=@Id");
         if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch { throw; }
 }
Exemplo n.º 8
0
        //
        public bool Create(StandardType model)
        {
            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into T_StandardType(");
                strSql.Append("StandardTypeName,Editor,CreateDate)");
                strSql.Append(" values (");
                strSql.Append("@StandardTypeName,@Editor,@CreateDate)");

                if (DbHelperSQL.ExecuteSql(strSql.ToString(), GetSqlParameter(model)) > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch { throw; }
        }
Exemplo n.º 9
0
        private void SetPeptideStandardType(int protindex, int pepStartIndex, int pepCount, StandardType standardType, bool success = true)
        {
            var qcPeps    = SkylineWindow.SequenceTree.Nodes[protindex];
            var nodeStart = qcPeps.Nodes[pepStartIndex];
            var nodeEnd   = qcPeps.Nodes[pepStartIndex + pepCount - 1];

            SelectRange(nodeStart, nodeEnd);
            SkylineWindow.SetStandardType(standardType);
            // Get back to single selection to have area graph single-peptide
            SkylineWindow.SequenceTree.SelectedNode = null;
            SkylineWindow.SequenceTree.SelectedNode = nodeEnd;
            var docChanged = SkylineWindow.DocumentUI;

            ValidateStandardType(docChanged, protindex, pepStartIndex, pepCount, standardType, success);

            var docRound = AssertEx.RoundTrip(docChanged);

            ValidateStandardType(docRound, protindex, pepStartIndex, pepCount, standardType, success);
        }
Exemplo n.º 10
0
 /// <summary>Answers whether the first instance, variable, or type is-a the second type.  Single-inheritance. </summary>
 static bool IsA(StandardType instanceOrType, StandardType type)
 {
     distance = DistanceFrom(instanceOrType, type);
     return(distance > -1);  // Distance of 0 means same exact type. Distance of 1 means one's a direct parent, etc.
 }
Exemplo n.º 11
0
 public OBDDeviceELM327(DllSettings settings, Logger log, int[] xattr) : base(settings, log, xattr)
 {
     _iProtocol = ProtocolType.Unknown;
     _iStandard = StandardType.Automatic;
 }
Exemplo n.º 12
0
 public SymbolSetLegacySymbol()
 {
     this.labelAliasField = "";
     this.entityIDField = "NA";
     this.entityTypeIDField = "NA";
     this.entitySubTypeIDField = "NA";
     this.modifierOneIDField = "NA";
     this.modifierTwoIDField = "NA";
     this.standardField = StandardType.ALL;
     this.isDuplicateField = false;
 }
Exemplo n.º 13
0
 public void BeginSubrange(int type_id, StandardType type_base)
 {
     int level = this.symbol_table[type_id].Level;
     this.symbol_table[type_id].Kind = MemberKind.Type;
     this.level_stack.Push(type_id);
     this.Gen(this.code.OP_CREATE_CLASS, type_id, level, 7);
     this.Gen(this.code.OP_ADD_ANCESTOR, type_id, (int) type_base, 0);
     this.Gen(this.code.OP_ADD_MODIFIER, type_id, 7, 0);
     this.Gen(this.code.OP_ADD_MODIFIER, type_id, 6, 0);
     this.Gen(this.code.OP_ADD_MODIFIER, type_id, 1, 0);
     this.Gen(this.code.OP_BEGIN_USING, type_id, 0, 0);
 }
Exemplo n.º 14
0
 public InterfaceEntityIterator Typed(StandardType type)
 {
     return(new InterfaceEntityIterator(Interface_EntityIterator_TypedE2B3EAC1(Instance, type.Instance)));
 }
Exemplo n.º 15
0
 public int NbTyped(StandardType type)
 {
     return(Interface_EntityIterator_NbTypedE2B3EAC1(Instance, type.Instance));
 }
Exemplo n.º 16
0
 public void SelectType(StandardType atype, bool keep)
 {
     Interface_EntityIterator_SelectTypeC4B77EEF(Instance, atype.Instance, keep);
 }
Exemplo n.º 17
0
 /// <summary>Creates a new type defined by the user, typically of type 'object'.</summary>
 public static InheritedType CreateNewType(string ident, StandardType parentClass = StandardType.heterogene)
 {
     return(CreateNewType(ident, parentClass.ToString()));
 }
Exemplo n.º 18
0
 public bool FindTypedTransient(StandardTransient start, StandardType atype, StandardTransient val)
 {
     return(Transfer_ProcessForTransient_FindTypedTransient2A525E75(Instance, start.Instance, atype.Instance, val.Instance));
 }
Exemplo n.º 19
0
 public ModifiersTypeModifier()
 {
     this.labelAliasField = "";
     this.categoryField = "";
     this.categoryAliasField = "";
     this.standardField = StandardType.ALL;
 }
Exemplo n.º 20
0
 public void Add(string v1, StandardType v2)
 {
     this.ht.Add(v1, v2);
 }
Exemplo n.º 21
0
 public EntityType()
 {
     this.labelField = "";
     this.labelAliasField = "";
     this.descriptionField = "";
     this.remarksField = "";
     this.graphicField = "";
     this.alternativeGraphicField = "";
     this.circleGraphicField = "";
     this.cloverGraphicField = "";
     this.curveGraphicField = "";
     this.diamondGraphicField = "";
     this.rectangleGraphicField = "";
     this.squareGraphicField = "";
     this.drawRuleIDField = "POINT_RULE";
     this.drawNoteField = "Not Applicable";
     this.standardField = StandardType.ALL;
     this.iconField = IconType.MAIN;
     this.isCivilianField = false;
     this.geometryTypeField = GeometryType.POINT;
 }
Exemplo n.º 22
0
        private bool InternalInitialize()
        {
            if (!_CommELM.Open())
            {
                return(false);
            }
            if (!ConfirmAT("ATWS") || !ConfirmAT("ATE0") || !ConfirmAT("ATL0") || !ConfirmAT("ATH1") || !ConfirmAT("ATCAF1"))
            {
                _CommELM.Close();
                return(false);
            }

            base._DeviceDes = GetDeviceDes().Trim();
            base._DeviceID  = GetDeviceID().Trim().Replace("ELM327", "SH-VCI-302U");
            if (_iProtocol != ProtocolType.Unknown)
            {
                if (!ConfirmAT("ATSP" + ((int)_iProtocol).ToString("X1")))
                {
                    _CommELM.Close();
                    return(false);
                }

                int originalTimeout = _CommELM.Timeout;
                _CommELM.Timeout = 5000;
                _iStandard       = SetStandardType(_iProtocol);
                if (_iStandard != StandardType.Automatic)
                {
                    if (_Parser == null)
                    {
                        string strDPN = GetOBDResponse("ATDPN").Replace("A", "");
                        if (strDPN.Length == 0)
                        {
                            strDPN = "A";
                        }
                        SetProtocol((ProtocolType)Convert.ToInt32(strDPN, 16));
                    }
                }

                _CommELM.Timeout = originalTimeout;
                return(_iStandard != StandardType.Automatic);
            }
            else
            {
                if (!ConfirmAT("ATM0"))
                {
                    _CommELM.Close();
                    return(false);
                }

                int originalTimeout = _CommELM.Timeout;
                _CommELM.Timeout = 5000;
                for (int idx = 0; idx < _xattr.Length; idx++)
                {
                    if (!ConfirmAT("ATTP" + _xattr[idx].ToString("X1")))
                    {
                        _CommELM.Close();
                        return(false);
                    }
                    _iStandard = SetStandardType((ProtocolType)_xattr[idx]);
                    if (_iStandard != StandardType.Automatic)
                    {
                        if (_Parser == null)
                        {
                            SetProtocol((ProtocolType)_xattr[idx]);
                        }
                        _CommELM.Timeout = originalTimeout;
                        ConfirmAT("ATM1");
                        return(true);
                    }
                }
                // 每个协议都无法连接的话就关闭端口准备退出
                if (_CommELM.Online)
                {
                    _CommELM.Close();
                }
                return(false);
            }
        }
Exemplo n.º 23
0
        private OperationReturn LoadScoreItem(SessionInfo session, ScoreItem parent, string scoreID)
        {
            OperationReturn optReturn = new OperationReturn();

            optReturn.Result = true;
            optReturn.Code   = 0;
            try
            {
                string     rentToken  = session.RentInfo.Token;
                ScoreSheet scoreSheet = parent.ScoreSheet;
                if (scoreSheet == null)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("ScoreSheet is null");
                    return(optReturn);
                }
                string temp1 = string.Empty;
                string temp2 = string.Empty;
                if (!string.IsNullOrWhiteSpace(scoreID))
                {
                    temp1 = string.Format(",T3109.C005 AS NA");
                    temp2 = string.Format(" LEFT JOIN T_31_009_{0} T3109 ON T3102.C002=T3109.C002", rentToken);
                }
                string  strSql;
                DataSet objDataSet;
                switch (session.DBType)
                {
                case 2:
                    strSql = string.Format(
                        "SELECT T3102.*{4} FROM T_31_002_{0} T3102{5}  WHERE T3102.C003 = {1} AND T3102.C004 = {2}{3} ",
                        rentToken, scoreSheet.ID, parent.ID, scoreID, temp1, temp2);
                    optReturn = MssqlOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                case 3:
                    strSql = string.Format(
                        "SELECT T3102.*{4} FROM T_31_002_{0} T3102{5} WHERE T3102.C003 = {1} AND T3102.C004 = {2}{3} ",
                        rentToken, scoreSheet.ID, parent.ID, scoreID, temp1, temp2);
                    optReturn = OracleOperation.GetDataSet(session.DBConnectionString, strSql);
                    if (!optReturn.Result)
                    {
                        return(optReturn);
                    }
                    objDataSet = optReturn.Data as DataSet;
                    break;

                default:
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_PARAM_INVALID;
                    optReturn.Message = string.Format("DBType invalid");
                    return(optReturn);
                }
                if (objDataSet == null || objDataSet.Tables.Count <= 0)
                {
                    optReturn.Result  = false;
                    optReturn.Code    = Defines.RET_OBJECT_NULL;
                    optReturn.Message = string.Format("DataSet is null or DataTables empty");
                    return(optReturn);
                }
                List <ScoreItem> listItems = new List <ScoreItem>();
                for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++)
                {
                    DataRow   dr = objDataSet.Tables[0].Rows[i];
                    ScoreItem scoreItem;
                    bool      isStandard = dr["C009"].ToString() == "Y";
                    if (isStandard)
                    {
                        Standard     standard     = null;
                        StandardType standardType = (StandardType)Convert.ToInt32(dr["C015"]);
                        switch (standardType)
                        {
                        case StandardType.Numeric:
                            NumericStandard numericStandard = new NumericStandard();
                            numericStandard.Type         = ScoreObjectType.NumericStandard;
                            numericStandard.MaxValue     = Convert.ToDouble(dr["C027"]);
                            numericStandard.MinValue     = Convert.ToDouble(dr["C028"]);
                            numericStandard.DefaultValue = string.IsNullOrWhiteSpace(dr["C029"].ToString()) ? 0 : Convert.ToDouble(dr["C029"]);
                            numericStandard.ScoreClassic = StandardClassic.TextBox;
                            standard = numericStandard;
                            break;

                        case StandardType.YesNo:
                            YesNoStandard yesNoStandard = new YesNoStandard();
                            yesNoStandard.Type = ScoreObjectType.YesNoStandard;
                            if (string.IsNullOrWhiteSpace(dr["C029"].ToString()))
                            {
                                yesNoStandard.DefaultValue = false;
                            }
                            else
                            {
                                if (Convert.ToDouble(dr["C029"]) == 1.0)
                                {
                                    yesNoStandard.DefaultValue = true;
                                }
                                else
                                {
                                    yesNoStandard.DefaultValue = false;
                                }
                            }
                            yesNoStandard.ReverseDisplay = dr["C104"].ToString() == "1";
                            yesNoStandard.ScoreClassic   = StandardClassic.YesNo;
                            standard = yesNoStandard;
                            break;

                        case StandardType.Slider:
                            SliderStandard sliderStandard = new SliderStandard();
                            sliderStandard.Type         = ScoreObjectType.SliderStandard;
                            sliderStandard.MinValue     = Convert.ToDouble(dr["C023"]);
                            sliderStandard.MaxValue     = Convert.ToDouble(dr["C024"]);
                            sliderStandard.Interval     = Convert.ToDouble(dr["C026"]);
                            sliderStandard.DefaultValue = string.IsNullOrWhiteSpace(dr["C029"].ToString()) ? 0 : Convert.ToDouble(dr["C029"]);
                            sliderStandard.ScoreClassic = StandardClassic.Slider;
                            standard = sliderStandard;
                            break;

                        case StandardType.Item:
                            ItemStandard itemStandard = new ItemStandard();
                            itemStandard.Type         = ScoreObjectType.ItemStandard;
                            itemStandard.ScoreClassic = StandardClassic.DropDownList;
                            itemStandard.DefaultIndex = string.IsNullOrWhiteSpace(dr["C029"].ToString())?0: Convert.ToInt32(dr["C029"]);
                            standard = itemStandard;
                            break;
                        }
                        if (standard == null)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = Defines.RET_OBJECT_NULL;
                            optReturn.Message = string.Format("Standard is null");
                            return(optReturn);
                        }
                        standard.PointSystem    = Convert.ToDouble(dr["C018"]);
                        standard.StandardType   = standardType;
                        standard.IsAutoStandard = dr["C101"].ToString() == "Y";
                        if (!string.IsNullOrWhiteSpace(scoreID))
                        {
                            if (string.IsNullOrWhiteSpace(dr["NA"].ToString()))
                            {
                                standard.IsNA = false;
                            }
                            else
                            {
                                standard.IsNA = dr["NA"].ToString() == "Y" ? true : false;
                            }
                        }
                        string strStaID = dr["C102"].ToString();
                        long   staID;
                        if (long.TryParse(strStaID, out staID))
                        {
                            standard.StatisticalID = staID;
                        }
                        scoreItem = standard;
                    }
                    else
                    {
                        ScoreGroup scoreGroup = new ScoreGroup();
                        scoreGroup.Type  = ScoreObjectType.ScoreGroup;
                        scoreGroup.IsAvg = dr["C016"].ToString() == "Y";
                        scoreItem        = scoreGroup;
                    }
                    scoreItem.ScoreSheet     = parent.ScoreSheet;
                    scoreItem.Parent         = parent;
                    scoreItem.ItemID         = Convert.ToInt32(dr["C001"]);
                    scoreItem.ID             = Convert.ToInt64(dr["C002"]);
                    scoreItem.OrderID        = Convert.ToInt32(dr["C005"]);
                    scoreItem.Title          = dr["C006"].ToString();
                    scoreItem.Description    = dr["C007"].ToString();
                    scoreItem.TotalScore     = Convert.ToDouble(dr["C008"]);
                    scoreItem.IsAbortScore   = dr["C010"].ToString() == "Y";
                    scoreItem.ControlFlag    = dr["C011"].ToString() == "Y" ? 1 : 0;
                    scoreItem.IsKeyItem      = dr["C012"].ToString() == "Y";
                    scoreItem.IsAllowNA      = dr["C013"].ToString() == "Y";
                    scoreItem.IsJumpItem     = dr["C014"].ToString() == "Y";
                    scoreItem.IsAddtionItem  = dr["C017"].ToString() == "Y";
                    scoreItem.UsePointSystem = dr["C019"].ToString() == "Y";
                    scoreItem.ScoreType      = dr["C020"].ToString() == "F"
                        ? ScoreType.YesNo
                        : dr["C020"].ToString() == "P" ? ScoreType.Pecentage : ScoreType.Numeric;
                    scoreItem.Tip = dr["C022"].ToString();
                    scoreItem.AllowModifyScore = dr["C103"].ToString() == "Y";

                    #region 子项

                    //如果是 ScoreGroup 加载子项
                    if (!isStandard)
                    {
                        ScoreGroup scoreGroup = scoreItem as ScoreGroup;
                        optReturn = LoadScoreItem(session, scoreGroup, scoreID);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        List <ScoreItem> subItems = optReturn.Data as List <ScoreItem>;
                        if (subItems == null)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = Defines.RET_OBJECT_NULL;
                            optReturn.Message = string.Format("ListItems is null");
                            return(optReturn);
                        }
                        for (int j = 0; j < subItems.Count; j++)
                        {
                            ScoreItem subItem = subItems[j];
                            scoreGroup.Items.Add(subItem);
                        }
                        scoreGroup.Items = scoreGroup.Items.OrderBy(j => j.OrderID).ToList();
                    }

                    //如果是多值型评分标准,加载评分标准子项
                    ItemStandard temp = scoreItem as ItemStandard;
                    if (temp != null)
                    {
                        optReturn = LoadStandardItem(session, temp);
                        if (!optReturn.Result)
                        {
                            return(optReturn);
                        }
                        List <StandardItem> valueItems = optReturn.Data as List <StandardItem>;
                        if (valueItems == null)
                        {
                            optReturn.Result  = false;
                            optReturn.Code    = Defines.RET_OBJECT_NULL;
                            optReturn.Message = string.Format("ValueItems is null");
                            return(optReturn);
                        }
                        for (int j = 0; j < valueItems.Count; j++)
                        {
                            StandardItem valueItem = valueItems[j];
                            temp.ValueItems.Add(valueItem);
                        }
                        temp.ValueItems = temp.ValueItems.OrderBy(j => j.OrderID).ToList();
                    }

                    #endregion


                    #region 备注

                    OperationReturn commentReturn;
                    commentReturn = LoadComment(session, scoreItem);
                    if (!commentReturn.Result)
                    {
                        return(commentReturn);
                    }
                    List <Comment> listComments = commentReturn.Data as List <Comment>;
                    if (listComments == null)
                    {
                        optReturn.Result  = false;
                        optReturn.Code    = Defines.RET_OBJECT_NULL;
                        optReturn.Message = string.Format("listComments is null");
                        return(optReturn);
                    }
                    for (int j = 0; j < listComments.Count; j++)
                    {
                        Comment comment = listComments[j];
                        scoreItem.Comments.Add(comment);
                    }
                    scoreItem.Comments = scoreItem.Comments.OrderBy(j => j.OrderID).ToList();

                    #endregion

                    #region 样式

                    OperationReturn styleReturn;
                    styleReturn = LoadVisualStyle(session, scoreItem, "T");
                    if (!styleReturn.Result)
                    {
                        if (styleReturn.Code != Defines.RET_NOT_EXIST)
                        {
                            return(styleReturn);
                        }
                        scoreItem.TitleStyle = null;
                    }
                    else
                    {
                        VisualStyle style = styleReturn.Data as VisualStyle;
                        if (style != null)
                        {
                            style.ScoreSheet     = scoreSheet;
                            scoreItem.TitleStyle = style;
                        }
                    }

                    styleReturn = LoadVisualStyle(session, scoreItem, "P");
                    if (!styleReturn.Result)
                    {
                        if (styleReturn.Code != Defines.RET_NOT_EXIST)
                        {
                            return(styleReturn);
                        }
                        scoreItem.PanelStyle = null;
                    }
                    else
                    {
                        VisualStyle style = styleReturn.Data as VisualStyle;
                        if (style != null)
                        {
                            style.ScoreSheet     = scoreSheet;
                            scoreItem.PanelStyle = style;
                        }
                    }

                    #endregion

                    listItems.Add(scoreItem);
                }
                optReturn.Data = listItems;
            }
            catch (Exception ex)
            {
                optReturn.Result  = false;
                optReturn.Code    = Defines.RET_FAIL;
                optReturn.Message = ex.Message;
            }
            return(optReturn);
        }
Exemplo n.º 24
0
 /// <summary>Calculates if the child is the same type as parent (zero), or how many levels of inheritance it's
 /// removed from.  Returns -1 if the child isn't a subclass of (or equal to) the parent.</summary>
 public static int DistanceFrom(StandardType child, StandardType parent = StandardType.anything)
 {
     return(DistanceFrom(NameOfType(child), NameOfType(parent)));
 }
Exemplo n.º 25
0
        private StandardType SetStandardType(ProtocolType protocol)
        {
            if (_iStandard != StandardType.Automatic)
            {
                return(_iStandard);
            }
            bool         bflag    = false;
            StandardType standard = StandardType.Automatic;

            switch (protocol)
            {
            case ProtocolType.J1850_PWM:
            case ProtocolType.J1850_VPW:
            case ProtocolType.ISO9141_2:
            case ProtocolType.ISO_14230_4_KWP_5BAUDINIT:
            case ProtocolType.ISO_14230_4_KWP_FASTINIT:
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("0100").Replace(" ", "").Contains("4100"))
                    {
                        bflag    = true;
                        standard = StandardType.ISO_15031;
                    }
                }
                break;

            case ProtocolType.ISO_15765_4_CAN_11BIT_500KBAUD:
            case ProtocolType.ISO_15765_4_CAN_11BIT_250KBAUD:
                ConfirmAT("ATCF700");
                ConfirmAT("ATCMF00");
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("22F810").Replace(" ", "").Contains("62F810"))
                    {
                        bflag    = bflag || true;
                        standard = StandardType.ISO_27145;
                    }
                }
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("0100").Replace(" ", "").Contains("4100"))
                    {
                        bflag    = true;
                        standard = StandardType.ISO_15031;
                    }
                }
                if (standard == StandardType.Automatic)
                {
                    ConfirmAT("ATAR");
                }
                break;

            case ProtocolType.ISO_15765_4_CAN_29BIT_500KBAUD:
            case ProtocolType.ISO_15765_4_CAN_29BIT_250KBAUD:
                ConfirmAT("ATCF18DAF100");
                ConfirmAT("ATCM1FFFFF00");
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("22F810").Replace(" ", "").Contains("62F810"))
                    {
                        bflag    = bflag || true;
                        standard = StandardType.ISO_27145;
                    }
                }
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("0100").Replace(" ", "").Contains("4100"))
                    {
                        bflag    = true;
                        standard = StandardType.ISO_15031;
                    }
                }
                if (standard == StandardType.Automatic)
                {
                    ConfirmAT("ATAR");
                }
                break;

            case ProtocolType.SAE_J1939_CAN_29BIT_250KBAUD:
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("00FECE").Replace(" ", "").Contains("60FECE"))
                    {
                        bflag    = bflag || true;
                        standard = StandardType.SAE_J1939;
                    }
                }
                break;

            default:
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("22F810").Replace(" ", "").Contains("62F810"))
                    {
                        bflag    = bflag || true;
                        standard = StandardType.ISO_27145;
                    }
                }
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("0100").Replace(" ", "").Contains("4100"))
                    {
                        bflag    = true;
                        standard = StandardType.ISO_15031;
                    }
                }
                for (int i = 3; i > 0 && !bflag; i--)
                {
                    if (GetOBDResponse("00FECE").Replace(" ", "").Contains("60FECE"))
                    {
                        bflag    = bflag || true;
                        standard = StandardType.SAE_J1939;
                    }
                }
                break;
            }
            _log.TraceInfo("SetStandardType: " + standard.ToString());
            return(standard);
        }
Exemplo n.º 26
0
 private void Parse_SubrangeTypeDeclaration(int type_id, StandardType type_base)
 {
     base.BeginSubrange(type_id, type_base);
     this.Gen(base.code.OP_ADD_MIN_VALUE, type_id, this.Parse_Expression(), 0);
     this.Match("..");
     this.Gen(base.code.OP_ADD_MAX_VALUE, type_id, this.Parse_Expression(), 0);
     base.EndSubrange(type_id);
 }
Exemplo n.º 27
0
 public parameter(string p, string n, Article a, StandardType t, bool identIsAdj)
 {
     preposition = p; art = a; type = t; fullname1 = null; fullname2 = null; position = 1; identIsAdjectiveTypeIsNoun = identIsAdj;
     name        = (identIsAdj) ? (n + " " + t) : (n);
 }
Exemplo n.º 28
0
 public int AppConst(string name, object value, StandardType type_id)
 {
     int num = this.AppVar();
     SymbolRec rec = this[num];
     rec.Name = name;
     rec.Kind = MemberKind.Const;
     rec.Value = value;
     rec.Level = 0;
     rec.TypeId = (int) type_id;
     return num;
 }
Exemplo n.º 29
0
 public bool GetAttribute(string name, StandardType type, StandardTransient val)
 {
     return(Transfer_Finder_GetAttributeCBA201FA(Instance, name, type.Instance, val.Instance));
 }
 public bool IsType(StandardType atype)
 {
     return(StepData_PDescr_IsTypeE2B3EAC1(Instance, atype.Instance));
 }