本文整理汇总了C#中System.CodeDom.Compiler.TempFileCollection类的典型用法代码示例。如果您正苦于以下问题:C# TempFileCollection类的具体用法?C# TempFileCollection怎么用?C# TempFileCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TempFileCollection类属于System.CodeDom.Compiler命名空间,在下文中一共展示了TempFileCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ManagedProjectReference
public ManagedProjectReference(XmlElement xmlDefinition, ReferencesResolver referencesResolver, ProjectBase parent, SolutionBase solution, TempFileCollection tfc, GacCache gacCache, DirectoryInfo outputDir)
: base(referencesResolver, parent)
{
if (xmlDefinition == null) {
throw new ArgumentNullException("xmlDefinition");
}
if (solution == null) {
throw new ArgumentNullException("solution");
}
if (tfc == null) {
throw new ArgumentNullException("tfc");
}
if (gacCache == null) {
throw new ArgumentNullException("gacCache");
}
XmlAttribute privateAttribute = xmlDefinition.Attributes["Private"];
if (privateAttribute != null) {
_isPrivateSpecified = true;
_isPrivate = bool.Parse(privateAttribute.Value);
}
// determine path of project file
string projectFile = solution.GetProjectFileFromGuid(
xmlDefinition.GetAttribute("Project"));
// load referenced project
_project = LoadProject(solution, tfc, gacCache, outputDir, projectFile);
}
开发者ID:smaclell,项目名称:NAnt,代码行数:29,代码来源:ManagedProjectReference.cs
示例2: ExecWaitWithCapture
[SecurityPermission (SecurityAction.Assert, ControlPrincipal = true)] // UnmanagedCode "covers" more than ControlPrincipal
public static Int32 ExecWaitWithCapture (IntPtr userToken, string cmd, string currentDir, TempFileCollection tempFiles, ref string outputName, ref string errorName)
{
// WindowsImpersonationContext implements IDisposable only in 2.0
using (WindowsImpersonationContext context = WindowsIdentity.Impersonate (userToken)) {
return InternalExecWaitWithCapture (cmd, currentDir, tempFiles, ref outputName, ref errorName);
}
}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:Executor.cs
示例3: Execute
public static string Execute(string strCmd, bool bDropFirstLineOfOutput)
{
string output = "";
string error = "";
TempFileCollection tf = new TempFileCollection();
Executor.ExecWaitWithCapture(strCmd, tf, ref output, ref error);
StreamReader sr = File.OpenText(output);
StringBuilder strBuilder = new StringBuilder();
string strLine = null;
bool bFirstLine = true;
while (null != (strLine = sr.ReadLine()))
{
if ("" != strLine)
{
if (bFirstLine && bDropFirstLineOfOutput)
{
bFirstLine = false;
continue;
}
strBuilder.Append(strLine);
strBuilder.Append("\r\n");
}
}
sr.Close();
File.Delete(output);
File.Delete(error);
return strBuilder.ToString();
}
开发者ID:AlexZeitler,项目名称:SharpDevelop-Servers,代码行数:33,代码来源:SilentCmdLineApplication.cs
示例4: ViewLog
public void ViewLog()
{
TempFileCollection tempFiles = new TempFileCollection();
FileInfo msgFile = new FileInfo(tempFiles.AddExtension("txt"));
File.WriteAllText(msgFile.FullName, Session.Log, Encoding.ASCII);
Process.Start(msgFile.FullName);
}
开发者ID:LiDamon,项目名称:smtp4dev,代码行数:7,代码来源:SessionViewModel.cs
示例5: FileLoggerTest
public void FileLoggerTest()
{
var tfc = new TempFileCollection();
var fileName = tfc.AddExtension("txt");
var logger = LoggerFactory.Instance.GetLogger(LogType.File, fileName);
logger.Log(TEST_LOG);
}
开发者ID:solarplexus6,项目名称:Oop,代码行数:7,代码来源:Zad1Test.cs
示例6: Ctor_Empty
public void Ctor_Empty()
{
var collection = new TempFileCollection();
Assert.Equal(0, collection.Count);
Assert.Empty(collection.TempDir);
Assert.False(collection.KeepFiles);
}
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:TempFileCollectionTests.cs
示例7: FixtureSetUp
public void FixtureSetUp ()
{
// at full trust
temps = new TempFileCollection ();
assembly = Assembly.GetExecutingAssembly ();
path = assembly.Location;
}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:CompilerResultsCas.cs
示例8: Ctor_String
public void Ctor_String(string tempDir)
{
var collection = new TempFileCollection(tempDir);
Assert.Equal(0, collection.Count);
Assert.Equal(tempDir ?? string.Empty, collection.TempDir);
Assert.False(collection.KeepFiles);
}
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:TempFileCollectionTests.cs
示例9: ProjectBase
/// <summary>
/// Initializes a new instance of the <see cref="ProjectBase" /> class.
/// </summary>
protected ProjectBase(XmlElement xmlDefinition, SolutionTask solutionTask, TempFileCollection temporaryFiles, GacCache gacCache, ReferencesResolver referencesResolver, DirectoryInfo outputDir) {
if (xmlDefinition == null) {
throw new ArgumentNullException("xmlDefinition");
}
if (solutionTask == null) {
throw new ArgumentNullException("solutionTask");
}
if (temporaryFiles == null) {
throw new ArgumentNullException("temporaryFiles");
}
if (gacCache == null) {
throw new ArgumentNullException("gacCache");
}
if (referencesResolver == null) {
throw new ArgumentNullException("referencesResolver");
}
_projectConfigurations = new ConfigurationDictionary();
_buildConfigurations = new ConfigurationDictionary();
_extraOutputFiles = CollectionsUtil.CreateCaseInsensitiveHashtable();
// ensure the specified project is actually supported by this project
VerifyProjectXml(xmlDefinition);
_solutionTask = solutionTask;
_temporaryFiles = temporaryFiles;
_outputDir = outputDir;
_gacCache = gacCache;
_refResolver = referencesResolver;
_productVersion = DetermineProductVersion(xmlDefinition);
}
开发者ID:RoastBoy,项目名称:nant,代码行数:34,代码来源:ProjectBase.cs
示例10: Ctor_String_Bool
public void Ctor_String_Bool(string tempDir, bool keepFiles)
{
var collection = new TempFileCollection(tempDir, keepFiles);
Assert.Equal(0, collection.Count);
Assert.Equal(tempDir ?? string.Empty, collection.TempDir);
Assert.Equal(keepFiles, collection.KeepFiles);
}
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:TempFileCollectionTests.cs
示例11: FileSerializeMatchesLength
public void FileSerializeMatchesLength() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension(".txt");
File.WriteAllText(file, "sometext");
var part = MultipartPostPart.CreateFormFilePart("someformname", file, "text/plain");
VerifyLength(part);
}
}
开发者ID:SachiraChin,项目名称:dotnetopenid,代码行数:8,代码来源:MultipartPostPartTests.cs
示例12: Compilador
public Compilador( string directorio, string nombre, string archivoSalida, string archivoError )
{
archivosTemporales = new TempFileCollection();
this.directorio = directorio;
this.nombre = nombre;
this.archivoSalida = archivoSalida;
this.archivoError = archivoError;
}
开发者ID:Erikhht,项目名称:tuassembler,代码行数:8,代码来源:Compilador.cs
示例13: SolutionBase
protected SolutionBase(SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver) : this(tfc, solutionTask) {
if (solutionTask.SolutionFile != null) {
_file = solutionTask.SolutionFile;
} else {
LoadProjectGuids(new ArrayList(solutionTask.Projects.FileNames), false);
LoadProjectGuids(new ArrayList(solutionTask.ReferenceProjects.FileNames), true);
LoadProjects(gacCache, refResolver, CollectionsUtil.CreateCaseInsensitiveHashtable());
}
}
开发者ID:RoastBoy,项目名称:nant,代码行数:9,代码来源:SolutionBase.cs
示例14: MultiPartPostAscii
public void MultiPartPostAscii() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension("txt");
File.WriteAllText(file, "sometext");
this.VerifyFullPost(new List<MultipartPostPart> {
MultipartPostPart.CreateFormPart("a", "b"),
MultipartPostPart.CreateFormFilePart("SomeFormField", file, "text/plain"),
});
}
}
开发者ID:SachiraChin,项目名称:dotnetopenid,代码行数:10,代码来源:MultipartPostPartTests.cs
示例15: MetaData
public void MetaData()
{
string SAVfilename;
using (System.CodeDom.Compiler.TempFileCollection tfc = new System.CodeDom.Compiler.TempFileCollection())
{
SAVfilename = tfc.AddExtension("sav", true);
SpssConvert.ToFile(tblTest, tblTest.Select(), SAVfilename, FillInMetaData);
Console.WriteLine("The file with metadata is stored at: " + SAVfilename);
}
}
开发者ID:WMichta,项目名称:SPSS.NET,代码行数:10,代码来源:SpssConvertTest.cs
示例16: MultiPartPostMultiByteCharacters
public void MultiPartPostMultiByteCharacters() {
using (TempFileCollection tfc = new TempFileCollection()) {
string file = tfc.AddExtension("txt");
File.WriteAllText(file, "\x1020\x818");
this.VerifyFullPost(new List<MultipartPostPart> {
MultipartPostPart.CreateFormPart("a", "\x987"),
MultipartPostPart.CreateFormFilePart("SomeFormField", file, "text/plain"),
});
}
}
开发者ID:SachiraChin,项目名称:dotnetopenid,代码行数:10,代码来源:MultipartPostPartTests.cs
示例17: MSBuildProject
public MSBuildProject(SolutionBase solution, string projectPath, XmlElement xmlDefinition, SolutionTask solutionTask, TempFileCollection tfc, GacCache gacCache, ReferencesResolver refResolver, DirectoryInfo outputDir)
: base(xmlDefinition, solutionTask, tfc, gacCache, refResolver, outputDir)
{
string cfgname = solutionTask.Configuration;
string platform = solutionTask.Platform;
_msbuild = MSBuildEngine.CreateMSEngine(solutionTask);
_msproj = new Microsoft.Build.BuildEngine.Project(_msbuild);
_msproj.FullFileName = projectPath;
_msproj.LoadXml(xmlDefinition.OuterXml);
_msproj.GlobalProperties.SetProperty("Configuration", cfgname);
SetPlatform (platform);
if (outputDir != null) _msproj.GlobalProperties.SetProperty("OutputPath", outputDir.FullName);
//evaluating
_guid = _msproj.GetEvaluatedProperty("ProjectGuid");
_projectDirectory = new DirectoryInfo(_msproj.GetEvaluatedProperty("ProjectDir"));
_projectPath = _msproj.GetEvaluatedProperty("ProjectPath");
ProjectEntry projectEntry = solution.ProjectEntries [_guid];
if (projectEntry != null && projectEntry.BuildConfigurations != null) {
foreach (ConfigurationMapEntry ce in projectEntry.BuildConfigurations) {
Configuration projectConfig = ce.Value;
ProjectConfigurations[projectConfig] = new MSBuildConfiguration(this, _msproj, projectConfig);
}
} else {
Configuration projectConfig = new Configuration (cfgname, platform);
ProjectConfigurations[projectConfig] = new MSBuildConfiguration(this, _msproj, projectConfig);
}
//references
_references = new ArrayList();
Microsoft.Build.BuildEngine.BuildItemGroup refs = _msproj.GetEvaluatedItemsByName("Reference");
foreach (Microsoft.Build.BuildEngine.BuildItem r in refs) {
string rpath = r.FinalItemSpec;
string priv = r.GetMetadata("Private");
string hintpath = r.GetMetadata("HintPath");
ReferenceBase reference = new MSBuildAssemblyReference(
xmlDefinition, ReferencesResolver, this, gacCache,
rpath, priv, hintpath);
_references.Add(reference);
}
refs = _msproj.GetEvaluatedItemsByName("ProjectReference");
foreach (Microsoft.Build.BuildEngine.BuildItem r in refs) {
string pguid = r.GetMetadata("Project");
string pname = r.GetMetadata("Name");
string rpath = r.FinalItemSpec;
string priv = r.GetMetadata("Private");
ReferenceBase reference = new MSBuildProjectReference(
ReferencesResolver, this, solution, tfc, gacCache, outputDir,
pguid, pname, rpath, priv);
_references.Add(reference);
}
}
开发者ID:smaclell,项目名称:NAnt,代码行数:55,代码来源:MSBuildProject.cs
示例18: Constructor1_Deny_Unrestricted
public void Constructor1_Deny_Unrestricted ()
{
TempFileCollection tfc = new TempFileCollection (temp);
Assert.AreEqual (0, tfc.Count, "Count");
Assert.IsFalse (tfc.KeepFiles, "KeepFiles");
Assert.AreEqual (temp, tfc.TempDir, "TempDir");
tfc.AddFile ("main.cs", false);
tfc.CopyTo (array, 0);
tfc.Delete ();
(tfc as IDisposable).Dispose ();
}
开发者ID:Profit0004,项目名称:mono,代码行数:11,代码来源:TempFileCollectionCas.cs
示例19: TestInit
public void TestInit()
{
this.temporaryFiles = new TempFileCollection(this.TestContext.TestRunDirectory, keepFiles: false);
this.serviceProvider = new ConfigurableServiceProvider();
this.fileSystem = new ConfigurableFileSystem();
this.serviceProvider.RegisterService(typeof(IFileSystem), this.fileSystem);
this.testSubject = new RuleSetSerializer(this.serviceProvider);
}
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:11,代码来源:RuleSetSerializerTests.cs
示例20: MSBuildProjectReference
public MSBuildProjectReference(
ReferencesResolver referencesResolver, ProjectBase parent,
SolutionBase solution, TempFileCollection tfc,
GacCache gacCache, DirectoryInfo outputDir,
string pguid, string pname, string rpath, string priv)
: base(referencesResolver, parent) {
_helper = new MSBuildReferenceHelper(priv, true);
string projectFile = solution.GetProjectFileFromGuid(pguid);
_project = LoadProject(solution, tfc, gacCache, outputDir, projectFile);
}
开发者ID:RoastBoy,项目名称:nant,代码行数:11,代码来源:MSBuildProjectReference.cs
注:本文中的System.CodeDom.Compiler.TempFileCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论