appgo

package module
v0.0.0-...-3e1a9d8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

README

description

The source code comes from a third-party project and is independently used to parse the app package information. Competent people are welcome to submit code.

According to file suffix

AppParsePath

AppParseFile

AppParseReader

package main

import (
	"fmt"
	"io"
	"os"

	"github.com/pkg6/appgo"
)

func main() {
	filename := "./.test_data/ipa.ipa"
	f, err := os.Open(filename)
	if err != nil {
		fmt.Println(err)
	}
	defer f.Close()
	info, _ := appgo.AppParseFile(f)
	// ico 保存在本地
	filename, buf, _ := info.Icon()
	file, _ := os.Create(filename)
	defer file.Close()
	io.Copy(file, buf)
}

Obtain APK information

APKParsePath

APKParseFile

APKParseReader

package main

import (
	"fmt"

	"github.com/pkg6/appgo"
)

func main() {
	info, err := appgo.APKParseFile(".test_data/helloworld.apk")
	fmt.Println(info, err)
}

Obtain IPA information

IPAParsePath

IPAParseFile

IPAParseReader

package main

import (
	"fmt"

	"github.com/pkg6/appgo"
)

func main() {
	info, err := appgo.IPAParsePath(".test_data/ipa.ipa")
	fmt.Println(info, err)
}

Documentation

Index

Constants

View Source
const (
	AppTypeIPA     = AppType(0)
	AppTypeAPK     = AppType(1)
	AppTypeUnknown = AppType(-1)
)

Variables

View Source
var (
	ErrInfoPlistNotFound = errors.New("Info.plist not found")
)

Functions

This section is empty.

Types

type APK

type APK struct {
	// contains filtered or unexported fields
}

func APKParseFile

func APKParseFile(f *os.File) (*APK, error)

func APKParsePath

func APKParsePath(file string) (*APK, error)

func APKParseReader

func APKParseReader(readerAt io.ReaderAt, size int64) (*APK, error)

func (*APK) Build

func (a *APK) Build() string

func (*APK) Channel

func (a *APK) Channel() string

func (*APK) Icon

func (a *APK) Icon() image.Image

func (*APK) Identifier

func (a *APK) Identifier() string

func (*APK) Name

func (a *APK) Name() string

func (*APK) Size

func (a *APK) Size() int64

func (*APK) Version

func (a *APK) Version() string

type AppInfo

type AppInfo struct {
	ID         string    `json:"id"`
	Name       string    `json:"name"`
	Version    string    `json:"version"`
	Identifier string    `json:"identifier"`
	Build      string    `json:"build"`
	Channel    string    `json:"channel"`
	Date       time.Time `json:"date"`
	Size       int64     `json:"size"`
	Type       AppType   `json:"type"`
	Package    Package   `json:"package"`
}

func AppParseFile

func AppParseFile(file *os.File) (*AppInfo, error)

func AppParsePath

func AppParsePath(path string) (*AppInfo, error)

func AppParseReader

func AppParseReader(readerAt io.ReaderAt, appType AppType, size int64) (*AppInfo, error)

func NewAppInfo

func NewAppInfo(pkg Package, t AppType) *AppInfo

func (*AppInfo) Icon

func (a *AppInfo) Icon() (string, *bytes.Buffer, error)

Icon filename := "./.test_data/ipa.ipa" f, err := os.Open(filename)

if err != nil {
	fmt.Println(err)
}

defer f.Close() info, _ := appgo.APPInfo(f) filename, buf, _ := info.Icon() file, _ := os.Create(filename) defer file.Close() io.Copy(file, buf)

func (*AppInfo) PackageName

func (a *AppInfo) PackageName() string

type AppType

type AppType int

func AppTypeFileName

func AppTypeFileName(filename string) AppType

func (AppType) Name

func (t AppType) Name() string

type IPA

type IPA struct {
	// contains filtered or unexported fields
}

func IPAParseFile

func IPAParseFile(f *os.File) (*IPA, error)

func IPAParsePath

func IPAParsePath(file string) (*IPA, error)

func IPAParseReader

func IPAParseReader(readerAt io.ReaderAt, size int64) (*IPA, error)

func (*IPA) Build

func (i *IPA) Build() string

func (*IPA) Channel

func (i *IPA) Channel() string

func (*IPA) Icon

func (i *IPA) Icon() image.Image

func (*IPA) Identifier

func (i *IPA) Identifier() string

func (*IPA) Name

func (i *IPA) Name() string

func (*IPA) Size

func (i *IPA) Size() int64

func (*IPA) Version

func (i *IPA) Version() string

type InfoPlist

type InfoPlist struct {
	CFBundleDisplayName        string        `json:"CFBundleDisplayName,omitempty"`
	CFBundleExecutable         string        `json:"CFBundleExecutable,omitempty"`
	CFBundleIconName           string        `json:"CFBundleIconName,omitempty"`
	CFBundleIcons              InfoPlistIcon `json:"CFBundleIcons,omitempty"`
	CFBundleIconsIpad          InfoPlistIcon `json:"CFBundleIcons~ipad,omitempty"`
	CFBundleIdentifier         string        `json:"CFBundleIdentifier,omitempty"`
	CFBundleName               string        `json:"CFBundleName,omitempty"`
	CFBundleShortVersionString string        `json:"CFBundleShortVersionString,omitempty"`
	CFBundleSupportedPlatforms []string      `json:"CFBundleSupportedPlatforms,omitempty"`
	CFBundleVersion            string        `json:"CFBundleVersion,omitempty"`
	// not standard
	Channel string `json:"channel"`
}

type InfoPlistIcon

type InfoPlistIcon struct {
	CFBundlePrimaryIcon struct {
		CFBundleIconFiles []string `json:"CFBundleIconFiles,omitempty"`
		CFBundleIconName  string   `json:"CFBundleIconName,omitempty"`
	} `json:"CFBundlePrimaryIcon,omitempty"`
}

type Package

type Package interface {
	Name() string
	Version() string
	Identifier() string
	Build() string
	Channel() string
	Icon() image.Image
	Size() int64
}

Directories

Path Synopsis
streaming multiple io.Reader as one
streaming multiple io.Reader as one

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL