const int Version1 = 1; //旧ファイルバージョン //バイナリ読み込み void ReadBinary(BinaryReader reader) { int magicID = reader.ReadInt32(); if (magicID != MagicID) { throw new System.Exception("Read File Id Error"); } int fileVersion = reader.ReadInt32(); if (fileVersion == Version) { ReadData.Read(reader); Engine.Config.Read(reader); GalleryData.Read(reader); Engine.Param.ReadSystemData(reader); } else if (fileVersion == Version1) { ReadData.Read(reader); Engine.Config.Read(reader); GalleryData.Read(reader); } else { throw new System.Exception(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, fileVersion)); } }
internal static GalleryList DeserializeGalleryList(JsonElement element) { IReadOnlyList <GalleryData> value = default; Optional <string> nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { List <GalleryData> array = new List <GalleryData>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(GalleryData.DeserializeGalleryData(item)); } value = array; continue; } if (property.NameEquals("nextLink")) { nextLink = property.Value.GetString(); continue; } } return(new GalleryList(value, nextLink.Value)); }
Gallery IOperationSource <Gallery> .CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); var data = GalleryData.DeserializeGalleryData(document.RootElement); return(new Gallery(_operationBase, data)); }
public void GetAllVotesByAvatar() { IVote voteDb = new GalleryData(); var voteForAvatar = voteDb.GetVotesByAvatar(this.Id); this.UpVotes.AddRange(voteForAvatar); }
public void GetCardsByTag_Test() { //Given Gallery gallery = new Gallery(); IGalleryData galleryDb = new GalleryData(); var tags = new List <Tag>() { new Tag() { TagItem = "drawings" }, new Tag() { TagItem = "lady" } }; var result = galleryDb.GetGalleryCardsByTags(tags); //When // var g = gallery.GetGalleryByTag(); foreach (var item in result) { output.WriteLine("ID: {0}, Title: {1}", item.Id, item.Title); } //Then Assert.Equal(2, result.Count()); }
//バイナリ書き込み void WriteBinary(BinaryWriter writer) { writer.Write(MagicID); writer.Write(Version); ReadData.Write(writer); Engine.Config.Write(writer); GalleryData.Write(writer); Engine.Param.WriteSystemData(writer); }
public static GalleryData GetBasicGalleryData(AzureLocation location, string description = null) { var data = new GalleryData(location) { Description = description }; return(data); }
private void SelectionPageChangeEventHandler(Guid EventArg) { FirePropertyChanged("Top"); FirePropertyChanged("Left"); FirePropertyChanged("Width"); FirePropertyChanged("Height"); FirePropertyChanged("RotateAngle"); FirePropertyChanged("CornerRadius"); FirePropertyChanged("Opacity"); FirePropertyChanged("IsHidden"); FirePropertyChanged("IsFixed"); FirePropertyChanged("IsFixedEnabled"); FirePropertyChanged("TextRotate"); //Fire Color //FirePropertyChanged("BackgroundColorView"); ////FirePropertyChanged("BackgroundColor32"); //FirePropertyChanged("FontColorView"); //FirePropertyChanged("BorderLineColorView"); GalleryData <StyleColor> cdata = _dataCollection["Background Color Gallery"] as GalleryData <StyleColor>; if (cdata != null) { cdata.SelectedItem = BackgroundColorView; } var Bdata = _dataCollection["Font Color Gallery"] as GalleryData <Brush>; if (Bdata != null) { Bdata.SelectedItem = FontColorView; } cdata = _dataCollection["BorderLine Color Gallery"] as GalleryData <StyleColor>; if (cdata != null) { cdata.SelectedItem = BorderLineColorView; } _selectionService = ServiceLocator.Current.GetInstance <SelectionServiceProvider>(); IPagePropertyData page = _selectionService.GetCurrentPage(); if (page == null) { return; } if (CmdTarget == page.EditorCanvas) { return; } CmdTarget = _selectionService.GetCurrentPage().EditorCanvas; SetStyleCmdTarget(_selectionService.GetCurrentPage().EditorCanvas); UpdateCmdTarget(CmdTarget); }
public void Clear() { wantSelectGalleryData = null; scrollState = ScrollState.None; listData.ForEach(temp => { temp.isVisible = false; temp.Update(false, false); }); listData.Clear(); }
public IEnumerator GetArtworksData(GalleryData gdata, string url) { // url = "http://localhost/madrollers/artplacer.json"; WWW textURLWWW = new WWW(url); yield return textURLWWW; //Debug.Log (url+" "+textURLWWW.text.Length+" : "+textURLWWW.text); if (textURLWWW.text.Contains("<html>")) { print("____________________________ vuelve a intentar"); StartCoroutine(GetArtworksData(gdata, url)); } else LoadArtWorkFromGallery(gdata, textURLWWW.text); }
public IEnumerable <GalleryCard> GetGalleryByTag() { IGalleryData galleryDb = new GalleryData(); var galleryCards = galleryDb.GetGalleryCardsByTags(this.Tags); // CHANGE!! foreach (var item in this.Tags) { Console.WriteLine((string)item.TagItem); } if (galleryCards == null) { galleryCards = new List <GalleryCard>(); } return(galleryCards); }
public int insertGalleryData(string Gallery_Id, string Gallery_Name, string Gallery_URL) { try { GalleryData tbl = new GalleryData(); tbl.gallery_id = Gallery_Id; tbl.gallery_name = Gallery_Name; tbl.gallery_url = Gallery_URL; int i = db.Insert(tbl); return(i); } catch (Exception ex) { return(0); } }
public void GalleryCard_Test() { //Given // GalleryCard gal = new GalleryCard(); // int i = gal.GetVotes(); IGalleryData db = new GalleryData(); var gallery = db.getCardById(1); //When // Assert.Equal("Revenge of Koria", gallery.Title); Assert.Equal(3, gallery.UpVotesCount); //Then }
public int GetNumberOfContentWithThisTag() { int count = 0; IGalleryData galleryDb = new GalleryData(); var tags = new List <Tag>() { new Tag() { TagItem = this.TagItem } }; var cards = galleryDb.GetGalleryCardsByTags(tags); foreach (var item in cards) { count++; } return(count); }
public void AddCardToGallery_Test() { //Given IGalleryData galleryDb = new GalleryData(); var galleryCard = new GalleryCard() { Id = 4, Title = "The Return Of The Thing", Descritpion = "A film about the return of the thing." }; GalleryData.Current.Cards.Add(galleryCard); var cards = GalleryData.Current.getAllCards(); //When foreach (var card in cards) { output.WriteLine("ID:{0}", card.Id); } //Then }
public void Select(object dataSource, bool animated = false) { var find = listData.Find(temp => temp.dataSource == dataSource); if (find == null) { Debug.LogWarning("无法找到这个dataSource"); return; } if (find.isSelected) { return; } if (dataChanged == DataChange.None) { if (animated) { var offset = mainIndex - find.normalizedPos; listData.ForEach(temp => { temp.returnNormalizedPos = temp.normalizedPos + offset; }); scrollState = ScrollState.Return; } else { var offset = mainIndex - find.normalizedPos; listData.ForEach(temp => { temp.normalizedPos = temp.normalizedPos + offset; }); } } else { wantSelectGalleryData = find; } }
public ActionResult Create(GalleryData gallery) { try { if (gallery != null && !string.IsNullOrWhiteSpace(gallery.Name)) { gallery = GalleryService.CreateGallery(gallery.Name, User); } else { ModelState.AddModelError("Error", "A gallery name is required"); } } catch (GalleryAlreadyExistsException) { ModelState.AddModelError("Error", "A gallery with the same name already exists"); } catch (Exception ex) { ModelState.AddModelError("Error", "Unable to create gallery. " + ex.Message); } return(PartialView("_CreateGallery", gallery)); }
private void SelectionPropertyEventHandler(string EventArg) { switch (EventArg) { case "Top": { if (_isFirePositionEnabled) { FirePropertyChanged("Top"); } break; } case "Left": { if (_isFirePositionEnabled) { FirePropertyChanged("Left"); } break; } case "ItemWidth": { FirePropertyChanged("Width"); break; } case "ItemHeight": { FirePropertyChanged("Height"); break; } case "RotateAngle": { FirePropertyChanged("RotateAngle"); break; } case "CornerRadius": { FirePropertyChanged("CornerRadius"); break; } case "Opacity": { FirePropertyChanged("Opacity"); break; } case "IsHidden": { FirePropertyChanged("IsHidden"); break; } case "IsFixed": { FirePropertyChanged("IsFixed"); break; } case "vFontBold": { FirePropertyChanged("IsBoldCheck"); break; } case "vFontItalic": { FirePropertyChanged("IsItalicCheck"); break; } case "vTextBulletStyle": { FirePropertyChanged("IsBulletCheck"); break; } case "vFontUnderLine": { FirePropertyChanged("IsUnderlineCheck"); break; } case "vFontStrickeThrough": { FirePropertyChanged("IsStrikeThroughCheck"); break; } case "vFontColor": { FirePropertyChanged("FontColorView"); //var stackTrace = new System.Diagnostics.StackTrace(); //var undo = stackTrace.GetFrames().Where(f => f.GetMethod().Name == "Undo" || f.GetMethod().Name == "Redo"); GalleryData <StyleColor> Bdata = _dataCollection["Font Color Gallery"] as GalleryData <StyleColor>; if (Bdata != null) { Bdata.SelectedItem = FontColorView.ToStyleColor(); } //if (undo.Count() == 0) //{ // SplitMenuItemData spData = _dataCollection["Font Color"] as SplitMenuItemData; // if (spData != null) // { // //spData.CommandParameter = FontColorView; // } //} break; } case "vBorderLineColor": { FirePropertyChanged("BorderLineColorView"); //var stackTrace = new System.Diagnostics.StackTrace(); //var undo = stackTrace.GetFrames().Where(f => f.GetMethod().Name == "Undo" || f.GetMethod().Name == "Redo"); GalleryData <StyleColor> Bdata = _dataCollection["BorderLine Color Gallery"] as GalleryData <StyleColor>; if (Bdata != null) { Bdata.SelectedItem = BorderLineColorView; } //if (undo.Count() == 0) //{ // SplitButtonData sbData = _dataCollection["BorderLineColor"] as SplitButtonData; // if (sbData != null) // { // sbData.CommandParameter = BorderLineColorView; // } //} break; } case "vBackgroundColor": { FirePropertyChanged("BackgroundColorView"); //var stackTrace = new System.Diagnostics.StackTrace(); //var undo = stackTrace.GetFrames().Where(f => f.GetMethod().Name == "Undo" || f.GetMethod().Name == "Redo"); GalleryData <StyleColor> Bdata = _dataCollection["Background Color Gallery"] as GalleryData <StyleColor>; if (Bdata != null) { Bdata.SelectedItem = BackgroundModifyColorView; } //if (undo.Count() == 0) //{ // SplitBackgroundColorButton sbData = _dataCollection["BackColor"] as SplitBackgroundColorButton; // if (sbData != null) // { // sbData.CommandParameter = BackgroundModifyColorView; // } //} break; } case "vTextHorAligen": { FirePropertyChanged("IsTxtAlignLeft"); FirePropertyChanged("IsTxtAlignCenter"); FirePropertyChanged("IsTxtAlignRight"); break; } case "vTextVerAligen": { FirePropertyChanged("IsTxtAlignTop"); FirePropertyChanged("IsTxtAlignMiddle"); FirePropertyChanged("IsTxtAlignBottom"); break; } case "TextRotate": { FirePropertyChanged("TextRotate"); break; } case "vBorderlineStyle": { UpdateBorderLineStyleSelectedItem(); UpdateBorderLineStyleButtonParameter(); break; } case "vBorderLinethinck": { UpdateBorderLineWidthSelectedItem(); UpdateBorderLineWidthButtonParameter(); break; } case "NailStream": case "Tooltip": case "IsShowSelect": case "IsBtnAlignLeft": case "IsDisabled": case "RadioGroup": { UpdateWidgetProperty(EventArg); break; } default: StyChangeHandler(EventArg); return; } }
public GalleryData GetFiltered() { GalleryData galleryData = new GalleryData(); string filters = "Filter:"; for (int a = 0; a < Data.Instance.filtersManager.activeFilter.Count; a++) { filters += " " + Data.Instance.filtersManager.GetActiveFilter(a); if(a<Data.Instance.filtersManager.activeFilter.Count) filters +=","; } galleryData.title = filters; galleryData.artWorksData = new List<GalleryData.ArtData>(); foreach (Favourite favorite in filter) { GalleryData.ArtData artData = GetArtData(favorite.galleryId, favorite.artId); galleryData.artWorksData.Add( artData ); } return galleryData; }
public void LoadArtWorkFromGallery(GalleryData gdata, string json_data) { var N = JSON.Parse(json_data); for (int i = 0; i < N["artworks"].Count; i++) { GalleryData.ArtData adata = new GalleryData.ArtData(); adata.title = N["artworks"][i]["title"]; adata.url = N["artworks"][i]["url"]; if (gdata != null) { adata.gallery = gdata.title; adata.galleryId = gdata.id; adata.artId = int.Parse(N["artworks"][i]["id"]); adata.autor = N["artworks"][i]["author"]; adata.thumbnail = N["artworks"][i]["thumbnail"]; Data.Instance.filtersManager.CheckToAddFilter("autor", adata.autor); float h = float.Parse(N["artworks"][i]["height"]); adata.filters = new GalleryData.ArtDataFilters(); adata.filters.color = new List<int>(); adata.filters.size = new List<int>(); adata.filters.shape = new List<int>(); adata.filters.orientation = new List<int>(); adata.filters.technique = new List<int>(); for (int b = 0; b < N["artworks"][i]["filter"]["color"].Count; b++) { // Data.Instance.filtersManager.CheckToAddFilter("color", N["artworks"][i]["filter"]["color"][b]); adata.filters.color.Add(int.Parse(N["artworks"][i]["filter"]["color"][b])); } for (int b = 0; b < N["artworks"][i]["filter"]["size"].Count; b++) { // Data.Instance.filtersManager.CheckToAddFilter("size", N["artworks"][i]["filter"]["size"][b]); adata.filters.size.Add(int.Parse(N["artworks"][i]["filter"]["size"][b])); } for (int b = 0; b < N["artworks"][i]["filter"]["shape"].Count; b++) { // Data.Instance.filtersManager.CheckToAddFilter("shape", N["artworks"][i]["filter"]["shape"][b]); adata.filters.shape.Add(int.Parse(N["artworks"][i]["filter"]["shape"][b])); //Debug.Log ("Shape"+i+": "+int.Parse(N["artworks"][i]["filter"]["shape"][b])); } for (int b = 0; b < N["artworks"][i]["filter"]["orientation"].Count; b++) { // Data.Instance.filtersManager.CheckToAddFilter("orientation", N["artworks"][i]["filter"]["orientation"][b]); adata.filters.orientation.Add(int.Parse(N["artworks"][i]["filter"]["orientation"][b])); //Debug.Log ("Orientation"+i+": "+int.Parse(N["artworks"][i]["filter"]["orientation"][b])); } for (int b = 0; b < N["artworks"][i]["filter"]["technique"].Count; b++) { // Data.Instance.filtersManager.CheckToAddFilter("technique", N["artworks"][i]["filter"]["technique"][b]); adata.filters.technique.Add(int.Parse(N["artworks"][i]["filter"]["technique"][b])); } h = CustomMath.inches2cm(h); //float h = float.Parse(N ["artworks"][i]["height"]); Vector2 size = new Vector2(-1, h); adata.size = size; adata.isLocal = false; gdata.artWorksData.Add(adata); } } }
public void LoadGalleryData(string json_data) { var N = JSON.Parse(json_data); galleries = new GalleryData[N ["galleries"].Count]; string jsonArtworks = Data.Instance.json_artworks_jsonUrl; for (int i=0; i<galleries.Length; i++) { galleries [i] = new GalleryData(); galleries [i].title = N ["galleries"] [i] ["title"]; string phoneNum = N["galleries"][i]["phone"]; if (phoneNum!= null) galleries[i].phone = Regex.Replace(phoneNum, "[^0-9]", ""); galleries[i].email = N["galleries"][i]["email"]; string url = N["galleries"][i]["website"]; if (url != null) { if( url.Substring(0, 4) == "http") galleries[i].web = url; else galleries[i].web = "http://" + url; } int id = int.Parse(N ["galleries"] [i] ["id"]); galleries [i].id = id; galleries[i].thumbnail = (N["galleries"][i]["thumbnail"]); galleries [i].artWorksData = new List<GalleryData.ArtData>(); } //carga las obras: for (int i = 0; i < galleries.Length; i++) { StartCoroutine(GetArtworksData(galleries[i], jsonArtworks + galleries[i].id)); } }
public static void AssertGallery(GalleryData gallery1, GalleryData gallery2) { AssertTrackedResource(gallery1, gallery2); Assert.AreEqual(gallery1.Description, gallery2.Description); Assert.AreEqual(gallery1.Identifier?.UniqueName, gallery2.Identifier?.UniqueName); }
public GalleryData GetFavourites() { GalleryData galleryData = new GalleryData(); galleryData.title = "Favorites"; galleryData.artWorksData = new List<GalleryData.ArtData>(); foreach (Favourite favorite in favorites) { GalleryData.ArtData artData = GetArtData(favorite.galleryId, favorite.artId); galleryData.artWorksData.Add(artData); } return galleryData; }