Example #1
0
        public ShipSerializable Serialize()
        {
            var serializable = new ShipSerializable();

            serializable.Id                 = ItemId.Id;
            serializable.FileName           = ItemId.Name;
            serializable.ItemType           = (int)ItemType.Ship;
            serializable.ShipCategory       = ShipCategory;
            serializable.Name               = Name;
            serializable.Faction            = Faction.Id;
            serializable.SizeClass          = SizeClass;
            serializable.IconImage          = IconImage.ToString();
            serializable.IconScale          = IconScale.Value;
            serializable.ModelImage         = ModelImage.ToString();
            serializable.ModelScale         = ModelScale.Value;
            serializable.EnginePosition     = EnginePosition;
            serializable.EngineColor        = Utils.ColorUtils.ColorToString(EngineColor);
            serializable.EngineSize         = EngineSize.Value;
            serializable.EnergyResistance   = EnergyResistance.Value;
            serializable.KineticResistance  = KineticResistance.Value;
            serializable.HeatResistance     = HeatResistance.Value;
            serializable.Regeneration       = Regeneration;
            serializable.BaseWeightModifier = BaseWeightModifier.Value;
            serializable.BuiltinDevices     = BuiltinDevices?.Select(item => item.Item.Id).ToArray();
            serializable.Layout             = Layout.Data;
            serializable.Barrels            = Barrels?.Select(item => item.Serialize()).ToArray();
            return(serializable);
        }
Example #2
0
        private static object GetIconImageResource(IconImage iconImage)
        {
            if (null == resources)
            {
                resources = new IconImageResources();
            }

            return(resources["Icon_" + iconImage.ToString()]);
        }
        /// <summary>Retrieves the path to the specified icon.</summary>
        /// <param name="helper">The HTML helper to extend.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="greyscale">Flag indicating if the greyscale version should be retrieved.</param>
        public static string IconUrl(this HtmlHelper helper, IconImage icon, bool greyscale = false)
        {
            // Retrieve the folder.
            var iconName = icon.ToString();
            string subPath = null;
            if (iconName.StartsWith("Silk"))
            {
                string greyscalePath = greyscale ? "/Greyscale" : null;
                subPath = string.Format("Silk{0}/{1}.png", greyscalePath, iconName);
            }
            if (subPath == null) throw new NotFoundException(string.Format("Cannot resolve URL to the icon '{0}'.", iconName));

            // Create the complete URL.
            return string.Format("/{0}/Icons/{1}", Assets.AreaRegistration.Name, subPath);
        }
Example #4
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("ChannelInfo(");
        bool __first = true;

        if (ChannelId != null && __isset.channelId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelId: ");
            ChannelId.ToString(sb);
        }
        if (Name != null && __isset.name)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Name: ");
            Name.ToString(sb);
        }
        if (EntryPageUrl != null && __isset.entryPageUrl)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("EntryPageUrl: ");
            EntryPageUrl.ToString(sb);
        }
        if (DescriptionText != null && __isset.descriptionText)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("DescriptionText: ");
            DescriptionText.ToString(sb);
        }
        if (Provider != null && __isset.provider)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Provider: ");
            Provider.ToString(sb);
        }
        if (__isset.publicType)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("PublicType: ");
            PublicType.ToString(sb);
        }
        if (IconImage != null && __isset.iconImage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("IconImage: ");
            IconImage.ToString(sb);
        }
        if (Permissions != null && __isset.permissions)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Permissions: ");
            Permissions.ToString(sb);
        }
        if (IconThumbnailImage != null && __isset.iconThumbnailImage)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("IconThumbnailImage: ");
            IconThumbnailImage.ToString(sb);
        }
        if (ChannelConfigurations != null && __isset.channelConfigurations)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelConfigurations: ");
            ChannelConfigurations.ToString(sb);
        }
        if (__isset.lcsAllApiUsable)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("LcsAllApiUsable: ");
            LcsAllApiUsable.ToString(sb);
        }
        if (AllowedPermissions != null && __isset.allowedPermissions)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("AllowedPermissions: ");
            AllowedPermissions.ToString(sb);
        }
        if (ChannelDomains != null && __isset.channelDomains)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ChannelDomains: ");
            ChannelDomains.ToString(sb);
        }
        if (__isset.updatedTimestamp)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("UpdatedTimestamp: ");
            UpdatedTimestamp.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }