Beispiel #1
0
 public override string ToString()
 {
     if (maxCapacity == 0)
     {
         return("0");
     }
     if (isReadOnly)
     {
         if (length == 0)
         {
             return(EMPTY.ToString());
         }
         StringBuilder sb  = new StringBuilder();
         ComponentId   cid = this.components[0];
         sb.Append(cid.ToString());
         for (int i = 1; i < length; i++)
         {
             cid = this.components[i];
             sb.Append(componentDelimeter);
             sb.Append(cid.ToString());
         }
         return(sb.ToString());
     }
     else
     {
         return(base.ToString());
     }
 }
Beispiel #2
0
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "componentid": // Int
                return(ComponentId.ToString(strFormat, formatProvider));

            case "moduleid": // Int
                return(ModuleId.ToString(strFormat, formatProvider));

            case "componentname": // NVarChar
                return(PropertyAccess.FormatString(ComponentName, strFormat));

            case "latestversion": // VarChar
                return(PropertyAccess.FormatString(LatestVersion, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
 public void ToStringTest()
 {
     ComponentId target = new ComponentId(); // TODO: 初始化为适当的值
     string expected = string.Empty; // TODO: 初始化为适当的值
     string actual;
     actual = target.ToString();
     Assert.AreEqual( expected, actual );
     Assert.Inconclusive( "验证此测试方法的正确性。" );
 }
        public void ToStringTest()
        {
            ComponentId target   = new ComponentId(); // TODO: 初始化为适当的值
            string      expected = string.Empty;      // TODO: 初始化为适当的值
            string      actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
        public void ToString_ShouldReturnValue()
        {
            // Arrange
            const string componentIdString = "Some component id";
            var          componentId       = new ComponentId(componentIdString);

            // Act
            var actual = componentId.ToString();

            // Assert
            Assert.That(actual, Is.EqualTo(componentIdString));
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "componenthistoryid": // Int
                return(ComponentHistoryId.ToString(strFormat, formatProvider));

            case "componentid": // Int
                return(ComponentId.ToString(strFormat, formatProvider));

            case "version": // VarChar
                return(PropertyAccess.FormatString(Version, strFormat));

            case "versionnormalized": // VarChar
                return(PropertyAccess.FormatString(VersionNormalized, strFormat));

            case "fullname": // VarChar
                return(PropertyAccess.FormatString(FullName, strFormat));

            case "codelines": // Int
                return(CodeLines.ToString(strFormat, formatProvider));

            case "commentlines": // Int
                if (CommentLines == null)
                {
                    return("");
                }
                ;
                return(((int)CommentLines).ToString(strFormat, formatProvider));

            case "emptylines": // Int
                if (EmptyLines == null)
                {
                    return("");
                }
                ;
                return(((int)EmptyLines).ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "commentid": // Int
                return(CommentID.ToString(strFormat, formatProvider));

            case "componentid": // Int
                return(ComponentId.ToString(strFormat, formatProvider));

            case "itemtype": // Int
                return(ItemType.ToString(strFormat, formatProvider));

            case "itemid": // Int
                return(ItemId.ToString(strFormat, formatProvider));

            case "parentid": // Int
                if (ParentId == null)
                {
                    return("");
                }
                ;
                return(((int)ParentId).ToString(strFormat, formatProvider));

            case "message": // NVarCharMax
                return(PropertyAccess.FormatString(Message, strFormat));

            case "approved": // Bit
                if (Approved == null)
                {
                    return("");
                }
                ;
                return(Approved.ToString());

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }
Beispiel #8
0
        public Ssr(ComponentId id, IBeerFactoryEventHandler eventHandler, ILoggerFactory loggerFactory)
        {
            Logger        = loggerFactory.CreateLogger <Ssr>();
            _eventHandler = eventHandler;
            CurrentState  = new SsrState {
                Id = id
            };

            Enum.TryParse(id.ToString(), out SsrPin ssrPin);
            _pinNumber = (int)ssrPin;

            var gpio = GpioController.GetDefault();

            if (gpio != null)
            {
                _pin = gpio.OpenPin(_pinNumber);
                _pin.SetDriveMode(GpioPinDriveMode.Output);
                _pin.Write(GpioPinValue.Low);
            }

            _eventHandler.SubscribeToComponentStateRequest <SsrRequestState>(SsrStateRequestOccured);
        }
 public virtual string GetDataFolder()
 {
     return(ComponentId.ToString());
 }