Extension
class · namespace z3n7 · source Browser/ChromeExt.cs
public class Extension
Chrome extension management in a ZennoPoster instance: version, install, enable/disable, remove.
Constructors
Extension
public Extension(IZennoPosterProjectModel project, Logger log = null)
Creates a helper without an instance; only GetVer works.
| Parameter | Description |
|---|---|
log |
Logger for progress; null logs nothing. |
public Extension(IZennoPosterProjectModel project, Instance instance, Logger log = null)
Creates a helper for an instance.
| Parameter | Description |
|---|---|
log |
Logger for progress; null logs nothing. |
Methods
GetVer
public string GetVer(string extId)
Reads an installed extension's version from {pathProfileFolder}\Default\Secure Preferences.
| Parameter | Description |
|---|---|
extId |
Extension id. |
Returns: The version. Throws when the file has no such extension or version.
InstallFromCrx
public bool InstallFromCrx(string extId, string fileName, bool log = false)
Installs a CRX file unless an extension with this id is already installed.
| Parameter | Description |
|---|---|
extId |
Extension id. |
fileName |
CRX file name in {project.Path}.crx\. |
log |
Not used. |
Returns: true when installed now. Throws when the file is missing.
InstallFromStore
public bool InstallFromStore(string url, bool log = false)
Opens the Chrome Web Store page and installs the extension, confirming the dialog with keystrokes. When it is already installed, clicks "Enable now" if shown.
| Parameter | Description |
|---|---|
url |
Web Store page of the extension. |
log |
Not used. |
Returns: true when the install was started; false when it was already installed.
Rm
public void Rm(string[] ExtToRemove)
Uninstalls the extensions; failures are logged and skipped.
| Parameter | Description |
|---|---|
ExtToRemove |
Extension ids. |
Switch
public bool Switch(string toUse = "", bool log = false)
Enables the listed extensions and disables all others through the One-Click Extensions Manager page (installed first if missing). Mouse emulation is restored afterwards. Works for Chromium (manager from CRX) and ChromiumFromZB (manager from the Web Store) instances.
| Parameter | Description |
|---|---|
toUse |
Names or ids of the extensions to keep enabled; matched as substrings of this text. |
log |
Not used. |
Returns: true when at least one listed extension is enabled.