clickonce

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: BSD-3-Clause Imports: 17 Imported by: 1

README

godoc reference build status go report card license

clickonce

The clickonce package allows to download a ClickOnce application.

Example

Just import the library and set the URL of the ClickOnce application you want to download.

import "github.com/whitone/clickonce"

co := &clickonce.ClickOnce{}
co.Init("https://my.cool.webserver/clickonce.application")

Then you can dump the remote contents related to requested application with the following method.

err := co.GetAll()
if err != nil {
  log.Fatal(err)
}

And then, for example, you can check the content type and path of all deployed files.

for dPath, dContent := range co.DeployedFiles() {
  fmt.Printf("%s: %s", dPath, http.DetectContentType(dContent))
}

If you want to save in a directory the application files, just set the output directory. If that directory not exists, will be created.

co.SetOutputDir("application")

If you need only some files from the application, just define your subset.

err := co.Get([]string{"application.exe", "library.dll"})
if err != nil {
  log.Fatal(err)
}

To get more info about the progress of your request, you can enable verbose mode by passing your logger to the library.

logger := log.New(os.Stdout, "", log.LstdFlags)
co.SetLogger(logger)

Useful references

License

clickonce is licensed under the BSD-3-Clause License.

Documentation

Overview

Package clickonce provides support for downloading ClickOnce applications.

Index

Constants

View Source
const (
	// AssemblyDependency indicates a dependency required for the application.
	AssemblyDependency coType = iota

	// NonAssemblyFile indicates a file used by the application.
	NonAssemblyFile
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClickOnce

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

A ClickOnce represents ClickOnce application files.

func (*ClickOnce) DeployedFiles

func (co *ClickOnce) DeployedFiles() map[string]DeployedFile

DeployedFiles get all deployed files.

func (*ClickOnce) Get

func (co *ClickOnce) Get(subset []string) error

Get download only a subset of all files required or used by ClickOnce application. If subset is nil or empty, all files are downloaded.

func (*ClickOnce) GetAll

func (co *ClickOnce) GetAll() error

GetAll download all files required or used by ClickOnce application.

func (*ClickOnce) Init

func (co *ClickOnce) Init(appUrl string) error

Init with a valid ClickOnce deployment manifest URL.

func (*ClickOnce) SetLogger

func (co *ClickOnce) SetLogger(logger *log.Logger)

SetLogger set logger for the library.

func (*ClickOnce) SetOutputDir

func (co *ClickOnce) SetOutputDir(outputDir string)

SetOutputDir set the path of the directory where to save deployed files.

type DeployedFile

type DeployedFile struct {
	// Deployed file type.
	Type coType
	// Deployed file content.
	Content []byte
}

A DeployedFile represents a ClickOnce deployed file.

Jump to

Keyboard shortcuts

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