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); } }
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); }
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 }); }
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); }