// Use this for initialization void Start () { pictureLikedislike = GameObject.Find("AC3").GetComponent<Pictures>(); //prints the saved playerpref from last time print(PlayerPrefs.GetInt("Nature Count")); //sets the above playerpref to the new value on the picture pictureLikedislike.nature = PlayerPrefs.GetInt("Nature Count"); }
// changed for draw tets protected Enemy(string name, int hitPoints, int attackPoints, int defensePoints, Pictures picture, int experience) : base(name) { this.HitPoints = hitPoints; this.DefensePoints = defensePoints; this.AttackPoints = attackPoints; this.Picture = picture; this.PicBox = new PictureBox(); this.IsAlive = true; this.CurrentHitPoints = this.HitPoints; this.Experience = experience; }
protected Item(string name, int price, Pictures picture, ItemType itemType, int defencePoints = 0, int attackPoints = 0, int hitPoints = 0, int str = 0, int dex = 0, int vit = 0, int intl = 0, int level = 0, string description = null) : base(name) { this.Strength = str; this.Dexterity = dex; this.Vitality = vit; this.Intelligence = intl; this.LevelRequirement = level; this.AttackPoints = attackPoints; this.DefencePoints = defencePoints; this.HitPoints = hitPoints; this.Price = price; this.Description = description; this.Picture = picture; this.ItemType = itemType; }
public IActionResult SavePicture(string imageName, IFormFile picture) { //user information // var LoggedInUser = dbContext.Users.Where(u => string.Equals(u.Email, User.Identity.Name)).FirstOrDefault(); string fileName = picture.FileName; Pictures newPicture = new Pictures(); // newPicture.OwnerId = LoggedInUser?.Id; newPicture.Category = "ProfilePicture"; newPicture.ImageData = new byte[picture.Length]; picture.OpenReadStream().Read(newPicture.ImageData); dbContext.Pictures.Add(newPicture); dbContext.SaveChanges(); return(RedirectToAction("Dashboard", "Home")); }
public EmptyResult Remove(string UserName, int PictureId, string Comment) { Users user = db.Users.Where(m => m.UserName == UserName).SingleOrDefault(); Pictures pic = db.Pictures.Where(m => m.Id == PictureId).SingleOrDefault(); Comments comment = db.Comments.Where(m => m.Comment == Comment).SingleOrDefault(); user.CommentsList.Remove(comment); pic.CommentsList.Remove(comment); db.Users.AddOrUpdate(user); db.Pictures.AddOrUpdate(pic); db.Comments.Remove(comment); db.SaveChanges(); return(new EmptyResult()); }
public IEnumerable <PictUser> GetSearchPictUser() { masWords = Words.Split(' '); Func <User, bool> SearchUsFunc = SearchUs; IEnumerable <User> us = Users.Where(SearchUsFunc); IEnumerable <Picture> pict = Pictures.Where(p => { foreach (string word in masWords) { if (word == p.Title || word == p.Direction) { return(true); } } return(false); }); IEnumerable <PictUser> pu1 = pict.Join(Users, p => p.UserId, c => c.Id, (p, c) => new PictUser { Id = p.Id, Title = p.Title, Direction = p.Direction, Price = p.Price, Data = p.Data, Name = c.Name, Surname = c.Surname, IdUser = c.Id }); IEnumerable <PictUser> pu2 = Pictures.Join(us, p => p.UserId, c => c.Id, (p, c) => new PictUser { Id = p.Id, Title = p.Title, Direction = p.Direction, Price = p.Price, Data = p.Data, Name = c.Name, Surname = c.Surname, IdUser = c.Id }); return(pu1.Union(pu2, new ComparePictUser())); }
public GameOverForm(bool victory) { InitializeComponent(); if (victory) { Text = "Victory!"; pic.Image = Pictures.GetModImage(Path.Combine("Pictures", "Game", "Finale", "victory")); Music.Play(MusicMode.GameOver, MusicMood.Upbeat); } else { Text = "Defeat!"; pic.Image = Pictures.GetModImage(Path.Combine("Pictures", "Game", "Finale", "defeat")); Music.Play(MusicMode.GameOver, MusicMood.Sad); } }
public void RemovePicture(Guid id) { if (Pictures == null || Pictures.Any()) { throw SheaftException.NotFound("Cet utilisateur ne contient aucune images."); } var existingPicture = Pictures.FirstOrDefault(p => p.Id == id); if (existingPicture == null) { throw SheaftException.NotFound("L'image est introuvable."); } Pictures.Remove(existingPicture); PicturesCount = Pictures?.Count ?? 0; }
public void AddPicture(Model.Picture picture) { XML.MediaXML mediaXML = new XML.MediaXML(); mediaXML.Load("pictures.xml"); if (!mediaXML.HasMedia(picture.Path)) { mediaXML.Add(picture.Path, picture.Stream); mediaXML.WriteInFile("pictures.xml"); if (picture.Name.Contains(this._SearchInput)) { Pictures.Add(picture); } PicturesTmp.Add(picture); } }
public static Pictures GetResizedPictures(string picture, IImageProfileManager imageProfileManager, ILogger logger = null) { var result = default(Pictures); if (picture != null) { result = new Pictures { Small = GetResizedPicture(picture, PictureSize.Small, imageProfileManager, logger), Medium = GetResizedPicture(picture, PictureSize.Medium, imageProfileManager, logger), Full = picture }; } return(result); }
public void DeletePictures(ICollection <int> aPictureIdCollection) { if (Pictures != null && Pictures.Count > 0) { if (aPictureIdCollection != null && aPictureIdCollection.Count > 0) { foreach (var item in aPictureIdCollection) { var removeItem = Pictures.FirstOrDefault(p => p.UId == item); if (removeItem != null) { Pictures.Remove(removeItem); } } } } }
/// <summary> /// Reads <see cref="TagType.ID3v2"/> tags from a <paramref name="Channel"/>. /// </summary> public bool ReadID3v2(int Channel) { var ptr = Bass.ChannelGetTags(Channel, TagType.ID3v2); if (ptr == IntPtr.Zero) return false; var id3V2 = new ID3v2Tag(ptr); foreach (var frame in id3V2.TextFrames) if (!SetTagUsingLookupTable(frame.Key, frame.Value, LookupTables.Id3v2)) Other.Add(frame.Key, frame.Value); Pictures.AddRange(id3V2.PictureFrames); return true; }
public ActionResult Post(Comments Comment, Pictures Picture) { var currentUserId = UserId(User.Identity.Name); using (ProjektEntities context = new ProjektEntities()) { Comments Comment2 = new Comments { text = Comment.text, id_user = currentUserId, id_picture = Picture.id }; context.Comments.Add(Comment2); context.SaveChanges(); } return(PartialView("Comment")); }
public ActionResult Upload(HttpPostedFileBase file, Pictures Picture) { var currentUserId = UserId(User.Identity.Name); if (file != null && Picture.title != null) { string pic = System.IO.Path.GetFileName(file.FileName); string path = System.IO.Path.Combine( Server.MapPath("~/UserPictureImages/"), pic); string pathDB = pic; // file is uploaded file.SaveAs(path); using (ProjektEntities context = new ProjektEntities()) { Pictures Picture2 = new Pictures { AlbumId = Picture.AlbumId, title = Picture.title, description = Picture.description, img = pic, id_user = currentUserId, }; context.Pictures.Add(Picture2); PicturesAlbums pical = new PicturesAlbums { album_id = Picture2.AlbumId, pictures_id = Picture2.id }; context.PicturesAlbums.Add(pical); context.SaveChanges(); } return(RedirectToAction("Index", "Home")); } else { Pictures PictureModel = new Pictures(); using (ProjektEntities context = new ProjektEntities()) { PictureModel.AlbumCollection = context.Albums.ToList <Albums>(); } return(View("Upload", PictureModel)); } }
public string FindPicture(Transfer transfer) { if (Pictures.Where(p => p.HashCode == transfer.DataToBase64.GetHashCode()).Count() == 0) { return(null); } foreach (var p in Pictures.Where(p => p.HashCode == transfer.DataToBase64.GetHashCode())) { Entry(p).Reference("PictureInfoDetails").Load(); if (Convert.ToBase64String(p.PictureInfoDetails.BinaryFile) == transfer.DataToBase64) { Entry(p).Reference("Type").Load(); return(p.Type.TypeName); } } return(null); }
static SupportedShapeTypes() { Shapes = GetList(MsoShapeType.msoAutoShape, MsoShapeType.msoGroup, MsoShapeType.msoFreeform, MsoShapeType.msoTextBox).AsReadOnly(); Charts = GetList(MsoShapeType.msoChart).AsReadOnly(); Tables = GetList(MsoShapeType.msoTable).AsReadOnly(); Pictures = GetList(MsoShapeType.msoPicture).AsReadOnly(); var _all = new Dictionary <string, List <MsoShapeType> >(); _all.Add("Shapes", Shapes.ToList()); _all.Add("Charts", Charts.ToList()); _all.Add("Tables", Tables.ToList()); _all.Add("Pictures", Pictures.ToList()); Others = GetRemainingShapeTypes(_all.Values.SelectMany(i => i)).AsReadOnly(); _all.Add("Others", Others.ToList()); All = new ReadOnlyDictionary <string, List <MsoShapeType> >(_all); }
public bool UpdateOrAddPic(string name, string type, byte[] data) { Pictures p = _udb.Avatars.SingleOrDefault(pp => pp.PicUserName == name); if (p == null) { AddPic(name, type, data); return(true); } p.PicType = type; using (MemoryStream ms = new MemoryStream(data)) { p.PicName = SaveAvatar(name, ms, Path.Combine(_env.WebRootPath, "Images/Avatar/")); } p.PicDate = DateTime.Now; _udb.SaveChanges(); return(true); }
public SamplePicturesViewModel() { var picture = new BitmapImage(new Uri("ms-appx:///Assets/Logo.png")); var thumbnail = new BitmapImage(new Uri("ms-appx:///Assets/SmallLogo.png")); Pictures.Add(new PictureModel { Caption = "Picture One", Picture = picture, Thumbnail = thumbnail }); //Pictures.Add(new PictureModel //{ // Caption = "Picture Two", // Picture = picture, // Thumbnail = thumbnail //}); }
public Model.Picture Prev() { if (Pictures.Count() == 0) { return(null); } if (_CurrentIndex > 0) { --_CurrentIndex; } else { _CurrentIndex = Pictures.Count() - 1; } return(Pictures[_CurrentIndex]); }
public void AddOrUpdatePictures(ICollection <Picture> aPictureCollection) { if (aPictureCollection != null && aPictureCollection.Count > 0) { foreach (var item in aPictureCollection) { var existItem = Pictures.FirstOrDefault(p => p.UId == item.UId); if (existItem == null) { Pictures.Add(item); } else { existItem.Update(item.PictureId, item.UseType); } } } }
public ActionResult DeleteFile(int?entityId, string fileUrl) { //var filePath = Server.MapPath("~" + fileUrl); //if (System.IO.File.Exists(filePath)) // System.IO.File.Delete(filePath); Pictures picture = db.Pictures.Where(p => p.url == fileUrl).SingleOrDefault(); //Pictures picture = db.Pictures.Find(Id); if (picture != null) { return(this.DeleteFileAndRecord(picture.PictureId)); } else { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.NotFound)); } }
async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Pictures.Clear(); var service = DependencyService.Get <IRateApplication>(); var directory = service.GetStorageDirectory(); var picturesDirectory = System.IO.Path.Combine(directory, "Pictures"); var pictures = System.IO.Directory.GetFiles(picturesDirectory); foreach (var item in pictures) { var fi = new System.IO.FileInfo(item); Pictures.Add(new Media() { Path = item, Title = fi.Name, Type = MediaType.Picture }); } var items = await Datastores.Pictures.GetItemsAsync(true); foreach (var item in items) { Pictures.Add(item); } OnPropertyChanged("NoItems"); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private void BindChoices() { foreach (var portrait in Pictures.ListLeaderPortraits()) { ddlLeaderPortrait.Items.Add(portrait); } foreach (var icon in Pictures.ListPopulationIcons()) { ddlRacePopulationIcon.Items.Add(icon); } foreach (var surface in Mod.Current.StellarObjectTemplates.OfType <Planet>().Select(p => p.Surface).Distinct()) { ddlRaceNativeSurface.Items.Add(surface); } foreach (var atmosphere in Mod.Current.StellarObjectTemplates.OfType <Planet>().Select(p => p.Atmosphere).Distinct()) { ddlRaceNativeAtmosphere.Items.Add(atmosphere); } foreach (var insignia in Pictures.ListInsignia()) { ddlInsignia.Items.Add(insignia); } foreach (var shipset in Pictures.ListShipsets()) { ddlShipset.Items.Add(shipset); } foreach (var ai in Mod.Current.EmpireAIs) { ddlAI.Items.Add(ai); } foreach (var h in Mod.Current.HappinessModels) { ddlRaceHappiness.Items.Add(h); } foreach (var c in Mod.Current.Cultures) { ddlCulture.Items.Add(c); } foreach (var n in Mod.Current.DesignNamesFiles) { ddlDesignNames.Items.Add(n); } raceTraitPicker.Traits = Mod.Current.Traits; }
private void OnDeletePicturesCommand(List <Picture> pictures) { var pictureContext = pictures.Count > 1 ? "these pictures" : "this picture"; var pictureNames = string.Join("\n", pictures.Select(pic => pic.FullFileName).ToList()); if (_modalDialog.ShowQuestion( $"Are you sure you want to delete {pictureContext}:\n\n{pictureNames}\n", $"Delete {pictureContext}?")) { pictures.ForEach(pic => { if (_pictureRepository.TryDelete(pic.FullFileName).Success.Value) { Pictures.Remove(pic); } ; }); } }
// функция пересылает картинку с сервера всем клиентам private void Send_picture() { foreach (var client in _clientList) { try { Monitor.Enter(panel1); Monitor.Enter(pic); _client_pictures = NetworkingFactory.UdpWriter <Pictures>(client, Ports.PictPort); var msg = new Pictures(pic); _client_pictures.Write(msg); } finally { Monitor.Exit(panel1); Monitor.Exit(pic); } } }
public static OutgoingMinimalPicture Parse(Pictures x) { if (x == null) { return(null); } if (x.IsDeleted == true) { return(null); } return(new OutgoingMinimalPicture { Id = x.Id, Resolutions = x.PictureResolutions?.Select(y => OutgoingPictureResolution.Parse(y))?.RemoveNulls()?.ToList(), DateUploaded = x.DateUploaded }); }
/// <summary> /// Removes the current picture locally and from the server /// </summary> public void RemovePicture() { if (Pictures.Count <= 0 || ImageNames.Count <= 0) { return; } var file = GetCurrentPictureName(); Pictures.Remove(GetCurrentPicture()); ImageNames.RemoveAt(_currentPictureIndex); _currentPictureIndex = 0; new InformationProtocol(Protocol.Data) .SetHandler("finderRemovePicture", InformationProtocol.HandlerType.Update) .AddParameter("uid", PlayerPrefs.GetString("uid")) .AddParameter("file", file) .Send(); }
public void RemovePicture(Model.Picture picture) { XML.MediaXML mediaXML = new XML.MediaXML(); mediaXML.Load("pictures.xml"); mediaXML.Remove(picture.Path); mediaXML.WriteInFile("pictures.xml"); String namePathFile = picture.Path; Pictures.Remove(picture); var medias = from media in PicturesTmp where media.Path.Contains(namePathFile) select media; var selected = picture; foreach (var media in medias) { selected = media; } PicturesTmp.Remove(selected); }
private void ShipListForm_Load(object sender, EventArgs e) { if (Galaxy.Current == null) { return; } // show ship/unit/fleet counts sobjs = Galaxy.Current.FindSpaceObjects <IMobileSpaceObject>().Where(o => !(o is Planet) && (!(o is IUnit && ((IUnit)o).Container == null))); var ours = sobjs.Where(o => o.Owner == Empire.Current); var ourShips = ours.OfType <SpaceVehicle>(); txtShips.Text = ourShips.Count().ToString(); txtShipsOutsideFleets.Text = ourShips.Where(s => s.Container == null).Count().ToString(); var ourFleets = ours.OfType <Fleet>(); txtFleets.Text = ourFleets.Count().ToString(); txtFleetsOutsideFleets.Text = ourFleets.Where(f => f.Container == null).Count().ToString(); var alienShips = sobjs.OfType <SpaceVehicle>(); txtAlienShips.Text = alienShips.Count().ToString(); txtAllyShips.Text = alienShips.Where(s => s.Owner.IsAllyOf(Empire.Current, null)).Count().ToString(); txtEnemyShips.Text = alienShips.Where(s => s.Owner.IsEnemyOf(Empire.Current, null)).Count().ToString(); txtNonAlignedShips.Text = alienShips.Where(s => s.Owner.IsNeutralTo(Empire.Current, null)).Count().ToString(); resMaintenanaceMin.Amount = ourShips.Sum(s => s.MaintenanceCost[Resource.Minerals]); resMaintenanceOrg.Amount = ourShips.Sum(s => s.MaintenanceCost[Resource.Organics]); resMaintenanceRad.Amount = ourShips.Sum(s => s.MaintenanceCost[Resource.Radioactives]); // show ship/fleet/unit data grid.Data = sobjs.Where(o => o.Container == null).ToArray(); grid.CreateDefaultGridConfig = ClientSettings.CreateDefaultShipListConfig; grid.LoadCurrentGridConfig = () => ClientSettings.Instance.CurrentShipListConfig; grid.LoadGridConfigs = () => ClientSettings.Instance.ShipListConfigs; grid.ResetGridConfigs = () => new List <GridConfig> { ClientSettings.CreateDefaultShipListConfig(), ClientSettings.CreateDefaultAlienShipListConfig() }; grid.Initialize(); // show galaxy view background // TODO - galaxy view background image can depend on galaxy template? galaxyView.BackgroundImage = Pictures.GetModImage(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Pictures", "UI", "Map", "quadrant")); }
public void FindPicture() { WebClient webClient = new WebClient(); string result = webClient.DownloadString("https://www.imdb.com" + this.MovieId); int startsWith = result.IndexOf("titleImageStrip"); //herbir castın başında bu item olduğundan başlangıç noktası bu olarak alınır if (startsWith == -1) { return; } result = result.Substring(startsWith); int endsWith = result.IndexOf("</div>"); result = result.Substring(0, endsWith); string name, url; while (result.IndexOf("alt") != -1) { startsWith = result.IndexOf("alt"); result = result.Substring(startsWith); startsWith = result.IndexOf('"'); result = result.Substring(startsWith + 1); endsWith = result.IndexOf('"'); name = result.Substring(0, endsWith); startsWith = result.IndexOf("loadlate="); result = result.Substring(startsWith); startsWith = result.IndexOf('"'); result = result.Substring(startsWith + 1); endsWith = result.IndexOf('"'); url = result.Substring(0, endsWith); Picture Picture = new Picture(name, url); Pictures.Add(Picture); } }
public override ImageSource Render(StellarObject o, Size size, bool portrait) { var img = portrait ? Pictures.GetCachedImageSource(o.PortraitPaths) : Pictures.GetCachedImageSource(o.IconPaths); if (img != null) { return(img.Resize(size)); } else { // generic gray rectangle if image can't be found var dv = new DrawingVisual(); var dc = dv.RenderOpen(); dc.DrawRectangle(Brushes.Gray, new Pen(Brushes.Gray, 1), new Rect(size)); dc.Close(); var bmp = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Default); bmp.Render(dv); return(bmp); } }
private void AddTabPictures() { //add pictures section Log.Info("add pictures section"); if (splashScreen != null) { splashScreen.SetInformation("Adding pictures section..."); } SectionSettings picture = new Pictures(); AddSection(new ConfigPage(null, picture, false)); Log.Info(" add picture shares section"); AddSection(new ConfigPage(picture, new PictureShares(), false)); Log.Info(" add picture thumbs section"); AddSection(new ConfigPage(picture, new PictureThumbs(), true)); Log.Info(" add picture extensions section"); AddSection(new ConfigPage(picture, new PictureExtensions(), true)); }
public static bool GetPicturesFromExcelFile(string filepath, out Pictures[] pictures, out string error) { error = ""; pictures = null; try { if (File.Exists(filepath) == false) { error = "文件不存在"; pictures = null; return false; } Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(); workbook.Open(filepath); pictures = new Pictures[workbook.Worksheets.Count]; for (int i = 0; i < workbook.Worksheets.Count; i++) { //pictures.Add(); pictures[i] = workbook.Worksheets[i].Pictures; } return true; } catch (System.Exception e) { error = e.Message; return false; } }
protected Armor(string name, int price, Pictures picture, ItemType bootsItemType, int defencePoints = 0, int attackPoints = 0, int hitPoints = 0, int str = 0, int dex = 0, int vit = 0, int intl = 0, int levelRequirement = 0, string description = null) : base(name, price, picture, bootsItemType, defencePoints, attackPoints, hitPoints, str, dex, vit, intl, levelRequirement, description) { }
public Scroll(string name, int price, Pictures picture, int defencePoints = 0, int attackPoints = 0, int hitPoints = 0, int str = 0, int dex = 0, int vit = 0, int intl = 0, int levelRequirement = 0, string description = null) : base(name, price, picture, Scroll.ScrollItemType, defencePoints, attackPoints, hitPoints, str, dex, vit, intl, levelRequirement, description) { this.IsConsumable = true; }
// Use this for initialization void Start () { pictureLikedislike = GameObject.Find("AC3").GetComponent<Pictures>(); }
public Drake(string name, int hitPoints, int attackPoints, int defensePoints, Pictures picture) : base(name, hitPoints, defensePoints, attackPoints, picture, DrakeExperience) { }
public static bool GetPicturesFromExcelFile(string filepath, out Pictures[] pictures, out string error) { error = ""; pictures = null; try { if (!File.Exists(filepath)) { error = "文件不存在"; pictures = null; return false; } Workbook workbook = new Workbook(); workbook.Open(filepath); pictures = new Pictures[workbook.get_Worksheets().Count]; for (int i = 0; i < workbook.get_Worksheets().Count; i++) { pictures[i] = workbook.get_Worksheets().get_Item(i).get_Pictures(); } return true; } catch (Exception exception) { error = exception.Message; return false; } }
public Gloves(string name, int price, Pictures picture, int defencePoints = 0, int attackPoints = 0, int hitPoints = 0, int str = 0, int dex = 0, int vit = 0, int intl = 0, int levelRequirement = 0, string description = null) : base(name, price, picture, Gloves.GloesItemType, defencePoints, attackPoints, hitPoints, str, dex, vit, intl, levelRequirement, description) { }
private static bool smethod_0(Pictures pictures_0, DataTable dataTable_0, out DataTable dataTable_1, out string string_0) { string_0 = ""; dataTable_1 = dataTable_0; DataRow[] rowArray = dataTable_1.Select(); foreach (Picture picture in pictures_0) { try { Console.WriteLine(picture.GetType().ToString()); MemoryStream stream = new MemoryStream(); stream.Write(picture.get_Data(), 0, picture.get_Data().Length); Image image = Image.FromStream(stream); rowArray[picture.get_UpperLeftRow()][picture.get_UpperLeftColumn()] = image; continue; } catch (Exception exception) { string_0 = string_0 + " InsertPicturesIntoDataTable: " + exception.Message; continue; } } return true; }
public Golem(string name, int hitPoints, int attackPoints, int defensePoints, Pictures picture) : base(name, hitPoints, defensePoints, attackPoints, picture, GolemExperience) { }
public Skeleton(string name, int hitPoints, int attackPoints, int defensePoints, Pictures picture) : base(name, hitPoints, defensePoints, attackPoints, picture, SkeletonExperience) { }
protected Boss(string name, int hitPoints, int attackPoints, int defensePoints, Pictures picture, int experience) : base(name, hitPoints, defensePoints, attackPoints, picture, experience) { }