Exemple #1
0
        public Image this[uint type, ulong instance, THUMSize size, bool isPNGInstance]
        {
            get
            {
                SpecificResource item = getRK(type, instance, size, isPNGInstance);
                if (item != null && item.Resource != null)
                {
                    return(Image.FromStream(item.Resource.Stream));
                }
                return(null);
            }
            set
            {
                SpecificResource item = getItem(isPNGInstance ? FileTable.GameContent : FileTable.Thumbnails, instance, (isPNGInstance ? PNGTypes : thumTypes[type])[(int)size]);
                if (item == null || item.Resource == null)
                {
                    throw new ArgumentException();
                }

                Image thumb;
                thumb = value.GetThumbnailImage(thumSizes[(int)size], thumSizes[(int)size], () => false, System.IntPtr.Zero);
                thumb.Save(item.Resource.Stream, System.Drawing.Imaging.ImageFormat.Png);
                item.Commit();
            }
        }
Exemple #2
0
 static IResourceKey getNewRK(uint type, ulong instance, THUMSize size, bool isPNGInstance)
 {
     return(new RK(RK.NULL)
     {
         ResourceType = (isPNGInstance ? PNGTypes : thumTypes[type])[(int)size],
         ResourceGroup = (uint)(type == 0x515CA4CD ? 1 : 0),
         Instance = instance,
     });
 }
Exemple #3
0
 public static Image getImage(THUMSize size, SpecificResource item)
 {
     if (item.RequestedRK.CType() == CatalogType.ModularResource)
     {
         return(getImage(size, MainForm.ItemForTGIBlock0(item)));
     }
     else if (item.RequestedRK.CType() == CatalogType.CAS_Part)
     {
         return(Thumb[item.RequestedRK.ResourceType, item.RequestedRK.Instance, size, false]);
     }
     else
     {
         ulong png = (item.Resource != null) ? (ulong)item.Resource["CommonBlock.PngInstance"].Value : 0;
         return(Thumb[item.RequestedRK.ResourceType, png != 0 ? png : item.RequestedRK.Instance, size, png != 0]);
     }
 }
Exemple #4
0
 public static IResourceKey getNewRK(THUMSize size, SpecificResource item)
 {
     if (item.RequestedRK.CType() == CatalogType.ModularResource)
     {
         return(RK.NULL);
     }
     else if (item.RequestedRK.CType() == CatalogType.CAS_Part)
     {
         return(getNewRK(item.RequestedRK.ResourceType, item.RequestedRK.Instance, size, false));
     }
     else
     {
         ulong png = (item.Resource != null) ? (ulong)item.Resource["CommonBlock.PngInstance"].Value : 0;
         return(getNewRK(item.RequestedRK.ResourceType, png != 0 ? png : item.RequestedRK.Instance, size, png != 0));
     }
 }
Exemple #5
0
        public Image this[uint type, ulong instance, THUMSize size, bool isPNGInstance]
        {
            get
            {
                SpecificResource item = getRK(type, instance, size, isPNGInstance);
                if (item != null && item.Resource != null)
                    return Image.FromStream(item.Resource.Stream);
                return null;
            }
            set
            {
                SpecificResource item = getItem(isPNGInstance ? FileTable.GameContent : FileTable.Thumbnails, instance, (isPNGInstance ? PNGTypes : thumTypes[type])[(int)size]);
                if (item == null || item.Resource == null)
                    throw new ArgumentException();

                Image thumb;
                thumb = value.GetThumbnailImage(thumSizes[(int)size], thumSizes[(int)size], () => false, System.IntPtr.Zero);
                thumb.Save(item.Resource.Stream, System.Drawing.Imaging.ImageFormat.Png);
                item.Commit();
            }
        }
Exemple #6
0
 public Image this[uint type, ulong instance, THUMSize size] {
     get { return(this[type, instance, size, false]); } set { this[type, instance, size, false] = value; }
 }
Exemple #7
0
 public Image this[ulong instance, THUMSize size, bool isPNGInstance] {
     get { return(this[defType, instance, size, isPNGInstance]); } set { this[defType, instance, size, isPNGInstance] = value; }
 }
Exemple #8
0
 static SpecificResource getRK(uint type, ulong instance, THUMSize size, bool isPNGInstance)
 {
     return(getItem(isPNGInstance ? FileTable.GameContent : FileTable.Thumbnails, instance, (isPNGInstance ? PNGTypes : thumTypes[type])[(int)size]));
 }
Exemple #9
0
 static SpecificResource getRK(uint type, ulong instance, THUMSize size, bool isPNGInstance)
 {
     return getItem(isPNGInstance ? FileTable.GameContent : FileTable.Thumbnails, instance, (isPNGInstance ? PNGTypes : thumTypes[type])[(int)size]);
 }
Exemple #10
0
 public Image this[uint type, ulong instance, THUMSize size] { get { return this[type, instance, size, false]; } set { this[type, instance, size, false] = value; } }
Exemple #11
0
 public Image this[ulong instance, THUMSize size, bool isPNGInstance] { get { return this[defType, instance, size, isPNGInstance]; } set { this[defType, instance, size, isPNGInstance] = value; } }
Exemple #12
0
 public static Image getImage(THUMSize size, SpecificResource item)
 {
     if (item.RequestedRK.CType() == CatalogType.ModularResource)
     {
         return getImage(size, MainForm.ItemForTGIBlock0(item));
     }
     else if (item.RequestedRK.CType() == CatalogType.CAS_Part)
     {
         return Thumb[item.RequestedRK.ResourceType, item.RequestedRK.Instance, size, false];
     }
     else
     {
         ulong png = (item.Resource != null) ? (ulong)item.Resource["CommonBlock.PngInstance"].Value : 0;
         return Thumb[item.RequestedRK.ResourceType, png != 0 ? png : item.RequestedRK.Instance, size, png != 0];
     }
 }
Exemple #13
0
 static IResourceKey getNewRK(uint type, ulong instance, THUMSize size, bool isPNGInstance)
 {
     return new RK(RK.NULL)
     {
         ResourceType = (isPNGInstance ? PNGTypes : thumTypes[type])[(int)size],
         ResourceGroup = (uint)(type == 0x515CA4CD ? 1 : 0),
         Instance = instance,
     };
 }
Exemple #14
0
 public static IResourceKey getNewRK(THUMSize size, SpecificResource item)
 {
     if (item.RequestedRK.CType() == CatalogType.ModularResource)
     {
         return RK.NULL;
     }
     else if (item.RequestedRK.CType() == CatalogType.CAS_Part)
     {
         return getNewRK(item.RequestedRK.ResourceType, item.RequestedRK.Instance, size, false);
     }
     else
     {
         ulong png = (item.Resource != null) ? (ulong)item.Resource["CommonBlock.PngInstance"].Value : 0;
         return getNewRK(item.RequestedRK.ResourceType, png != 0 ? png : item.RequestedRK.Instance, size, png != 0);
     }
 }
Exemple #15
0
 public static uint getThumbType(uint parentType, THUMSize size, bool isPNGInstance)
 {
     return((isPNGInstance ? PNGTypes : thumTypes[parentType])[(int)size]);
 }