Chore(Stage): Initial Commit

This commit is contained in:
Tochukwu Nkemdilim
2018-06-13 18:41:24 +01:00
commit 1535d3d768
12 changed files with 305 additions and 0 deletions
@@ -0,0 +1,24 @@
use std::fs;
use std::io;
use connectivity::stubs::windows_wifi_profile;
pub(crate) struct NetworkXmlProfileHandler {
pub(crate) content: String,
}
impl NetworkXmlProfileHandler {
pub fn new() -> Self {
NetworkXmlProfileHandler {
content: NetworkXmlProfileHandler::read_from_stub(),
}
}
pub fn read_from_stub() -> String {
windows_wifi_profile::get_wifi_profile()
}
/// Recreate the file and dump the processed contents to it
pub fn to_file(&mut self, file_path: &str) -> Result<(), io::Error> {
Ok(fs::write(&file_path, self.content.as_bytes())?)
}
}