Esempio n. 1
0
        public override bool PublishNewThread(string msg, SubForumInfo s)
        {
            List <object> lst = new List <object> {
                msg, s
            };

            return(sendFuncMsg <bool>(FuncMsgClient.FuncType.PublishNewThread, lst));
        }
Esempio n. 2
0
        public override List <PostInfo> WatchAllThreads(SubForumInfo s)
        {
            List <object> lst = new List <object> {
                s
            };

            return(sendFuncMsg <List <PostInfo> >(FuncMsgClient.FuncType.WatchAllThreads, lst));
        }
Esempio n. 3
0
        public override bool promoteMemberToModerator(MemberInfo moder, SubForumInfo s)
        {
            List <object> lst = new List <object> {
                moder, s
            };

            return(sendFuncMsg <bool>(FuncMsgClient.FuncType.promoteMemberToModerator, lst));
        }
Esempio n. 4
0
        private SubForumInfo makeTestSubforum(int i)
        {
            SubForumInfo f1 = new SubForumInfo();

            f1.Name = "test" + i;
            f1.id   = i;
            return(f1);
        }
Esempio n. 5
0
        public override List <PostInfo> WatchAllThreads(UserInfo u, SubForumInfo s)
        {
            List <PostInfo> result = new List <PostInfo>();

            for (int i = 0; i < tree.childsCount(); i++)
            {
                result.Add(tree.getChild(i).getData());
            }
            return(result);
        }
Esempio n. 6
0
        public override List <PostInfo> WatchAllThreads(UserInfo u, SubForumInfo s)
        {
            IList <Post>    all = SubForumFromInfo(s).MyThreads;
            List <PostInfo> ans = new List <PostInfo>();

            foreach (Post a in all)
            {
                ans.Add(PostToInfo(a));
            }
            return(ans);
        }
Esempio n. 7
0
        public override bool PublishNewThread(UserInfo u, string msg, SubForumInfo s)

        {
            if (msg == "")
            {
                return(false);
            }
            tree.addChild(new PostInfo {
                id = Int2Guid(postnum++), msg = msg, owner = memb
            });
            return(true);
        }
Esempio n. 8
0
        static void Main2(string[] args)
        {
            FuncMsgClient msg = new FuncMsgClient();

            FuncMsgClient msg2 = new FuncMsgClient();
            SubForumInfo  info = new SubForumInfo();

            info.Name = "forum1";
            SubForumInfo info2 = new SubForumInfo();

            info2.Name = "forum2";
            msg.type   = FuncMsgClient.FuncType.Replay;
            msg.args   = new List <object>();
            msg.args.Add(info);
            msg2.type = FuncMsgClient.FuncType.ErrorReplay;
            msg2.args = new List <object>();
            msg2.args.Add(info2);


            TcpClient gameServer = new TcpClient();

            //try
            //{
            System.Console.WriteLine("connecting...");
            gameServer.Connect("192.168.2.102", 12345);
            System.Console.WriteLine("connected");
            //}
            //catch (SocketException exp)
            //{
            //    System.Console.WriteLine("error");
            //    System.Console.WriteLine(exp);
            //    System.Console.ReadLine();
            //   return;
            //}
            NetworkStream   sourceStream = gameServer.GetStream();
            BinaryFormatter bformatter   = new BinaryFormatter();

            bformatter.Serialize(sourceStream, msg);

            bformatter.Serialize(sourceStream, msg2);
            sourceStream.Close();
        }
Esempio n. 9
0
 public override IList<PostInfo> WatchAllThreads(SubForumInfo s)
 {
     return _sys.WatchAllThreads(_usr, s);
 }
Esempio n. 10
0
 public override bool PublishNewThread(string msg, SubForumInfo s)
 {
     return _sys.PublishNewThread(_usr, msg, s);
 }
Esempio n. 11
0
 public override bool promoteMemberToModerator(UserInfo u, MemberInfo moder, SubForumInfo s)
 {
     throw new NotImplementedException();
 }
Esempio n. 12
0
 public CurrentForumState(ForumInfo myForum, SubForumInfo currentSubForumInfo, PostInfo currentPostInfo)
 {
     this.myForum             = myForum;
     this.currentSubForumInfo = currentSubForumInfo;
     this.currentPostInfo     = currentPostInfo;
 }
Esempio n. 13
0
 public override bool PublishNewThread(UserInfo u, string msg, SubForumInfo s)
 {
     return(PublishNewThread(UserFromInfo(u), msg, SubForumFromInfo(s)));
 }
Esempio n. 14
0
        private static bool testSubForum(SubForumInfo sf, int i)
        {
            string str = "test" + i;

            return(sf.Name == str && sf.id.Equals(Int2Guid(i)));
        }
Esempio n. 15
0
        abstract public List <PostInfo> WatchAllComments(PostInfo s);    //use case need to implements


        abstract public bool PublishNewThread(string msg, SubForumInfo s);
Esempio n. 16
0
 abstract public bool promoteMemberToModerator(MemberInfo moder, SubForumInfo s);
Esempio n. 17
0
 public override bool PublishNewThread(User u, string msg, SubForumInfo s)
 {
     return(msg == "test1" && testSubForum(s, 1));
 }
Esempio n. 18
0
 abstract public List <PostInfo> WatchAllThreads(SubForumInfo s); //use case need to implements
Esempio n. 19
0
 public override List <PostInfo> WatchAllThreads(User u, SubForumInfo s)
 {
     return(new List <PostInfo> {
         makeTestPost(1), makeTestPost(2), makeTestPost(3)
     });
 }
Esempio n. 20
0
 public override bool promoteMemberToModerator(UserInfo u, MemberInfo moder, SubForumInfo s)
 {
     return(false);
 }
Esempio n. 21
0
        private static bool testSubForum(SubForumInfo sf, int i)
        {
            string str = "test" + i;

            return(sf.Name == str && sf.id == i);
        }
Esempio n. 22
0
 public SubForum SubForumFromInfo(SubForumInfo s)
 {
     return(rep.GetBySubForumID(s.id));
 }
Esempio n. 23
0
 public override bool promoteMemberToModerator(UserInfo u, MemberInfo moder, SubForumInfo s)
 {
     return(promoteMemberToModerator(UserFromInfo(u), GetMemberByInfo(moder), SubForumFromInfo(s)));
 }