示例#1
0
 public ResourcePackEntry(ResourcePackManifest manifest, string path) : this(path, manifest.Name, manifest.Description)
 {
     if (manifest.Icon != null)
     {
         _icon.Texture = TextureUtils.BitmapToTexture2D(Alex.Instance.GraphicsDevice, manifest.Icon);
     }
 }
示例#2
0
        public bool TryLoadResourcePackInfo(string file, out ResourcePackManifest manifest)
        {
            manifest = default;
            if (!File.Exists(file))
            {
                return(false);
            }

            using (FileStream stream = File.OpenRead(file))
                using (var archive = new ZipFileSystem(stream, Path.GetFileNameWithoutExtension(file)))
                {
                    manifest = ResourcePackLib.ResourcePack.GetManifest(archive);

                    if (manifest != null)
                    {
                        manifest.Name = archive.Name;
                    }
                }

            if (manifest == null)
            {
                return(false);
            }

            return(true);
        }
示例#3
0
        public ResourcePackEntry(string path, string name, string description)
        {
            Path     = path;
            Manifest = null;

            SetFixedSize(355, 36);

            Margin  = new Thickness(5, 5, 5, 5);
            Padding = Thickness.One;
            Anchor  = Alignment.TopFill;

            AddChild(_icon = new GuiTextureElement()
            {
                Width  = 32,
                Height = 32,

                Anchor = Alignment.TopLeft,

                Background   = GuiTextures.DefaultServerIcon,
                AutoSizeMode = AutoSizeMode.None,
                RepeatMode   = TextureRepeatMode.NoRepeat
            });

            AddChild(_textWrapper = new GuiStackContainer()
            {
                ChildAnchor = Alignment.TopFill,
                Anchor      = Alignment.TopLeft
            });
            _textWrapper.Padding = new Thickness(0, 0);
            _textWrapper.Margin  = new Thickness(37, 0, 0, 0);

            _textWrapper.AddChild(new GuiTextElement()
            {
                Text   = name,
                Margin = Thickness.Zero
            });

            _textWrapper.AddChild(new GuiTextElement()
            {
                Text   = description,
                Margin = new Thickness(0, 0, 5, 0),

                //Anchor = center
            });

            AddChild(_loadedIcon = new LoadIcon()
            {
                Anchor       = Alignment.TopRight,
                AutoSizeMode = AutoSizeMode.None
            });
        }
示例#4
0
        public bool TryLoadResourcePackInfo(string file, out ResourcePackManifest manifest)
        {
            manifest = default;
            if (!File.Exists(file))
            {
                return(false);
            }

            ResourcePackLib.ResourcePack info;
            using (FileStream stream = File.OpenRead(file))
                using (var archive = new ZipArchive(stream, ZipArchiveMode.Read))
                    info = ResourcePackLib.ResourcePack.LoadFromArchive(archive);

            if (info == null || info == default)
            {
                return(false);
            }

            manifest = info.Info;
            return(true);
        }