Exemplo n.º 1
0
        public ImageModel()
        {
            ImageId = Guid.NewGuid();
            var FileName = ImageId.ToString();

            Image = new ImageInfo(FileName);
        }
Exemplo n.º 2
0
        /// <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");
            }
        }
Exemplo n.º 3
0
        /// <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");
                }
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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));
        }
Exemplo n.º 9
0
        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));
                                    });
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 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;
 }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        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);
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        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;
            }
        }
Exemplo n.º 19
0
        /// <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));
        }
Exemplo n.º 20
0
 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;
 }
Exemplo n.º 21
0
        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")
                );
        }
Exemplo n.º 22
0
        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);
        }
Exemplo n.º 23
0
 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;
 }
Exemplo n.º 24
0
        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);
        }
Exemplo n.º 25
0
 public bool Equals(ImageId other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(other.Id == Id);
 }
Exemplo n.º 26
0
        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);
        }
Exemplo n.º 27
0
        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);
        }
Exemplo n.º 28
0
        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);
        }
Exemplo n.º 29
0
        /// <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();
        }
Exemplo n.º 30
0
        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);
        }
Exemplo n.º 31
0
        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);
        }
Exemplo n.º 32
0
        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);
        }
Exemplo n.º 33
0
        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);
        }
Exemplo n.º 34
0
 public PlayListBuilder AddImage(ImageId imageId)
 {
     m_Images.Add(imageId);
     return this;
 }
Exemplo n.º 35
0
 public bool Equals(ImageId other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.Id == Id;
 }