public override bool PublishNewThread(string msg, SubForumInfo s) { List <object> lst = new List <object> { msg, s }; return(sendFuncMsg <bool>(FuncMsgClient.FuncType.PublishNewThread, lst)); }
public override List <PostInfo> WatchAllThreads(SubForumInfo s) { List <object> lst = new List <object> { s }; return(sendFuncMsg <List <PostInfo> >(FuncMsgClient.FuncType.WatchAllThreads, lst)); }
public override bool promoteMemberToModerator(MemberInfo moder, SubForumInfo s) { List <object> lst = new List <object> { moder, s }; return(sendFuncMsg <bool>(FuncMsgClient.FuncType.promoteMemberToModerator, lst)); }
private SubForumInfo makeTestSubforum(int i) { SubForumInfo f1 = new SubForumInfo(); f1.Name = "test" + i; f1.id = i; return(f1); }
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); }
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); }
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); }
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(); }
public override IList<PostInfo> WatchAllThreads(SubForumInfo s) { return _sys.WatchAllThreads(_usr, s); }
public override bool PublishNewThread(string msg, SubForumInfo s) { return _sys.PublishNewThread(_usr, msg, s); }
public override bool promoteMemberToModerator(UserInfo u, MemberInfo moder, SubForumInfo s) { throw new NotImplementedException(); }
public CurrentForumState(ForumInfo myForum, SubForumInfo currentSubForumInfo, PostInfo currentPostInfo) { this.myForum = myForum; this.currentSubForumInfo = currentSubForumInfo; this.currentPostInfo = currentPostInfo; }
public override bool PublishNewThread(UserInfo u, string msg, SubForumInfo s) { return(PublishNewThread(UserFromInfo(u), msg, SubForumFromInfo(s))); }
private static bool testSubForum(SubForumInfo sf, int i) { string str = "test" + i; return(sf.Name == str && sf.id.Equals(Int2Guid(i))); }
abstract public List <PostInfo> WatchAllComments(PostInfo s); //use case need to implements abstract public bool PublishNewThread(string msg, SubForumInfo s);
abstract public bool promoteMemberToModerator(MemberInfo moder, SubForumInfo s);
public override bool PublishNewThread(User u, string msg, SubForumInfo s) { return(msg == "test1" && testSubForum(s, 1)); }
abstract public List <PostInfo> WatchAllThreads(SubForumInfo s); //use case need to implements
public override List <PostInfo> WatchAllThreads(User u, SubForumInfo s) { return(new List <PostInfo> { makeTestPost(1), makeTestPost(2), makeTestPost(3) }); }
public override bool promoteMemberToModerator(UserInfo u, MemberInfo moder, SubForumInfo s) { return(false); }
private static bool testSubForum(SubForumInfo sf, int i) { string str = "test" + i; return(sf.Name == str && sf.id == i); }
public SubForum SubForumFromInfo(SubForumInfo s) { return(rep.GetBySubForumID(s.id)); }
public override bool promoteMemberToModerator(UserInfo u, MemberInfo moder, SubForumInfo s) { return(promoteMemberToModerator(UserFromInfo(u), GetMemberByInfo(moder), SubForumFromInfo(s))); }