feat: add some lowlevel functions
This commit is contained in:
@@ -454,43 +454,43 @@ impl AppPathsKey {
|
|||||||
.ok_or(Error::InexistantKey)
|
.ok_or(Error::InexistantKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
const NAMEOF_PATH_TO_APPLICATION: &str = "";
|
const NAMEOF_DEFAULT: &str = "";
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// This field point to the fully qualified path to the application.
|
/// This field point to the fully qualified path to the application.
|
||||||
pub fn get_default(&self, scope: Scope) -> Result<String, Error> {
|
pub fn get_default(&self, scope: Scope) -> Result<String, Error> {
|
||||||
let key = self.open_scope_for_getter(scope)?;
|
let key = self.open_scope_for_getter(scope)?;
|
||||||
Ok(key.get_value(Self::NAMEOF_PATH_TO_APPLICATION)?)
|
Ok(key.get_value(Self::NAMEOF_DEFAULT)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// This field should be filled with fully qualified path to the application.
|
/// This field should be filled with fully qualified path to the application.
|
||||||
pub fn set_default(&mut self, scope: Scope, value: &str) -> Result<(), Error> {
|
pub fn set_default(&mut self, scope: Scope, value: &str) -> Result<(), Error> {
|
||||||
let key = self.open_scope_for_setter(scope)?;
|
let key = self.open_scope_for_setter(scope)?;
|
||||||
key.set_value(Self::NAMEOF_PATH_TO_APPLICATION, &value)?;
|
key.set_value(Self::NAMEOF_DEFAULT, &value)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
const NAMEOF_APPLICATION_DIRECTORY: &str = "Path";
|
const NAMEOF_PATH: &str = "Path";
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// This field point to the added path for PATH environment variable.
|
/// This field point to the added path for PATH environment variable.
|
||||||
/// Usually it is the path to application directory.
|
/// Usually it is the path to application directory.
|
||||||
pub fn get_path(&self, scope: Scope) -> Result<String, Error> {
|
pub fn get_path(&self, scope: Scope) -> Result<String, Error> {
|
||||||
let key = self.open_scope_for_getter(scope)?;
|
let key = self.open_scope_for_getter(scope)?;
|
||||||
Ok(key.get_value(Self::NAMEOF_APPLICATION_DIRECTORY)?)
|
Ok(key.get_value(Self::NAMEOF_PATH)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
/// This field should be the added path for PATH environment variable.
|
/// This field should be the added path for PATH environment variable.
|
||||||
/// Usually it is the path to application directory.
|
/// Usually it is the path to application directory.
|
||||||
pub fn set_path(&mut self, scope: Scope, value: &str) -> Result<(), Error> {
|
pub fn set_path(&mut self, scope: Scope, value: &str) -> Result<(), Error> {
|
||||||
let key = self.open_scope_for_setter(scope)?;
|
let key = self.open_scope_for_setter(scope)?;
|
||||||
key.set_value(Self::NAMEOF_APPLICATION_DIRECTORY, &value)?;
|
key.set_value(Self::NAMEOF_PATH, &value)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -603,10 +603,6 @@ impl ApplicationsKey {
|
|||||||
const NAMEOF_SHELL_VERB_PART1: &str = "shell";
|
const NAMEOF_SHELL_VERB_PART1: &str = "shell";
|
||||||
const NAMEOF_SHELL_VERB_PART3: &str = "command";
|
const NAMEOF_SHELL_VERB_PART3: &str = "command";
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// We temporarily use String and &str as the command line argument parameter.
|
|
||||||
// We may introduce a new complete Rust struct for replacing this arbitrary string.
|
|
||||||
|
|
||||||
pub fn get_shell_verb(&self, view: View) -> Result<ShellVerb, Error> {
|
pub fn get_shell_verb(&self, view: View) -> Result<ShellVerb, Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
@@ -725,6 +721,47 @@ impl ExtKey {
|
|||||||
// okey
|
// okey
|
||||||
Ok(OpenedKey::new(classes, this_ext))
|
Ok(OpenedKey::new(classes, this_ext))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// YYC MARK:
|
||||||
|
// We do not support "Content Type" and "PerceivedType"
|
||||||
|
// because current interface are enough to use,
|
||||||
|
// and these types has not been made as concept struct in Rust.
|
||||||
|
|
||||||
|
const NAMEOF_DEFAULT: &str = "";
|
||||||
|
|
||||||
|
pub fn get_default(&self, view: View) -> Result<Option<LosseProgId>, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_default(&mut self, scope: Scope, pid: Option<&LosseProgId>) -> Result<(), Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
const NAMEOF_OPEN_WITH_PROGIDS: &str = "OpenWithProgIds";
|
||||||
|
|
||||||
|
pub fn get_open_with_progids(&self, view: View) -> Result<Vec<LosseProgId>, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn is_in_open_with_progids(&self, view: View, pid: &LosseProgId) -> Result<bool, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_into_open_with_progids(
|
||||||
|
&mut self,
|
||||||
|
scope: Scope,
|
||||||
|
pid: &LosseProgId,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn remove_from_open_with_progids(
|
||||||
|
&mut self,
|
||||||
|
scope: Scope,
|
||||||
|
pid: &LosseProgId,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
@@ -746,4 +783,59 @@ impl ProgIdKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ProgIdKey {
|
||||||
|
const FULL_CLASSES: &str = "Software\\Classes";
|
||||||
|
const PARTIAL_CLASSES: &str = "";
|
||||||
|
|
||||||
|
fn open_key(
|
||||||
|
&self,
|
||||||
|
territory: OpenKeyTerritory,
|
||||||
|
purpose: OpenKeyPurpose,
|
||||||
|
) -> Result<OpenedKey, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
// YYC MARK:
|
||||||
|
// Currently we only support (Default), FriendlyTypeName and DefaultIcon
|
||||||
|
// to just cover the basic usage.
|
||||||
|
|
||||||
|
const NAMEOF_DEFAULT: &str = "";
|
||||||
|
|
||||||
|
pub fn get_default(&self, view: View) -> Result<Option<StrResVariant>, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_default(&mut self, scope: Scope, name: Option<&StrResVariant>) -> Result<(), Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
const NAMEOF_FRIENDLY_TYPE_NAME: &str = "FriendlyTypeName";
|
||||||
|
|
||||||
|
pub fn get_friendly_type_name(&self, view: View) -> Result<Option<StrResVariant>, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_friendly_type_name(
|
||||||
|
&self,
|
||||||
|
scope: Scope,
|
||||||
|
name: Option<&StrResVariant>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
const NAMEOF_DEFAULT_ICON: &str = "DefaultIcon";
|
||||||
|
|
||||||
|
pub fn get_default_icon(&self, view: View) -> Result<Option<IconResVariant>, Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_default_icon(
|
||||||
|
&self,
|
||||||
|
scope: Scope,
|
||||||
|
icon: Option<&IconResVariant>,
|
||||||
|
) -> Result<(), Error> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user