void delShareImage(List <byte[]> lstImgArry) { try { byte[] fullImg; int length = 0; int totalByte = 0; for (int i = 0; i < lstImgArry.Count; i++) { length += lstImgArry[i].Length; } fullImg = new byte[length]; for (int i = 0; i < lstImgArry.Count; i++) { for (int j = 0; j < lstImgArry[i].Length; j++) { fullImg[totalByte++] = lstImgArry[i][j]; } } ctlImage objImage = new ctlImage("", ImgTag); ImgTag += 1; objImage.ShowImage(fullImg); stackMain.Children.Add(objImage); lstImage.Add(fullImg); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delShareImage", "ctlImageSharing.xaml.cs"); } }
void delAddImage(List <object> lstData) { try { ctlImage objImage = new ctlImage("", ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.ShowImage((byte[])lstData[0]); stackMain.Children.Add(objImage); lstImage.Add((byte[])lstData[0]); objImage.EntSelectedImage += new ctlImage.DelSelectedImage(objImage_EntSelectedImage); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delAddImage", "ctlImageSharing.xaml.cs"); } }
void delImageBlock(List<object> lstData) { try { int i = 0; //------------------------------------------------------ //Check whether user exist in the list of current downloading img of perticular user bool checkUser = false; for (i = 0; i < lstImageTrack.Count; i++) { if (lstImageTrack[i].uName == lstData[0].ToString()) { checkUser = true; break; } } //------------------------------------------------------ //------------------------------------------------------ //Now If user is not present in current downloading list of users if (!checkUser) { //Check IF sent block of img is not single block if ((bool)lstData[3] == false) { ImageTrack objImgTrack = new ImageTrack(); if (objImgTrack.FullImgBlock == null) { objImgTrack.FullImgBlock = new byte[int.Parse(lstData[1].ToString())]; objImgTrack.pointer = 0; } objImgTrack.uName = lstData[0].ToString(); for (int j = 0; j < ((byte[])lstData[2]).Length; j++) { objImgTrack.FullImgBlock[objImgTrack.pointer++] = ((byte[])lstData[2])[j]; } lstImageTrack.Add(objImgTrack); } //Check IF blcok of img is single else if ((bool)lstData[3]) { ctlImage objImage = new ctlImage("", ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.ShowImage((byte[])lstData[2]); stackMain.Children.Add(objImage); lstImage.Add((byte[])lstData[2]); objImage.EntSelectedImage +=new ctlImage.DelSelectedImage(singleBlock_EntSelectedImage); } } //IF user is all ready exist in list of downloading imag of user else if (checkUser) { try { if ((bool)lstData[3] == false) { for (int j = 0; j < ((byte[])lstData[2]).Length; j++) { lstImageTrack[i].FullImgBlock[lstImageTrack[i].pointer++] = ((byte[])lstData[2])[j]; } } else if ((bool)lstData[3]) { for (int j = 0; j < ((byte[])lstData[2]).Length; j++) { lstImageTrack[i].FullImgBlock[lstImageTrack[i].pointer++] = ((byte[])lstData[2])[j]; } ctlImage objImage = new ctlImage("", ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.ShowImage(lstImageTrack[i].FullImgBlock); stackMain.Children.Add(objImage); lstImage.Add(lstImageTrack[i].FullImgBlock); objImage.EntSelectedImage +=new ctlImage.DelSelectedImage(lastBlock_EntSelectedImage); fncRemoveUser(lstData[0].ToString()); } } catch(Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delImageBlock", "ctlImageSharing.xaml.cs"); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delImageBlock", "ctlImageSharing.xaml.cs"); } }
void delShareImage(List<byte[]> lstImgArry) { try { byte[] fullImg; int length = 0; int totalByte = 0; for (int i = 0; i < lstImgArry.Count; i++) { length += lstImgArry[i].Length; } fullImg = new byte[length]; for (int i = 0; i < lstImgArry.Count; i++) { for (int j = 0; j < lstImgArry[i].Length; j++) { fullImg[totalByte++] = lstImgArry[i][j]; } } ctlImage objImage = new ctlImage("", ImgTag); ImgTag += 1; objImage.ShowImage(fullImg); stackMain.Children.Add(objImage); lstImage.Add(fullImg); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delShareImage", "ctlImageSharing.xaml.cs"); } }
void delAddImage(List<object> lstData) { try { ctlImage objImage = new ctlImage("", ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.ShowImage((byte[])lstData[0]); stackMain.Children.Add(objImage); lstImage.Add((byte[])lstData[0]); objImage.EntSelectedImage += new ctlImage.DelSelectedImage(objImage_EntSelectedImage); } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delAddImage", "ctlImageSharing.xaml.cs"); } }
void btnAddImage_Click(object sender, RoutedEventArgs e) { try { List<byte[]> lstarry = new List<byte[]>(); byte[] arr = new byte[5000]; OpenFileDialog objFileDialog = new OpenFileDialog(); objFileDialog.Title = "Open Image File"; objFileDialog.Filter = "Bitmap Files|*.bmp" + "|Enhanced Windows MetaFile|*.emf" + "|Exchangeable Image File|*.exif" + "|Gif Files|*.gif|Icons|*.ico|JPEG Files|*.jpg" + "|PNG Files|*.png|TIFF Files|*.tif|Windows MetaFile|*.wmf"; objFileDialog.DefaultExt = "jpg"; objFileDialog.ShowDialog(); FilePath = objFileDialog.FileName; if (FilePath != "") { ctlImage objImage = new ctlImage(FilePath, ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.EntSelectedImage += new ctlImage.DelSelectedImage(objImage_EntSelectedImage); tempArry = objImage.SetImage(FilePath); objImage.ShowImage(tempArry); stackMain.Children.Add(objImage); lstImage.Add(tempArry); Stream sname = fncStringToStream(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName); sname.Position = 0; byte[] NameByte = fncStreamToByteArry(sname); char delimeter = '!'; char del = '#'; if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithNetP2P || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.SuperNode) { MemoryStream FinalStrem = new MemoryStream(); FinalStrem.Write(NameByte, 0, NameByte.Length); FinalStrem.WriteByte((byte)delimeter); FinalStrem.Write(tempArry, 0, tempArry.Length); FinalStrem.Position = 0; channelNetTcp.svcSendIamge(FinalStrem); } else { MemoryStream finalImage = new MemoryStream(); finalImage.Write(NameByte, 0, NameByte.Length); finalImage.WriteByte((byte)delimeter); finalImage.Write(tempArry, 0, tempArry.Length); finalImage.WriteByte((byte)del); finalImage.WriteByte((byte)del); finalImage.WriteByte((byte)del); finalImage.Position = 0; channelHttp.svcSendIamge(finalImage); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "btnAddImage_Click", "ctlImageSharing.xaml.cs"); } }
void delImageBlock(List <object> lstData) { try { int i = 0; //------------------------------------------------------ //Check whether user exist in the list of current downloading img of perticular user bool checkUser = false; for (i = 0; i < lstImageTrack.Count; i++) { if (lstImageTrack[i].uName == lstData[0].ToString()) { checkUser = true; break; } } //------------------------------------------------------ //------------------------------------------------------ //Now If user is not present in current downloading list of users if (!checkUser) { //Check IF sent block of img is not single block if ((bool)lstData[3] == false) { ImageTrack objImgTrack = new ImageTrack(); if (objImgTrack.FullImgBlock == null) { objImgTrack.FullImgBlock = new byte[int.Parse(lstData[1].ToString())]; objImgTrack.pointer = 0; } objImgTrack.uName = lstData[0].ToString(); for (int j = 0; j < ((byte[])lstData[2]).Length; j++) { objImgTrack.FullImgBlock[objImgTrack.pointer++] = ((byte[])lstData[2])[j]; } lstImageTrack.Add(objImgTrack); } //Check IF blcok of img is single else if ((bool)lstData[3]) { ctlImage objImage = new ctlImage("", ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.ShowImage((byte[])lstData[2]); stackMain.Children.Add(objImage); lstImage.Add((byte[])lstData[2]); objImage.EntSelectedImage += new ctlImage.DelSelectedImage(singleBlock_EntSelectedImage); } } //IF user is all ready exist in list of downloading imag of user else if (checkUser) { try { if ((bool)lstData[3] == false) { for (int j = 0; j < ((byte[])lstData[2]).Length; j++) { lstImageTrack[i].FullImgBlock[lstImageTrack[i].pointer++] = ((byte[])lstData[2])[j]; } } else if ((bool)lstData[3]) { for (int j = 0; j < ((byte[])lstData[2]).Length; j++) { lstImageTrack[i].FullImgBlock[lstImageTrack[i].pointer++] = ((byte[])lstData[2])[j]; } ctlImage objImage = new ctlImage("", ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.ShowImage(lstImageTrack[i].FullImgBlock); stackMain.Children.Add(objImage); lstImage.Add(lstImageTrack[i].FullImgBlock); objImage.EntSelectedImage += new ctlImage.DelSelectedImage(lastBlock_EntSelectedImage); fncRemoveUser(lstData[0].ToString()); } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delImageBlock", "ctlImageSharing.xaml.cs"); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "delImageBlock", "ctlImageSharing.xaml.cs"); } }
void btnAddImage_Click(object sender, RoutedEventArgs e) { try { List <byte[]> lstarry = new List <byte[]>(); byte[] arr = new byte[5000]; OpenFileDialog objFileDialog = new OpenFileDialog(); objFileDialog.Title = "Open Image File"; objFileDialog.Filter = "Bitmap Files|*.bmp" + "|Enhanced Windows MetaFile|*.emf" + "|Exchangeable Image File|*.exif" + "|Gif Files|*.gif|Icons|*.ico|JPEG Files|*.jpg" + "|PNG Files|*.png|TIFF Files|*.tif|Windows MetaFile|*.wmf"; objFileDialog.DefaultExt = "jpg"; objFileDialog.ShowDialog(); FilePath = objFileDialog.FileName; if (FilePath != "") { ctlImage objImage = new ctlImage(FilePath, ImgTag); prevTag = ImgTag; ImgTag += 1; objImage.EntSelectedImage += new ctlImage.DelSelectedImage(objImage_EntSelectedImage); tempArry = objImage.SetImage(FilePath); objImage.ShowImage(tempArry); stackMain.Children.Add(objImage); lstImage.Add(tempArry); Stream sname = fncStringToStream(VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName); sname.Position = 0; byte[] NameByte = fncStreamToByteArry(sname); char delimeter = '!'; char del = '#'; if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.NodeWithNetP2P || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == VMuktiAPI.PeerType.SuperNode) { MemoryStream FinalStrem = new MemoryStream(); FinalStrem.Write(NameByte, 0, NameByte.Length); FinalStrem.WriteByte((byte)delimeter); FinalStrem.Write(tempArry, 0, tempArry.Length); FinalStrem.Position = 0; channelNetTcp.svcSendIamge(FinalStrem); } else { MemoryStream finalImage = new MemoryStream(); finalImage.Write(NameByte, 0, NameByte.Length); finalImage.WriteByte((byte)delimeter); finalImage.Write(tempArry, 0, tempArry.Length); finalImage.WriteByte((byte)del); finalImage.WriteByte((byte)del); finalImage.WriteByte((byte)del); finalImage.Position = 0; channelHttp.svcSendIamge(finalImage); } } } catch (Exception ex) { VMuktiHelper.ExceptionHandler(ex, "btnAddImage_Click", "ctlImageSharing.xaml.cs"); } }