本文整理汇总了C#中Resource.getPath方法的典型用法代码示例。如果您正苦于以下问题:C# Resource.getPath方法的具体用法?C# Resource.getPath怎么用?C# Resource.getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource.getPath方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createInputStream
public InputStream createInputStream(Resource resource)
{
var fullyQualifiedTypeName = this.ConvertPathToNamespace(resource.getPath());
if (canFind(resource))
{
var manifestResourceStream = this.FixtureAssembly.GetManifestResourceStream(fullyQualifiedTypeName);
return new InputStreamWrapper(manifestResourceStream);
}
throw new InvalidOperationException(string.Format("Cannot open the resource {0}", fullyQualifiedTypeName));
}
示例2: ExistingFilePath
private string ExistingFilePath(Resource resource)
{
var resourcePath = resource.getPath().Replace("/", "\\");
if (resourcePath.StartsWith("\\"))
{
resourcePath = resourcePath.Substring(1);
}
var filePath = Path.Combine(BaseDirectory, resourcePath);
if (File.Exists(filePath))
{
return filePath;
}
filePath = Path.Combine(BaseDirectory,
this.RemoveFirst(resourcePath, FixtureAssembly.GetName().Name.Replace('.', PathSeparator) + PathSeparator));
if (File.Exists(filePath))
{
return filePath;
}
return null;
}
示例3: createInputStream
public InputStream createInputStream(Resource resource)
{
Check.isTrue(canFind(resource), "No such resource exists in simulator: " + resource.getPath());
return new ByteArrayInputStream(Encoding.UTF8.GetBytes(this.resources[resource]));
}
示例4: GetWrittenString
public string GetWrittenString(Resource resource)
{
Check.isTrue(this.writtenStrings.ContainsKey(resource), "Expected resource '" + resource.getPath() + "' was not written to target");
return this.writtenStrings[resource];
}
示例5: canFind
public bool canFind(Resource resource)
{
var fullyQualifiedTypeName = this.ConvertPathToNamespace(resource.getPath());
return this.FixtureAssembly.GetManifestResourceInfo(fullyQualifiedTypeName) != null;
}
示例6: GetTargetPath
private string GetTargetPath(Resource resource)
{
return Path.Combine(this.BaseDirectory, RelavitePath(resource.getPath()));
}
示例7: delete
public void delete(Resource resource)
{
Check.notNull(resource, "resource is null");
File.Delete(this.BaseDirectory + resource.getPath());
}