public void TestThatFilePathForResourceIsValid() { var path = ConDepResourceFiles.GetFilePath(Assembly.GetExecutingAssembly(), GetType().Namespace, "ResourceTestFile.txt"); Assert.That(File.Exists(path)); File.Delete(path); }
private string ExtractPowerShellFileFromResource(Assembly assembly, string localTargetPath, string resource) { var regex = new Regex(@".+\.(.+\.ps1)"); var match = regex.Match(resource); if (match.Success) { var resourceName = match.Groups[1].Value; if (!string.IsNullOrWhiteSpace(resourceName)) { var resourceNamespace = resource.Replace("." + resourceName, ""); return(ConDepResourceFiles.GetFilePath(assembly, resourceNamespace, resourceName, localTargetPath, true)); } } return(null); }
private string GetFilePathForConDepScriptModule(string resource) { var regex = new Regex(@".+\.(.+\.(ps1|psm1))"); var match = regex.Match(resource); if (match.Success) { var resourceName = match.Groups[1].Value; if (!string.IsNullOrWhiteSpace(resourceName)) { var resourceNamespace = resource.Replace("." + resourceName, ""); return(ConDepResourceFiles.GetFilePath(GetType().Assembly, resourceNamespace, resourceName, keepOriginalFileName: true)); } } return(null); }
private void SaveConDepScriptModuleResourceToFolder(string localTargetPath) { var resource = ConDepResources.ConDepModule; var regex = new Regex(@".+\.(.+\.(ps1|psm1))"); var match = regex.Match(resource); if (match.Success) { var resourceName = match.Groups[1].Value; if (!string.IsNullOrWhiteSpace(resourceName)) { var resourceNamespace = resource.Replace("." + resourceName, ""); ConDepResourceFiles.GetFilePath(GetType().Assembly, resourceNamespace, resourceName, localTargetPath, true); } } }