예제 #1
0
 public RouteEntry(
     uint destination,
     uint mask,
     int policy,
     uint nextHop,
     NetworkInterface intf,
     ForwardType type,
     ForwardProtocol proto,
     int age,
     int nextHopAS,
     int metric1,
     int metric2,
     int metric3,
     int metric4,
     int metric5,
     int idx)
 {
     this._age         = age;
     this._policy      = policy;
     this._protocol    = proto;
     this._type        = type;
     this._destination = new IPAddress((long)destination);
     this._mask        = new IPAddress((long)mask);
     this._nextHop     = new IPAddress((long)nextHop);
     this._nextHopAS   = nextHopAS;
     this._interface   = intf;
     this._metric1     = metric1;
     this._metric2     = metric2;
     this._metric3     = metric3;
     this._metric4     = metric4;
     this._metric5     = metric5;
     this._index       = idx;
 }
예제 #2
0
 // 创建帖子对象
 public static Post CreatePost(string text, bool commentable, ForwardType forwardType, ShareType shareType, Visibility visibility, string viewPassword,
                               string systemTag, string publicTags, string privateTag, Guid?circleId, double latitude, double longitude, string locationName, string address, string cityCode,
                               List <Guid> friendIds, List <PostAttachment> postAttachments, int score, Guid userId, bool?showOriginalText = null)
 {
     return(new Post(text, showOriginalText, commentable, forwardType, shareType, visibility, viewPassword, systemTag, publicTags, privateTag, circleId, latitude, longitude,
                     locationName, address, cityCode, friendIds, postAttachments, score, userId));
 }
예제 #3
0
        // 构造帖子对象
        private Post(string text, bool?showOriginalText, bool commentable, ForwardType forwardType, ShareType shareType, Visibility visibility, string viewPassword,
                     string systemTag, string publicTags, string privateTag, Guid?circleId, double latitude, double longitude, string locationName, string address, string cityCode,
                     List <Guid> friendIds, List <PostAttachment> postAttachments, int score, Guid userId)
            : this(text, latitude, longitude, locationName, address, cityCode, postAttachments, userId)
        {
            // 发送标签更新事件
            AddTagChangedDomainEvent(publicTags);

            Commentable        = commentable;
            ForwardType        = forwardType;
            ShareType          = shareType;
            Visibility         = visibility;
            ViewPassword       = viewPassword;
            SystemTag          = systemTag;
            PublicTags         = publicTags;
            PrivateTag         = privateTag;
            CircleId           = circleId;
            _userPostRelations = friendIds?.Select(id => new UserPostRelation(id, UserPostRelationType.View)).ToList();
            PostType           = PostType.Post;
            ShowOriginalText   = showOriginalText;
            Score = score;
            LastScoreRefreshedTime = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
            // 公开帖子需要审核通过后才能显示
            PostAuthStatus = visibility == Visibility.Public ? PostAuthStatus.Authenticating : PostAuthStatus.Authenticated;
        }
예제 #4
0
        // 更新帖子对象
        public void Update(string text, bool commentable, ForwardType forwardType, ShareType shareType, Visibility visibility, string viewPassword,
                           string systemTag, string publicTags, string privateTag, Guid?circleId, double latitude, double longitude, string locationName, string address, string cityCode,
                           List <Guid> friendIds, List <PostAttachment> postAttachments, bool?showOriginalText = null)
        {
            // 发送标签更新事件
            AddTagChangedDomainEvent(publicTags);

            Text             = text;
            Commentable      = commentable;
            ForwardType      = forwardType;
            ShareType        = shareType;
            Visibility       = visibility;
            ViewPassword     = viewPassword;
            SystemTag        = systemTag;
            PublicTags       = publicTags;
            PrivateTag       = privateTag;
            CircleId         = circleId;
            CircleGood       = false; // 帖子编辑后自动取消精华帖
            Latitude         = latitude;
            Longitude        = longitude;
            LocationName     = locationName;
            Address          = address;
            CityCode         = cityCode;
            ShowOriginalText = showOriginalText;
            UpdatedTime      = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
            // 公开帖子需要审核通过后才能显示
            PostAuthStatus = visibility == Visibility.Public ? PostAuthStatus.Authenticating : PostAuthStatus.Authenticated;

            var relations = friendIds?.Select(id => new UserPostRelation(id, UserPostRelationType.View)).ToList() ?? new List <UserPostRelation>();

            for (var i = 0; i < _userPostRelations.Count; i++)
            {
                if (_userPostRelations[i].UserPostRelationType == UserPostRelationType.View)
                {
                    _userPostRelations.RemoveAt(i);
                    i--;
                }
            }
            _userPostRelations.AddRange(relations);

            _postAttachments.Clear();
            _postAttachments.AddRange(postAttachments ?? new List <PostAttachment>());
        }