本文整理汇总了C#中System.CodeDom.Compiler.TempFileCollection类的典型用法代码示例。如果您正苦于以下问题:C# TempFileCollection类的具体用法?C# TempFileCollection怎么用?C# TempFileCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TempFileCollection类属于System.CodeDom.Compiler命名空间,在下文中一共展示了TempFileCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
}
示例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();
}
示例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);
}
示例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);
}
示例6: Ctor_Empty
public void Ctor_Empty()
{
var collection = new TempFileCollection();
Assert.Equal(0, collection.Count);
Assert.Empty(collection.TempDir);
Assert.False(collection.KeepFiles);
}
示例7: FixtureSetUp
public void FixtureSetUp ()
{
// at full trust
temps = new TempFileCollection ();
assembly = Assembly.GetExecutingAssembly ();
path = assembly.Location;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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());
}
}
示例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"),
});
}
}
示例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);
}
}