public void Publish(PublishInfo publishInfo) { string publishJson = JsonConvert.SerializeObject(publishInfo, new ImageConverter()); SendCommand("Publish", publishJson); DealResponse(); }
public static void Main(string[] args) { Client client = new Client(); string remoteHost = "127.0.0.1"; int port = 8888; IPAddress remoteIPAddress = IPAddress.Parse(remoteHost); client.Connect(remoteIPAddress, port); string username = "******"; string password = "******"; RegisterInfo registerInfo = new RegisterInfo(username, password); client.Register(registerInfo); LoginInfo loginInfo = new LoginInfo(username, password); client.Login(loginInfo); HelpInfo helpInfo = new HelpInfo(); helpInfo.Title = "title"; Bitmap bitmap = new Bitmap(@"E:\Memory\picture\野良神\wow.jpeg"); helpInfo.Photo = bitmap; helpInfo.Time = new DateTime(2015, 1, 16); helpInfo.Place = "place"; helpInfo.More = "more!!!"; helpInfo.ContactWay = "contactway"; helpInfo.Contacter = "contacter"; string publisher = "publisher"; DateTime publishtime = DateTime.Now; PublishInfo publishInfo = new PublishInfo(helpInfo, publisher, publishtime); client.Publish(publishInfo); client.GetPublish(new GetPublishOption()); Console.ReadLine(); }