/// <summary> /// Loads the configurations from a saved profile. /// </summary> /// <param name="request">Profile request.</param> public void LoadProfileSettings(ProfileRequest request) { string filenameWithoutExtension = Path.GetFileNameWithoutExtension(request.FileName); var baseNode = StoragePool.GetKnownNode(KnownStorageNodeNames.TestSuite); if (baseNode.NodeExists(filenameWithoutExtension)) { baseNode.RemoveNode(filenameWithoutExtension); } var profileNode = baseNode.CreateNode(filenameWithoutExtension); profileNode.CreateFile(request.FileName, request.Stream); string fullName = Path.Combine(profileNode.AbsolutePath, request.FileName); var configurationNode = StoragePool.GetKnownNode(KnownStorageNodeNames.Configuration); var testSuite = GetTestSuite(request.TestSuiteId); using (ProfileUtil profile = ProfileUtil.LoadProfile(fullName)) { if (!profile.VerifyVersion(testSuite.Version)) { if (profile.Info != null) { throw new InvalidDataException(string.Format ( StringMessages.ProfileNotMatchError, profile.Info.TestSuiteName, profile.Info.Version, testSuite.Name, testSuite.Version ) ); } else { throw new InvalidDataException(StringMessages.InvalidProfile); } } string configBaseNode = GetConfigurationsPath(request.ConfigurationId, configurationNode.AbsolutePath); if (!configurationNode.NodeExists(configBaseNode)) { configurationNode.CreateNode(configBaseNode); } string profileDestinationPath = Path.Combine(configBaseNode, ConfigurationConsts.Profile); string playlistDestinationPath = Path.Combine(configBaseNode, ConfigurationConsts.PlayList); configurationNode.RemoveFile(profileDestinationPath); configurationNode.RemoveFile(playlistDestinationPath); configurationNode.CreateFile(profileDestinationPath, profile.ProfileStream); configurationNode.CreateFile(playlistDestinationPath, profile.PlaylistStream); string ptfConfigsDestinationDir = GetPtfConfigBasePath(request.ConfigurationId, configurationNode.AbsolutePath); profile.SavePtfCfgTo(ptfConfigsDestinationDir); } }