public ImageModel() { ImageId = Guid.NewGuid(); var FileName = ImageId.ToString(); Image = new ImageInfo(FileName); }
/// <summary> /// Initializes a new instance of the <see cref="ServerArgument"/> class /// with the specified values. /// </summary> /// <param name="flavorId">The ID of the flavor to use when creating new servers. See <see cref="Flavor.Id"/>.</param> /// <param name="imageId">The ID of the image to use when creating new servers. See <see cref="SimpleServerImage.Id"/>.</param> /// <param name="name">The prefix to use when assigning names to new servers.</param> /// <param name="diskConfiguration">The disk configuration to use for new servers.</param> /// <param name="networks">A collection of <see cref="ServerNetworkArgument"/> objects describing the networks to initially connect newly created servers to.</param> /// <param name="personality">A collection of <see cref="Personality"/> objects describing the personality for new server instances.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="flavorId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="imageId"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException"> /// If <paramref name="networks"/> contains any <see langword="null"/> values. /// <para>-or-</para> /// <para>If <paramref name="personality"/> contains any <see langword="null"/> values.</para> /// </exception> public ServerArgument(FlavorId flavorId, ImageId imageId, string name, DiskConfiguration diskConfiguration, IEnumerable<ServerNetworkArgument> networks, IEnumerable<Personality> personality) { if (flavorId == null) throw new ArgumentNullException("flavorId"); if (imageId == null) throw new ArgumentNullException("imageId"); _flavorId = flavorId; _imageId = imageId; _name = name; _diskConfiguration = diskConfiguration; if (networks != null) { _networks = networks.ToArray(); if (_networks.Contains(null)) throw new ArgumentException("networks cannot contain any null values", "networks"); } if (personality != null) { _personality = personality.ToArray(); if (_personality.Contains(null)) throw new ArgumentException("personality cannot contain any null values", "personality"); } }
/// <summary> /// Initializes a new instance of the <see cref="ServerArgument"/> class /// with the specified values. /// </summary> /// <param name="flavorId">The ID of the flavor to use when creating new servers. See <see cref="Flavor.Id"/>.</param> /// <param name="imageId">The ID of the image to use when creating new servers. See <see cref="SimpleServerImage.Id"/>.</param> /// <param name="name">The prefix to use when assigning names to new servers.</param> /// <param name="diskConfiguration">The disk configuration to use for new servers.</param> /// <param name="networks">A collection of <see cref="ServerNetworkArgument"/> objects describing the networks to initially connect newly created servers to.</param> /// <param name="personality">A collection of <see cref="Personality"/> objects describing the personality for new server instances.</param> /// <exception cref="ArgumentNullException"> /// If <paramref name="flavorId"/> is <see langword="null"/>. /// <para>-or-</para> /// <para>If <paramref name="imageId"/> is <see langword="null"/>.</para> /// </exception> /// <exception cref="ArgumentException"> /// If <paramref name="networks"/> contains any <see langword="null"/> values. /// <para>-or-</para> /// <para>If <paramref name="personality"/> contains any <see langword="null"/> values.</para> /// </exception> public ServerArgument(FlavorId flavorId, ImageId imageId, string name, DiskConfiguration diskConfiguration, IEnumerable <ServerNetworkArgument> networks, IEnumerable <Personality> personality) { if (flavorId == null) { throw new ArgumentNullException("flavorId"); } if (imageId == null) { throw new ArgumentNullException("imageId"); } _flavorId = flavorId; _imageId = imageId; _name = name; _diskConfiguration = diskConfiguration; if (networks != null) { _networks = networks.ToArray(); if (_networks.Contains(null)) { throw new ArgumentException("networks cannot contain any null values", "networks"); } } if (personality != null) { _personality = personality.ToArray(); if (_personality.Contains(null)) { throw new ArgumentException("personality cannot contain any null values", "personality"); } } }
public override int GetHashCode() { int hash = 1; if (PackedItemNameId != 0) { hash ^= PackedItemNameId.GetHashCode(); } if (U2 != 0) { hash ^= U2.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (ItemSetId != 0) { hash ^= ItemSetId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public void HasReceivedPlayListWith(ImageId imageId) { ProbeFor(5000, 500, () => { var request = new RestRequest { Resource = "playlists.xml", RootElement = "playlists", XmlNamespace = "", RequestFormat = DataFormat.Xml, Method = Method.GET }; var response = m_Client.Execute(request); if (response.StatusCode != HttpStatusCode.OK) { throw new ApplicationException(string.Format("Unable to get playlists")); } var deserializer = new XmlDeserializer { Namespace = "", RootElement = "" }; var playLists = deserializer.Deserialize <RestArchive.PlayLists>(response); Assert.That(GetImageIdsOf(playLists), Contains.Item(imageId)); }); }
private ImageId ExportImage(UnityEngine.Texture texture) { ImageId id = GetImageId(_root, texture); if (id != null) { return(id); } var image = new Image(); if (ExportNames) { image.Name = texture.name; } _images.Add(texture as Texture2D); image.Uri = Uri.EscapeUriString(texture.name + ".png"); id = new ImageId { Id = _root.Images.Count, Root = _root }; _root.Images.Add(image); return(id); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Trigger != global::RedNimbus.Messages.LambdaMessage.Types.TriggerType.Get) { hash ^= Trigger.GetHashCode(); } if (Runtime != global::RedNimbus.Messages.LambdaMessage.Types.RuntimeType.Csharp) { hash ^= Runtime.GetHashCode(); } if (OwnerId.Length != 0) { hash ^= OwnerId.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (Guid.Length != 0) { hash ^= Guid.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public Uri GetImage(ImageId id) { var fileNameAttributes = typeof(ImageId).GetField(id.ToString()).GetCustomAttributes(typeof(FileTitleAttribute), false); var fileTitle = fileNameAttributes.Length > 0 ? ((FileTitleAttribute)fileNameAttributes[0]).FileTitle : id.ToString(); return(new Uri(string.Format("Images/{0}.png", fileTitle), UriKind.Relative)); }
public void HasReceivedPlayListWith(ImageId imageId) { ProbeFor(5000, 500, () => { var request = new RestRequest { Resource = "playlists.xml", RootElement = "playlists", XmlNamespace = "", RequestFormat = DataFormat.Xml, Method = Method.GET }; var response = m_Client.Execute(request); if (response.StatusCode != HttpStatusCode.OK) { throw new ApplicationException(string.Format("Unable to get playlists")); } var deserializer = new XmlDeserializer {Namespace = "", RootElement = ""}; var playLists = deserializer.Deserialize<RestArchive.PlayLists>(response); Assert.That(GetImageIdsOf(playLists), Contains.Item(imageId)); }); }
private ImageId ExportImage(UnityEngine.Texture texture, TextureMapType texturMapType) { ImageId id = GetImageId(_root, texture); if (id != null) { return(id); } var image = new Image(); if (ExportNames) { image.Name = texture.name; } _imageInfos.Add(new ImageInfo { texture = texture as Texture2D, textureMapType = texturMapType }); var path = _retrieveTexturePathDelegate(texture); var newPath = Path.ChangeExtension(path, ".png"); image.Uri = Uri.EscapeUriString(newPath); id = new ImageId { Id = _root.Images.Count, Root = _root }; _root.Images.Add(image); return(id); }
public void HasShown(ImageId imageId) { SyncAndProbe(() => Assert.That( SelectedPlayList().Items.Select(pli => pli.ImageId).ToArray(), Contains.Item(imageId)), 5000, 500); }
public override void HandleSubImageMouseover(ArcenUI_Image.SubImage SubImage) { int index = this.SubImages.IndexOf(SubImage); if (index < 0) { return; } ImageId id = (ImageId)index; string tooltip = SubImage.Tooltip; switch (id) { case ImageId.Attack: case ImageId.Defense: tooltip = tooltip.Replace("{0}", ExternalConstants.Instance.Balance_DamageMultiplierWhenCounteringDefense.ReadableString); break; } string key = "EntityTooltipPanel_" + id; if (!Language.Current.Contains(key)) { return; } Window_AtMouseTooltipPanel.bPanel.Instance.SetText(Language.Current.GetValue(key) + tooltip); }
public void SetSprite(ImageId imageId, string bundleName, string path, string tooltip) { SubImages[(int)imageId].WrapperedImage.SetBundleAndPathInBundle(bundleName, path); SubImages[(int)imageId].Tooltip = tooltip; LastImageIDWritten = imageId; LastWrittenWasImageInsteadOfText = true; }
public void SetSprite(ImageId imageId, Sprite sprite, string tooltip) { SubImages[(int)imageId].WrapperedImage.UpdateWith(sprite, true); SubImages[(int)imageId].Tooltip = tooltip; LastImageIDWritten = imageId; LastWrittenWasImageInsteadOfText = true; }
public override int GetHashCode() { int hash = 1; if (ItemId != 0L) { hash ^= ItemId.GetHashCode(); } if (U2 != 0L) { hash ^= U2.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (Rarity != 0) { hash ^= Rarity.GetHashCode(); } if (U5 != 0) { hash ^= U5.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (ItemId != 0L) { hash ^= ItemId.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (Stars != 0) { hash ^= Stars.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (Role != 0) { hash ^= Role.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (OtherItemNameId != 0L) { hash ^= OtherItemNameId.GetHashCode(); } if (OtherItemDescriptionId != 0) { hash ^= OtherItemDescriptionId.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (U4 != 0) { hash ^= U4.GetHashCode(); } if (U5 != 0) { hash ^= U5.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
protected void CreateImageUrl(imageType itemType) { this.ImageUrl = null; if (ImageId == null) { ImageUrl = null; return; } switch (itemType) { case imageType.product: ImageUrl = "Products/" + ImageId.ToString() + ".jpg"; break; case imageType.category: ImageUrl = "Categories/" + ImageId.ToString() + ".jpg"; break; case imageType.item: ImageUrl = "Items/" + ImageId.ToString() + ".jpg"; break; default: ImageUrl = null; break; } }
/// <summary> /// Gets the source URI for the given image. /// </summary> public Task <Uri> GetById(ImageId id) { var fileName = id.Guid.ToString("D", CultureInfo.InvariantCulture).ToUpperInvariant(); var uri = new Uri($"https://amarok.blob.core.windows.net/drinks/{fileName}.jpg"); return(Task.FromResult(uri)); }
public UIButton(ImageId imageId, int w, int h, int x, int y) { image = UIImagePool.Instance.Pop(); image.Source = ImageManager.GetImageSource(imageId); image.Width = w; image.Height = h; image.Margin = new Thickness(x, y, 0, 0); image.IsHoldingEnabled = true; image.Tapped += OnTapped; }
public async Task GetById() { var repo = new AzureImageRepository(); var id = new ImageId(Guid.Empty); Check.That(await repo.GetById(id)) .IsEqualTo( new Uri("https://amarok.blob.core.windows.net/drinks/00000000-0000-0000-0000-000000000000.jpg") ); }
private async Task <ISavedImage> SaveImage(IImage image, ImageSourceId sourceId) { ImageId id = await image.GetId(); _logger.Information("Saving image {ImageId} from source {SourceId}", id.Value, sourceId.Value); ISavedImage savedImage = await _imageRepository.SaveImage(new SourceQualifiedImageId(sourceId, id), image.GetImageStream); _logger.Information("Saved image {ImageId} from source {SourceId}", id.Value, sourceId.Value); return(savedImage); }
public override int GetHashCode() { int hash = 1; if (ItemId != 0L) hash ^= ItemId.GetHashCode(); if (U2 != 0L) hash ^= U2.GetHashCode(); if (ImageId.Length != 0) hash ^= ImageId.GetHashCode(); if (Rarity != 0) hash ^= Rarity.GetHashCode(); if (PotentialLotId != 0) hash ^= PotentialLotId.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; }
public void AddItemToCurrentPlayList() { var pl = m_FakeServer.AddNewPlayList(m_PlayListBuilder.AddImage(m_ImageId).Build()); m_Application.Start(); m_Application.Connect(); m_Application.HasShownPlayLists(new []{pl}); var imageIdToAdd = new ImageId(31); m_Application.AddImageIdToSelectedPlayList(imageIdToAdd); m_Application.HasShown(imageIdToAdd); }
public bool Equals(ImageId other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.Id == Id); }
public void AddItemToCurrentPlayList() { var pl = m_FakeServer.AddNewPlayList(m_PlayListBuilder.AddImage(m_ImageId).Build()); m_Application.Start(); m_Application.Connect(); m_Application.HasShownPlayLists(new [] { pl }); var imageIdToAdd = new ImageId(31); m_Application.AddImageIdToSelectedPlayList(imageIdToAdd); m_Application.HasShown(imageIdToAdd); }
public static void AddImage(ImageId imageId, Xwt.Drawing.Image icon) { if (Guid.Empty == imageId.Guid) { throw new ArgumentException(nameof(imageId)); } if (icon == null) { throw new ArgumentNullException(nameof(icon)); } var iconId = $"{imageId.Guid};{imageId.Id}"; imageIdToStockId.Add(imageId, iconId); AddIcon(iconId, icon); }
public bool TryGetImageId(ImmutableArray <string> tags, out ImageId imageId) { var glyph = tags.GetFirstGlyph(); // We can't do the compositing of these glyphs at the editor layer. So just map them // to the non-add versions. switch (glyph) { case Glyph.AddReference: glyph = Glyph.Reference; break; } imageId = glyph.GetImageId(); return(imageId != default); }
/// <summary> /// The process record method. /// </summary> protected override void ProcessRecord() { try { ResponseType response = Connection.ApiClient.ServerManagement.ServerImage.EditCustomerImageMetadata(new EditImageMetadataType { id = ImageId.ToString(), description = Description, cpuSpeed = CpuSpeed, operatingSystemId = OperatingSystemId, disk = DiskSpeeds }).Result; if (response != null) { WriteDebug( string.Format( "{0} resulted in {1} :{2}", response.operation, response.responseCode, response.message)); } WriteObject(response); } catch (AggregateException ae) { ae.Handle( e => { if (e is ComputeApiException) { WriteError(new ErrorRecord(e, "-2", ErrorCategory.InvalidOperation, Connection)); } else { // if (e is HttpRequestException) ThrowTerminatingError(new ErrorRecord(e, "-1", ErrorCategory.ConnectionError, Connection)); } return(true); }); } base.ProcessRecord(); }
public static bool TryGetImage(ImageId imageId, bool generateDefaultIcon, out Xwt.Drawing.Image image, out string name) { var success = true; if (!imageIdToStockId.TryGetValue(imageId, out name)) { success = false; if (!generateDefaultIcon) { image = null; return(success); } name = "gtk-missing-image"; } image = GetIcon(name); return(success); }
public List <int> GetImages() { List <int> idList = new List <int> { }; int startpos = 0, endpos = 0; for (int i = 0; i < ImageId.Length; i++) { if (ImageId[i].Equals('|')) { endpos = i; idList.Add(int.Parse(ImageId.Substring(startpos, endpos - startpos))); startpos = i + 1; } } return(idList); }
public override int GetHashCode() { int hash = 1; if (ItemId != 0L) { hash ^= ItemId.GetHashCode(); } if (SubCategory != 0L) { hash ^= SubCategory.GetHashCode(); } if (U3 != 0) { hash ^= U3.GetHashCode(); } if (Rarity != 0) { hash ^= Rarity.GetHashCode(); } if (U5 != 0) { hash ^= U5.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (ScheduleId.Length != 0) { hash ^= ScheduleId.GetHashCode(); } if (U8 != 0) { hash ^= U8.GetHashCode(); } if (U9 != 0L) { hash ^= U9.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hash = 1; if (ItemId != 0UL) { hash ^= ItemId.GetHashCode(); } if (ItemSubtypeId != 0) { hash ^= ItemSubtypeId.GetHashCode(); } if (ImageId.Length != 0) { hash ^= ImageId.GetHashCode(); } if (EquipmentType != 0) { hash ^= EquipmentType.GetHashCode(); } if (U5 != 0) { hash ^= U5.GetHashCode(); } if (Type != 0) { hash ^= Type.GetHashCode(); } if (Rarity != 0) { hash ^= Rarity.GetHashCode(); } if (DeckItemParamId != 0) { hash ^= DeckItemParamId.GetHashCode(); } if (U9 != 0) { hash ^= U9.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public PlayListBuilder AddImage(ImageId imageId) { m_Images.Add(imageId); return this; }
public bool Equals(ImageId other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other.Id == Id; }