/// <summary> /// Returns requested picture. /// </summary> /// <param name="pGroup">Picture group</param> /// <param name="pId">Picture Id</param> /// <param name="pSubID">Picture sub Id</param> /// <param name="pThumbnail">Do you want the thumbnail or the actual picture?</param> /// <returns>Found picture informations</returns> public PictureInfo GetPicture(string pGroup, int pId, int pSubID, bool pThumbnail) { string sql = pThumbnail ? "SELECT thumbnail,name FROM Pictures WHERE [group]=@group AND id=@id AND subid=@subid" : "SELECT picture,name FROM Pictures WHERE [group]=@group AND id=@id AND subid=@subid"; using (OpenCbsCommand c = new OpenCbsCommand(sql, AttachmentsConnection)) { c.AddParam("@group", pGroup); c.AddParam("@id", pId); c.AddParam("@subid", pSubID); using (OpenCbsReader r = c.ExecuteReader()) { if (r == null || r.Empty) { return(null); } r.Read(); PictureInfo pi = new PictureInfo { Binary = r.GetBytes(0), Name = r.GetString(1), Id = pId, SubId = pSubID, Group = pGroup }; return(pi); } } }
private void Pic_listView_ItemTapped(object sender, ItemTappedEventArgs e) { //强制转换成要获取数据的类 PictureInfo pic = e.Item as PictureInfo; DisplayAlert("已点击:", pic.ID.ToString(), "确定"); }
public override void ReceiveLeaderChoice(GameObject leaderDestination) { if (leaderDestination.CompareTag("Uscita")) { Debug.Log(name + ": ricevuta nuova destinazione del leader (despota)", leaderDestination); Destination = leaderDestination; if (DestinationPrePause != null) { InPausa = false; ImportantIgnoratePicture.Add(DestinationPrePause.GetComponentInParent <PictureInfo>()); lastDestinationLeader = null; DestinationPrePause = null; } UpdateDestinationPointForNoChoiceExit(); GoToDestinationPoint(); return; } if (!VisitedPictures.Contains(leaderDestination.GetComponentInParent <PictureInfo>())) { if (DestinationPrePause) { ImportantIgnoratePicture.Add(DestinationPrePause.GetComponentInParent <PictureInfo>()); } lastDestinationLeader = leaderDestination.GetComponentInParent <PictureInfo>(); } }
public override GameObject GetNextDestination() { if ((ImportantPictures.Count <= 0 && groupData.LeaderIsAlive) || FatigueLevel >= FatigueManager.Level.MOLTO_STANCO) { return(GetPlaneOfExit()); } if (picturesToWatch.MoveNext()) { if (VisitedPictures.Contains(picturesToWatch.Current)) { return(GetNextDestination()); } GameObject pictureGrid = picturesToWatch.Current.GetComponentInChildren <GridSystem>().gameObject; return(pictureGrid); } if (ImportantPictures.Count > 0) { PictureInfo importantPicture = ImportantPictures[ImportantPictures.Count - 1]; ImportantPictures.Remove(importantPicture); return(importantPicture.GetComponentInChildren <GridSystem>().gameObject); } return(GetPlaneOfExit()); }
public APE() { emptyFile = "MP3/empty.mp3"; notEmptyFile = "MP3/APE.mp3"; tagType = MetaDataIOFactory.TAG_APE; // Initialize specific test data (Publisher and Description fields not supported in APE tag) testData.Publisher = null; testData.GeneralDescription = null; testData.RecordingDate = null; // Initialize specific test data (Picture native codes are strings) testData.Pictures.Clear(); PictureInfo pic = PictureInfo.fromBinaryData( File.ReadAllBytes(TestUtils.GetResourceLocationRoot() + "_Images/pic1.jpeg"), PIC_TYPE.Unsupported, MetaDataIOFactory.TAG_ANY, "COVER ART (FRONT)"); pic.ComputePicHash(); testData.Pictures.Add(pic); pic = PictureInfo.fromBinaryData( File.ReadAllBytes(TestUtils.GetResourceLocationRoot() + "_Images/pic1.png"), PIC_TYPE.Unsupported, MetaDataIOFactory.TAG_ANY, "COVER ART (BACK)"); pic.ComputePicHash(); testData.Pictures.Add(pic); }
public int SortByIndexPictureInWalls(GameObject wallX, GameObject wallY) { PictureInfo quadro_x = picturesOnWalls[wallX][0]; PictureInfo quadro_y = picturesOnWalls[wallY][0]; return(SortByIndex(quadro_x, quadro_y)); }
private void CheckLeaderDestination() { if (lastDestinationLeader.CompareTag("Empty Space")) { Destination = lastDestinationLeader.gameObject; } else { Destination = lastDestinationLeader.GetComponentInChildren <GridSystem>().gameObject; } bool IgnoreDestination = ImportantIgnoratePicture.Contains(Destination.GetComponentInParent <PictureInfo>()); if (!IgnoreDestination) { if (Destination.GetComponent <GridSystem>().HaveAvailablePoint()) { if (!Destination.CompareTag("Empty Space")) { VisitedPictures.Add(Destination.GetComponentInParent <PictureInfo>()); } } else { InPausa = true; DestinationPrePause = Destination; Destination = GetMostCloseEmptySpace(groupData.leader.GetComponent <BotVisitData>().destinationPoint.transform); } } lastDestinationLeader = null; UpdateDestinationPoint(); GoToDestinationPoint(); }
private ContextMenu PopulateMyPictureMenuItems(PictureInfo info) { MenuItem ProfilePicture = new MenuItem(); ProfilePicture.Header = "make profile picture"; ProfilePicture.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(ProfilePicture_Tap); MenuItem Favorite = new MenuItem(); Favorite.Header = "favorite"; Favorite.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(Favorite_Tap); MenuItem Save = new MenuItem(); Save.Header = "save"; Save.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(Save_Tap); MenuItem DeletePicture = new MenuItem(); DeletePicture.Header = "delete"; DeletePicture.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(DeletePicture_Tap); ContextMenu CM = new ContextMenu(); //CM.Items.Add(Favorite); CM.Items.Add(Save); if (!info.ID.Equals(App.MetrocamService.CurrentUser.ProfilePicture.ID)) { CM.Items.Add(ProfilePicture); } //CM.Items.Add(DeletePicture); return(CM); }
private void SaveMetaData(Picture picture, byte[] data) { var exifs = PictureInfo.ReadExifs(data); foreach (var exifsTag in exifs.Keys) { var tag = this.picShareContext.PicturesMetaDatas.SingleOrDefault(x => x.PictureId == picture.Id && x.Tag == exifsTag); if (tag != null) { continue; } tag = new PictureMetaData { PictureId = picture.Id, Tag = exifsTag, Value = exifs[exifsTag], }; this.picShareContext.PicturesMetaDatas.Add(tag); } this.picShareContext.SaveChanges(); }
public unsafe static void Decode(NvdecDevice device, ResourceManager rm, ref NvdecRegisters state) { PictureInfo pictureInfo = rm.Gmm.DeviceRead <PictureInfo>(state.SetPictureInfoOffset); H264PictureInfo info = pictureInfo.Convert(); ReadOnlySpan <byte> bitstream = rm.Gmm.DeviceGetSpan(state.SetBitstreamOffset, (int)pictureInfo.BitstreamSize); int width = (int)pictureInfo.PicWidthInMbs * MbSizeInPixels; int height = (int)pictureInfo.PicHeightInMbs * MbSizeInPixels; ISurface outputSurface = rm.Cache.Get(_decoder, CodecId.H264, 0, 0, width, height); if (_decoder.Decode(ref info, outputSurface, bitstream)) { int li = (int)pictureInfo.LumaOutputSurfaceIndex; int ci = (int)pictureInfo.ChromaOutputSurfaceIndex; uint lumaOffset = state.SetSurfaceLumaOffset[li]; uint chromaOffset = state.SetSurfaceChromaOffset[ci]; SurfaceWriter.Write(rm.Gmm, outputSurface, lumaOffset, chromaOffset); device.OnFrameDecoded(CodecId.H264, lumaOffset, chromaOffset); } rm.Cache.Put(outputSurface); }
public void ReadPicture(Stream s, ReadTagParams readTagParams) { int picturePosition; long initPosition = s.Position; VorbisMetaDataBlockPicture block = ReadMetadataBlockPicture(s); if (block.picType.Equals(PictureInfo.PIC_TYPE.Unsupported)) { addPictureToken(getImplementedTagType(), (byte)block.nativePicCode); picturePosition = takePicturePosition(getImplementedTagType(), (byte)block.nativePicCode); } else { addPictureToken(block.picType); picturePosition = takePicturePosition(block.picType); } if (readTagParams.ReadPictures) { s.Seek(initPosition + block.picDataOffset, SeekOrigin.Begin); PictureInfo picInfo = PictureInfo.fromBinaryData(s, block.picDataLength, block.picType, getImplementedTagType(), block.nativePicCode, picturePosition); picInfo.Description = block.description; tagData.Pictures.Add(picInfo); if (!tagExists) { tagExists = true; } } }
public APE() { emptyFile = "MP3/empty.mp3"; notEmptyFile = "MP3/APE.mp3"; tagType = MetaDataIOFactory.TAG_APE; // Initialize specific test data (Publisher and Description fields not supported in APE tag) testData.Publisher = null; testData.GeneralDescription = null; // Initialize specific test data (Picture native codes are strings) testData.Pictures.Clear(); PictureInfo pic = new PictureInfo(Commons.ImageFormat.Jpeg, MetaDataIOFactory.TAG_ANY, "COVER ART (FRONT)"); byte[] data = System.IO.File.ReadAllBytes(TestUtils.GetResourceLocationRoot() + "_Images/pic1.jpeg"); pic.PictureData = data; pic.ComputePicHash(); testData.Pictures.Add(pic); pic = new PictureInfo(Commons.ImageFormat.Png, MetaDataIOFactory.TAG_ANY, "COVER ART (BACK)"); data = System.IO.File.ReadAllBytes(TestUtils.GetResourceLocationRoot() + "_Images/pic1.png"); pic.PictureData = data; pic.ComputePicHash(); testData.Pictures.Add(pic); }
void Save_Click(object sender, EventArgs e) { PictureInfo info = CurrentPicture; String file = info.User.Username + info.ID + ".jpg"; var myStore = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream myFileStream = myStore.CreateFile(file); WriteableBitmap bitmap = new WriteableBitmap((BitmapSource)this.imgPicture.Source); bitmap.SaveJpeg(myFileStream, bitmap.PixelWidth, bitmap.PixelHeight, 0, 100); myFileStream.Close(); myFileStream = myStore.OpenFile(file, System.IO.FileMode.Open, System.IO.FileAccess.Read); var lib = new MediaLibrary(); lib.SavePicture(file, myFileStream); toastDisplay = GlobalToastPrompt.CreateToastPrompt( "Success!", "Picture has been saved to your media library."); toastDisplay.Show(); }
/// <summary> /// Get information of all the images /// </summary> /// <returns>Information for each image</returns> public static List <AllImagesInfo> getAllImageInfo() { AllImagesInfo imageInfo; List <AllImagesInfo> allImageInfo = new List <AllImagesInfo>(); string[] albums = Directory.GetFiles(Directory.GetCurrentDirectory() + "\\Users", "*.album", SearchOption.AllDirectories); foreach (string album in albums) { XDocument xdoc = new XDocument(); try { xdoc = XDocument.Load(album); var Albums = from AlbumInfo in xdoc.Descendants("AlbumInfo") select new { Header = AlbumInfo.Attribute("name").Value, Children = AlbumInfo.Descendants("PictureInfo") }; foreach (var albumInfo in Albums) { foreach (var PictureInfo in albumInfo.Children) { imageInfo.MD5 = PictureInfo.Attribute("md5").Value; imageInfo.path = PictureInfo.Attribute("path").Value; allImageInfo.Add(imageInfo); } } } catch { } } return(allImageInfo); }
private PictureInfo GetPictureFor(Product product, string attributesXml) { var pictureService = _services.PictureService; var attrParser = _services.Resolve <IProductAttributeParser>(); PictureInfo pictureInfo = null; if (attributesXml.HasValue()) { var combination = attrParser.FindProductVariantAttributeCombination(product.Id, attributesXml); if (combination != null) { var picturesIds = combination.GetAssignedMediaIds(); if (picturesIds != null && picturesIds.Length > 0) { pictureInfo = pictureService.GetPictureInfo(picturesIds[0]); } } } if (pictureInfo == null) { pictureInfo = pictureService.GetPictureInfo(product.MainPictureId); } if (pictureInfo == null && product.Visibility == ProductVisibility.Hidden && product.ParentGroupedProductId > 0) { pictureInfo = pictureService.GetPictureInfo(pictureService.GetPicturesByProductId(product.ParentGroupedProductId, 1).FirstOrDefault()); } return(pictureInfo); }
private void ViewUserDetailFromUsername_Tap(object sender, System.Windows.Input.GestureEventArgs e) { TextBlock username = sender as TextBlock; PictureInfo info = username.DataContext as PictureInfo; NavigationService.Navigate(new Uri("/UserDetailPage.xaml?id=" + info.ID + "&type=recent&userid=" + info.User.ID, UriKind.Relative)); }
//已通过测试 /// <summary> /// 用于客户端获取课程表或实验表图片 /// </summary> /// <param name="userNickName"></param> /// <param name="type"></param> /// <returns></returns> public PictureInfo ReceivePictureFromServer(string userNickName, TimetableAndExpPic type) { try { var pictureInfo = new PictureInfo(); var picture = dbContext.PICTUREINFO.Where(x => x.NICKNAME == userNickName).ToList().First(); if (type == TimetableAndExpPic.实验表) { pictureInfo.TtAndEP = TimetableAndExpPic.实验表; pictureInfo.UserNickName = picture.NICKNAME; pictureInfo.Picture = picture.EXPERIMENT; } else { pictureInfo.TtAndEP = TimetableAndExpPic.课程表; pictureInfo.UserNickName = picture.NICKNAME; pictureInfo.Picture = picture.COURSE; } return(pictureInfo); } catch { } return(null); }
void ProfilePicture_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MenuItem cm = sender as MenuItem; PictureInfo info = cm.DataContext as PictureInfo; User updatedData = new User(); UserInfo u = App.MetrocamService.CurrentUser; updatedData.Biography = u.Biography; updatedData.CreatedDate = u.CreatedDate; updatedData.EmailAddress = u.EmailAddress; updatedData.FriendlyCreatedDate = u.FriendlyCreatedDate; updatedData.ID = u.ID; updatedData.Location = u.Location; updatedData.Name = u.Name; updatedData.Password = App.MetrocamService.HashPassword(Settings.password.Value); updatedData.Username = u.Username; // update ProfilePicture updatedData.ProfilePictureID = info.ID; App.MetrocamService.UpdateUserCompleted += new RequestCompletedEventHandler(MetrocamService_UpdateUserCompleted); if (GlobalLoading.Instance.IsLoading == false) { GlobalLoading.Instance.IsLoading = true; } App.MetrocamService.UpdateUser(updatedData); }
private void recentPicture_Tap(object sender, System.Windows.Input.GestureEventArgs e) { Image image = sender as Image; PictureInfo info = image.DataContext as PictureInfo; NavigationService.Navigate(new Uri("/PictureView.xaml?id=" + info.ID + "&type=recent&userid=" + info.User.ID, UriKind.Relative)); }
void Favorite_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MenuItem item = sender as MenuItem; PictureInfo info = item.DataContext as PictureInfo; FavoritedPicture data = new FavoritedPicture(); data.PictureID = info.ID; data.UserID = App.MetrocamService.CurrentUser.ID; if ((from pic in App.FavoritedUserPictures where pic.ID.Equals(info.ID) select pic).SingleOrDefault() != null) { return; } if (App.FavoritedUserPictures.Count == 0) { FavoritesLoadingMessage.Visibility = Visibility.Collapsed; } App.FavoritedUserPictures.Add(info); App.MetrocamService.CreateFavoritedPictureCompleted += new RequestCompletedEventHandler(MetrocamService_CreateFavoritedPictureCompleted); App.MetrocamService.CreateFavoritedPicture(data); }
void Save_Tap(object sender, System.Windows.Input.GestureEventArgs e) { MenuItem item = sender as MenuItem; PictureInfo info = item.DataContext as PictureInfo; String file = info.User.Username + info.ID + ".jpg"; var myStore = IsolatedStorageFile.GetUserStoreForApplication(); IsolatedStorageFileStream myFileStream = myStore.CreateFile(file); BitmapImage b = new BitmapImage(new Uri(info.MediumURL, UriKind.Absolute)); b.CreateOptions = BitmapCreateOptions.None; Image i = new Image(); i.Source = b; WriteableBitmap bitmap = new WriteableBitmap((BitmapSource)i.Source); bitmap.SaveJpeg(myFileStream, bitmap.PixelWidth, bitmap.PixelHeight, 0, 100); myFileStream.Close(); myFileStream = myStore.OpenFile(file, System.IO.FileMode.Open, System.IO.FileAccess.Read); var lib = new MediaLibrary(); lib.SavePicture(file, myFileStream); toastDisplay = GlobalToastPrompt.CreateToastPrompt( "Success!", "Picture has been saved to your media library."); toastDisplay.Show(); }
void Unfavorite_Click(object sender, EventArgs e) { if (doingWork) { return; } App.ChangedFavoritedStatus[CurrentPicture.ID] = false; GlobalLoading.Instance.IsLoading = true; PictureInfo data = CurrentPicture; int i = 0; /** * update local copy of picture */ foreach (PictureInfo p in App.FavoritedUserPictures) { if (p.ID.Equals(CurrentPicture.ID)) { p.IsFavorited = false; break; } i++; } if (App.FavoritedUserPictures.Count != 0) { App.FavoritedUserPictures.RemoveAt(i); } App.MetrocamService.DeleteFavoritedPictureCompleted += new RequestCompletedEventHandler(MetrocamService_DeleteFavoritedPictureCompleted); App.MetrocamService.DeleteFavoritedPicture(f); }
private bool SelectNextPicInBackwardWalls(List <GameObject> considerateWall) { utilitySort.picturesOnWalls = picturesOnWalls; considerateWall.Sort(utilitySort.SortByIndexPictureInWalls); GameObject wallWithPictureSmallerIndex = considerateWall[0]; if (picturesOnWalls.ContainsKey(wallWithPictureSmallerIndex)) { List <PictureInfo> consideratePics = picturesOnWalls[wallWithPictureSmallerIndex]; consideratePics.Sort(utilitySort.DistanzaPicture); PictureInfo mostClosePicture = consideratePics[0]; nextDestination = mostClosePicture.GetComponentInChildren <GridSystem>().gameObject; CurrentPictureIndex = mostClosePicture.index; consideratePics.Remove(mostClosePicture); if (consideratePics.Count <= 0) { picturesOnWalls.Remove(wallWithPictureSmallerIndex); } return(true); } return(false); }
private void FavoritedPicture_Tap(object sender, System.Windows.Input.GestureEventArgs e) { Image tile = sender as Image; PictureInfo info = tile.DataContext as PictureInfo; NavigationService.Navigate(new Uri("/PictureView.xaml?id=" + info.ID + "&type=favorite", UriKind.Relative)); }
public AA() { notEmptyFile = "AA/aa.aa"; tagType = MetaDataIOFactory.TAG_NATIVE; // Initialize specific test data testData = new TagData(); testData.Title = "The New York Times Audio Digest, July 10, 2015"; testData.Artist = "The New York Times"; testData.Album = "The New York Times Audio Digest"; testData.Comment = "It's the perfect listen for your morning commute! In the time it takes you to get to work, you'll hear a digest of the day's top stories, prepared by the editorial staff of The New York Times...."; testData.PublishingDate = DateTime.Parse("10-JUL-2015").ToString(); testData.Publisher = "The New York Times"; testData.Composer = "The New York Times"; testData.GeneralDescription = "It's the perfect listen for your morning commute! In the time it takes you to get to work, you'll hear a digest of the day's top stories, prepared by the editorial staff of The New York Times. Each edition includes articles from the front page, as well as the paper's international, national, business, sports, and editorial sections."; testData.Copyright = "(P) and ©2015 The New York Times News Services Division of The New York Times Company"; // Initialize specific test data (Picture native codes are strings) testData.Pictures.Clear(); PictureInfo pic = PictureInfo.fromBinaryData( File.ReadAllBytes(TestUtils.GetResourceLocationRoot() + "AA/aa.jpg"), PIC_TYPE.Generic, MetaDataIOFactory.TAG_ANY, 11); pic.ComputePicHash(); testData.Pictures.Add(pic); supportsInternationalChars = true; }
public List <PictureInfo> ReveicePicture(string userRealName, string type) { try { List <PictureInfo> pictures = new List <PictureInfo>(); var usersInfo = dbContext.USERINFO.Where(x => x.REALNAME == userRealName).ToList(); if (usersInfo.Count == 0) { return(null); } foreach (var item in usersInfo) { var data = dbContext.PICTUREINFO.Where(x => x.NICKNAME == item.NICKNAME).ToList().First(); PictureInfo picture = new PictureInfo(); picture.UserNickName = item.NICKNAME; if (type == "course") { picture.TtAndEP = TimetableAndExpPic.课程表; picture.Picture = data.COURSE; } if (type == "experiment") { picture.TtAndEP = TimetableAndExpPic.实验表; picture.Picture = data.EXPERIMENT; } pictures.Add(picture); } return(pictures); } catch (Exception ex) { MessageBox.Show(ex.Message); } return(null); }
public ActionResult AddPic(HttpPostedFileBase ImgFile, PictureInfo pic, int picClsTitle) { string account = Server.HtmlEncode(Request.Cookies["Accout"].Value); if (ImgFile != null) { FileInfo fi = new FileInfo(ImgFile.FileName); string hz = fi.Extension; string time = DateTime.Now.ToString("yyyyMMddHHmmssffffff"); if (ImgFile.ContentLength > 0 && hz == ".jpg" || hz == ".gif" || hz == ".png" || hz == ".jpeg") { //更新所上传相册的照片量 PictureClass pc = db.PictureClass.Find(picClsTitle); pc.picClsPicCnt = pc.picClsPicCnt + 1; ImgFile.SaveAs(Server.MapPath("~/UploadPicture/ImagesFile/" + time + hz)); pic.uAccount = account; pic.PicClsID = picClsTitle; pic.picCreateTime = DateTime.Now; pic.picHot = 0; pic.ImgFile = "/UploadPicture/ImagesFile/" + time + hz; db.PictureInfo.Add(pic); db.SaveChanges(); } else { return(Content("<script>alert('SORRY!!!上传失败!!!请用.jpg/.jpeg/.gif/.png的照片上传。');history.go(-1);</script>")); } } return(RedirectToAction("index", "mypicture")); }
public MP4() { emptyFile = "AAC/empty.m4a"; // Has empty udta/meta tags notEmptyFile = "AAC/mp4.m4a"; tagType = MetaDataIOFactory.TAG_NATIVE; // MP4 does not support leading zeroes testData.TrackNumber = "1"; testData.TrackTotal = "2"; testData.DiscNumber = "3"; testData.DiscTotal = "4"; testData.RecordingDate = "1997-06-20T00:00:00"; // No timestamp in MP4 date format testData.Conductor = null; // TODO - Should be supported; extended field makes it harder to manipulate by the generic test code testData.Publisher = null; testData.Genre = "Household"; // "House" was generating a 'gnre' numeric field whereas ATL standard way of tagging is '(c)gen' string field => Start with a non-standard Genre testData.AdditionalFields.Clear(); testData.AdditionalFields.Add(new MetaFieldInfo(MetaDataIOFactory.TAG_ANY, "----:com.apple.iTunes:TEST", "xxx")); testData.Pictures.Clear(); PictureInfo pic = PictureInfo.fromBinaryData(File.ReadAllBytes(TestUtils.GetResourceLocationRoot() + "_Images/pic1.jpeg"), PIC_TYPE.Unsupported, MetaDataIOFactory.TAG_ANY, 13); pic.ComputePicHash(); testData.Pictures.Add(pic); supportsDateOrYear = true; }
public static void Decode(NvdecDecoderContext context, ResourceManager rm, ref NvdecRegisters state) { PictureInfo pictureInfo = rm.Gmm.DeviceRead <PictureInfo>(state.SetPictureInfoOffset); H264PictureInfo info = pictureInfo.Convert(); ReadOnlySpan <byte> bitstream = rm.Gmm.DeviceGetSpan(state.SetBitstreamOffset, (int)pictureInfo.BitstreamSize); int width = (int)pictureInfo.PicWidthInMbs * MbSizeInPixels; int height = (int)pictureInfo.PicHeightInMbs * MbSizeInPixels; int surfaceIndex = (int)pictureInfo.OutputSurfaceIndex; uint lumaOffset = state.SetSurfaceLumaOffset[surfaceIndex]; uint chromaOffset = state.SetSurfaceChromaOffset[surfaceIndex]; Decoder decoder = context.GetH264Decoder(); ISurface outputSurface = rm.Cache.Get(decoder, 0, 0, width, height); if (decoder.Decode(ref info, outputSurface, bitstream)) { SurfaceWriter.Write(rm.Gmm, outputSurface, lumaOffset, chromaOffset); } rm.Cache.Put(outputSurface); }
public void ExecutePictureInfo(object sender) { Application.Current.Properties["pictureInfo"] = PictureInfo.CreatePictureInfo(this._coverImageBitmapCache); ((PictureInfo)Application.Current.Properties["pictureInfo"]).FilePath = this.ImageFilePath; new PictureInfoViewModel().DoUpdate(sender as Window); Application.Current.Properties["pictureInfo"] = null; }
private Stream GetData(Nop280_Picture picture, PictureInfo pictureInfo) { string fileName = picture.Id.ToString().PadLeft(7, '0') + "_0" + GetExtension(picture); switch (pictureInfo.PictureLocation) { case PictureLocation.OnDisc: string discFolderLocation = GetOnDiscFolderLocation(pictureInfo.LocationData); return File.OpenRead(discFolderLocation + fileName); case PictureLocation.Url: string webFolder = GetWebFolderLocation(pictureInfo.LocationData); return WebRequest.Create(webFolder + fileName).GetResponse().GetResponseStream(); case PictureLocation.Database: return new MemoryStream(picture.PictureBinary.ToArray()); default: throw new ArgumentOutOfRangeException(); } }
public void DumpXmlToArray (string filename) { doc.Load (filename); XmlNode root = doc.DocumentElement; XmlAttributeCollection attrs = root.Attributes; XmlAttribute attr; attr = (XmlAttribute) attrs [0]; album_name = attr.InnerText; attr = (XmlAttribute) attrs [1]; picture_count = Convert.ToInt64 (attr.InnerText); picture_data = new PictureInfo [picture_count]; XmlNode picture = doc.FirstChild.FirstChild; int i = 0; while (picture != null) { XmlNodeList props = picture.ChildNodes; IEnumerator iter = props.GetEnumerator (); ArrayList data = new ArrayList (); while (iter.MoveNext ()) { XmlNode node = (XmlNode) iter.Current; string val = node.InnerText.Trim (); if (val != "") data.Add (val); } if (picture.HasChildNodes) { picture_data [i] = new PictureInfo ((string) data [0], (string) data [1], (string) data [2], (string) data [3], (string) data [4], Convert.ToInt64 (data [5])); i++; } picture = picture.NextSibling; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { GlobalLoading.Instance.Text = ""; if (App.isFromEditProfile) { toastDisplay = GlobalToastPrompt.CreateToastPrompt( "Success!", "Your profile has been updated."); toastDisplay.Show(); App.isFromEditProfile = false; } if (NavigationContext.QueryString["userid"].Equals(App.MetrocamService.CurrentUser.ID)) { // User navigates to his own profile SetCurrentUserProfile(); if (this.UserPictures.ItemsSource == null) { App.MetrocamService.FetchUserPicturesCompleted += new MobileClientLibrary.RequestCompletedEventHandler(MetrocamService_FetchUserPicturesCompleted); GlobalLoading.Instance.IsLoading = true; App.MetrocamService.FetchUserPictures(App.MetrocamService.CurrentUser.ID); } else if (App.pictureIsDeleted == true) { // User has deleted a picture and is navigated back to this page App.pictureIsDeleted = false; App.MetrocamService.FetchUserPicturesCompleted += new MobileClientLibrary.RequestCompletedEventHandler(MetrocamService_FetchUserPicturesCompleted); GlobalLoading.Instance.IsLoading = true; App.MetrocamService.FetchUserPictures(App.MetrocamService.CurrentUser.ID); } return; } else if (this.UserPictures.ItemsSource != null) { return; } if (NavigationContext.QueryString["type"].Equals("popular")) { // User navigated here from Popular Pivot SelectedPicture = (from pic in App.PopularPictures where pic.ID.Equals(NavigationContext.QueryString["id"]) select pic).First<PictureInfo>(); } else if (NavigationContext.QueryString["type"].Equals("recent")) { // User navigated here from Recent Pivot SelectedPicture = (from pic in App.RecentPictures where pic.ID.Equals(NavigationContext.QueryString["id"]) select pic).First<PictureInfo>(); } else if (NavigationContext.QueryString["type"].Equals("search")) { // User navigated here from Search Menu App.MetrocamService.FetchUserCompleted += new MobileClientLibrary.RequestCompletedEventHandler(MetrocamService_FetchUserCompleted); App.MetrocamService.FetchUser(NavigationContext.QueryString["id"]); return; } // Save into userInfo object this.userInfo = SelectedPicture.User; // pivot name this.PivotRoot.Title = SelectedPicture.User.Username; // profile pic profilePicture.Source = (new BitmapImage(new Uri(SelectedPicture.User.ProfilePicture.MediumURL, UriKind.RelativeOrAbsolute))); // name fullName.Text = SelectedPicture.User.Name; // location if (SelectedPicture.User.Location == null) hometown.Text = "Earth"; else hometown.Text = SelectedPicture.User.Location; // username usernameTextBlock.Text = SelectedPicture.User.Username; // bio if (SelectedPicture.User.Biography == null) biographyTextBlock.Text = "Just another Metrocammer!"; else biographyTextBlock.Text = SelectedPicture.User.Biography; PictureLabel.Text = SelectedPicture.User.Pictures.ToString(); FollowingLabel.Text = SelectedPicture.User.Following.ToString(); FollowerLabel.Text = SelectedPicture.User.Followers.ToString(); App.MetrocamService.FetchUserPicturesCompleted += new MobileClientLibrary.RequestCompletedEventHandler(MetrocamService_FetchUserPicturesCompleted); GlobalLoading.Instance.IsLoading = true; App.MetrocamService.FetchUserPictures(userInfo.ID); userInfo.ID = SelectedPicture.User.ID; if (App.ChangedFollowerStatus.ContainsKey(userInfo.ID)) { if (App.ChangedFollowerStatus[userInfo.ID] == true) { FollowingStatus.Text = "You are following " + userInfo.Username + "."; ConstructAppBar(false, true); } else { FollowingStatus.Text = "You are not following " + userInfo.Username + "."; ConstructAppBar(false, false); } } else { if (SelectedPicture.User.IsFollowing == false) { FollowingStatus.Text = "You are not following " + userInfo.Username + "."; ConstructAppBar(false, false); } else { FollowingStatus.Text = "You are following " + userInfo.Username + "."; ConstructAppBar(false, true); } } }
private ContextMenu PopulateMyPictureMenuItems(PictureInfo info) { MenuItem ProfilePicture = new MenuItem(); ProfilePicture.Header = "make profile picture"; ProfilePicture.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(ProfilePicture_Tap); MenuItem Favorite = new MenuItem(); Favorite.Header = "favorite"; Favorite.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(Favorite_Tap); MenuItem Save = new MenuItem(); Save.Header = "save"; Save.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(Save_Tap); MenuItem DeletePicture = new MenuItem(); DeletePicture.Header = "delete"; DeletePicture.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(DeletePicture_Tap); ContextMenu CM = new ContextMenu(); //CM.Items.Add(Favorite); CM.Items.Add(Save); if (!info.ID.Equals(App.MetrocamService.CurrentUser.ProfilePicture.ID)) CM.Items.Add(ProfilePicture); //CM.Items.Add(DeletePicture); return CM; }
public void DumpXmlToArray (string filename) { XmlTextReader reader = new XmlTextReader (filename); reader.WhitespaceHandling = WhitespaceHandling.None; int i = 0; while (reader.Read ()) { switch (reader.NodeType) { case XmlNodeType.Element : if (reader.Name == "album") { reader.MoveToNextAttribute (); album_name = reader.Value; reader.MoveToNextAttribute (); picture_count = Convert.ToInt64 (reader.Value); } break; case XmlNodeType.Text : if (reader.Name == "location") picture_data [i].Location = reader.Value; if (reader.Name == "title") picture_data [i].Title = reader.Value; if (reader.Name == "date") picture_data [i].Date = reader.Value; if (reader.Name == "keywords") picture_data [i].Keywords = reader.Value; if (reader.Name == "comments") picture_data [i].Comments = reader.Value; if (reader.Name == "index") picture_data [i].Index = Convert.ToInt64 (reader.Value); case XmlNodeType.EndElement : if (reader.Name == "picture") { i++; picture_data [i] = new PictureInfo (); } break; default : continue; break; } } reader.Close (); }
private static void AddPicture(Worksheet currentSheet, PictureInfo pictureInfo) { Uri pictureUri = new Uri(pictureInfo.PictureFullName); BitmapImage imageSource = new BitmapImage(pictureUri); currentSheet.AddPicture(pictureInfo.NewPictrueName, imageSource, pictureInfo.RowIndex, 0.0, pictureInfo.ColumnIndex, 0.0); }
private static void AddPictures(String[] fileNames, string[] safeFileNames, Worksheet currentSheet) { int row = currentSheet.ActiveCell.Row.Index; int column = currentSheet.ActiveCell.Column.Index; for (int i = 0; i < fileNames.Length; i++) { string newName = GetUniquePictureName(currentSheet, safeFileNames[i]); PictureInfo pInfo = new PictureInfo(); pInfo.ColumnIndex = column; pInfo.RowIndex = row; pInfo.NewPictrueName = newName; pInfo.PictureFullName = fileNames[i]; AddPicture(currentSheet, pInfo); row++; column++; } }
/// <summary> /// Returns requested picture. /// </summary> /// <param name="pGroup">Picture group</param> /// <param name="pId">Picture Id</param> /// <param name="pSubID">Picture sub Id</param> /// <param name="pThumbnail">Do you want the thumbnail or the actual picture?</param> /// <returns>Found picture informations</returns> public PictureInfo GetPicture(string pGroup, int pId, int pSubID, bool pThumbnail) { string sql = pThumbnail ? "SELECT thumbnail,name FROM Pictures WHERE [group]=@group AND id=@id AND subid=@subid" : "SELECT picture,name FROM Pictures WHERE [group]=@group AND id=@id AND subid=@subid"; using (OpenCbsCommand c = new OpenCbsCommand(sql, AttachmentsConnection)) { c.AddParam("@group", pGroup); c.AddParam("@id", pId); c.AddParam("@subid", pSubID); using (OpenCbsReader r = c.ExecuteReader()) { if (r == null || r.Empty) return null; r.Read(); PictureInfo pi = new PictureInfo { Binary = r.GetBytes(0), Name = r.GetString(1), Id = pId, SubId = pSubID, Group = pGroup }; return pi; } } }