feat: write some content for lowlevel
This commit is contained in:
@@ -998,14 +998,50 @@ impl ExtKey {
|
||||
|
||||
const NAMEOF_OPEN_WITH_PROGIDS: &str = "OpenWithProgIds";
|
||||
|
||||
pub fn get_open_with_progids(&self, view: View) -> Result<Vec<LosseProgId>, Error> {
|
||||
todo!()
|
||||
pub fn get_open_with_progids(&self, view: View) -> Result<Option<Vec<LosseProgId>>, Error> {
|
||||
let key = self.open_view_for_getter(view)?;
|
||||
// Get OpenWithProgIds subkey
|
||||
let open_with_progids_key = match regext::try_open_subkey_with_flags(
|
||||
&key,
|
||||
regext::blank_path_guard(Self::NAMEOF_OPEN_WITH_PROGIDS)?,
|
||||
PERM_R,
|
||||
)? {
|
||||
Some(key) => key,
|
||||
None => return Ok(None),
|
||||
};
|
||||
// Fetch all sub-values
|
||||
let key_names = regext::get_all_string_subkey_names(&open_with_progids_key)?;
|
||||
// Map the result
|
||||
let progids = key_names
|
||||
.into_iter()
|
||||
.map(|name| LosseProgId::from(name.as_str()))
|
||||
.collect();
|
||||
// Return value
|
||||
Ok(Some(progids))
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// If there is no "OpenWithProgIds" subkey, this function return false.
|
||||
pub fn is_in_open_with_progids(&self, view: View, pid: &LosseProgId) -> Result<bool, Error> {
|
||||
todo!()
|
||||
let key = self.open_view_for_getter(view)?;
|
||||
// Get OpenWithProgIds subkey
|
||||
let open_with_progids_key = match regext::try_open_subkey_with_flags(
|
||||
&key,
|
||||
regext::blank_path_guard(Self::NAMEOF_OPEN_WITH_PROGIDS)?,
|
||||
PERM_R,
|
||||
)? {
|
||||
Some(key) => key,
|
||||
None => return Ok(false),
|
||||
};
|
||||
// Check whether there is given ProgId
|
||||
Ok(regext::try_get_value::<String, _>(&open_with_progids_key, pid.to_string())?.is_some())
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// If there is no "OpenWithProgIds" subkey, this function will create it first,
|
||||
/// then add your given ProgId into it.
|
||||
pub fn add_into_open_with_progids(
|
||||
&mut self,
|
||||
scope: Scope,
|
||||
@@ -1014,6 +1050,9 @@ impl ExtKey {
|
||||
todo!()
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// If there is no "OpenWithProgIds" subkey, this function do nothing.
|
||||
pub fn remove_from_open_with_progids(
|
||||
&mut self,
|
||||
scope: Scope,
|
||||
|
||||
Reference in New Issue
Block a user