/// <summary> /// Loads the specified <see cref="HostsFileProfile"/>. /// </summary> /// <param name="sourceProfile">A <see cref="HostsFileProfile"/> object.</param> /// <returns>True if the specified <paramref name="sourceProfile"/> was loaded successfully; otherwise false.</returns> public bool LoadProfile(HostsFileProfile sourceProfile) { if (this.HostFileInstance != null) { HostFile hf = HostfileManager.Current.GetProfile(sourceProfile.ProfilePath); if (hf != null) { this.HostFileInstance = hf; return true; } } return false; }
/// <summary> /// Loads the specified <see cref="HostsFileProfile"/>. /// </summary> /// <param name="sourceProfile">A <see cref="HostsFileProfile"/> object.</param> public void LoadProfile(HostsFileProfile sourceProfile) { if (sourceProfile == null) { throw new ArgumentNullException("sourceProfile"); } if (this.InnerViewModel != null) { this.innerViewModel.LoadProfile(sourceProfile); } }
/// <summary> /// Saves the current application state to the specified <paramref name="targetProfile"/> object. /// </summary> /// <param name="targetProfile">A <paramref name="targetProfile"/> object.</param> /// <returns>True if the current application state was successfully saved to the specified <paramref name="targetProfile"/>; Otherwise false.</returns> public bool SaveToProfile(HostsFileProfile targetProfile) { if (targetProfile == null) { throw new ArgumentNullException("targetProfile"); } if (this.InnerViewModel != null) { if (this.InnerViewModel.HostFileInstance != null) { return HostfileManager.Current.SaveToProfile(this.InnerViewModel.HostFileInstance, targetProfile.ProfilePath); } } return false; }
/// <summary> /// Delete the specified <paramref name="targetProfile"/> from the user's hard-disk. /// </summary> /// <param name="targetProfile">A <paramref name="targetProfile"/> object.</param> /// <returns>True if the specified <paramref name="targetProfile"/> has been successfully deleted; otherwise false.</returns> public bool DeleteProfile(HostsFileProfile targetProfile) { return HostfileManager.Current.DeleteProfile(targetProfile); }