private void GetPictureFromS2Click(object sender, EventArgs e) { var api = new S2API(S2APIUrl, S2APIUser, S2APIPassword, false); var nd = api.GetPicture("0"); var fileName = nd["PICTUREURL"].InnerText; var imageData = Convert.FromBase64String(nd["PICTURE"].InnerText); var text = fileName; Image image; using (var imageStream = new MemoryStream(imageData)) { image = Image.FromStream(imageStream); } //using (var stream = new FileStream(fileName, FileMode.Create)) //{ // using (var writer = new BinaryWriter(stream)) // { // writer.Write(imageData); // writer.Close(); // } //} AssignView(text, image); }
private void button9_Click(object sender, EventArgs e) { S2API api = new S2API("http://10.1.1.233/goforms/nbapi", "admin", "072159245241245031239120017047219193126250124056"); XmlNode nd = api.GetPicture("4086"); string fileName = nd["PICTUREURL"].InnerText; byte[] imageData = Convert.FromBase64String(nd["PICTURE"].InnerText); txtOutput.Text = fileName; using (FileStream stream = new FileStream(fileName, FileMode.Create)) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(imageData); writer.Close(); } } }