本文整理汇总了C#中OutputWindowPane.OutputString方法的典型用法代码示例。如果您正苦于以下问题:C# OutputWindowPane.OutputString方法的具体用法?C# OutputWindowPane.OutputString怎么用?C# OutputWindowPane.OutputString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputWindowPane
的用法示例。
在下文中一共展示了OutputWindowPane.OutputString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConnection
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
/// <param name="application">Root object of the host application.</param>
/// <param name='connectMode'>Describes how the Add-in is being loaded.</param>
/// <param name='addInInst'>Object representing this Add-in.</param>
/// <param name='custom'>Array of parameters that are host application specific.</param>
/// <seealso class='IDTExtensibility2' />
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
_outputWindowPane = _applicationObject.ToolWindows.OutputWindow.OutputWindowPanes.Add("SmartBackspace");
_outputWindowPane.OutputString("SmartBackspace loaded" + Environment.NewLine);
_textDocumentKeyPressEvents = ((Events2)_applicationObject.Events).get_TextDocumentKeyPressEvents(null);
_textDocumentKeyPressEvents.BeforeKeyPress += _OnTextDocumentBeforeKeyPress;
}
示例2: WebServer
/// <summary>
/// Constructs the WebServer, starts the web server process.
/// </summary>
/// <param name="outputWindowPane">Existing output pane to send web server output to.</param>
/// <param name="properties">PropertyManager that is set to a valid project/platform.</param>
public WebServer(OutputWindowPane outputWindowPane, PropertyManager properties)
{
if (outputWindowPane == null)
{
throw new ArgumentNullException("outputWindowPane");
}
if (properties == null)
{
throw new ArgumentNullException("properties");
}
webServerOutputPane_ = outputWindowPane;
// Read port from properties, if invalid port then set to default value.
int webServerPort;
if (!int.TryParse(properties.WebServerPort, out webServerPort))
{
webServerPort = DefaultWebServerPort;
}
string webServerExecutable = "python.exe";
string httpd = Path.Combine(properties.SDKRootDirectory, "examples", "httpd.py");
if (!File.Exists(httpd))
httpd = Path.Combine(properties.SDKRootDirectory, "tools", "httpd.py");
string webServerArguments = httpd + " --no_dir_check " + webServerPort;
webServerOutputPane_.Clear();
webServerOutputPane_.OutputString(Strings.WebServerStartMessage + "\n");
webServerOutputPane_.Activate();
// Start the web server process.
try
{
webServer_ = new System.Diagnostics.Process();
webServer_.StartInfo.CreateNoWindow = true;
webServer_.StartInfo.UseShellExecute = false;
webServer_.StartInfo.RedirectStandardOutput = true;
webServer_.StartInfo.RedirectStandardError = true;
webServer_.StartInfo.FileName = webServerExecutable;
webServer_.StartInfo.Arguments = webServerArguments;
webServer_.StartInfo.WorkingDirectory = properties.ProjectDirectory;
webServer_.OutputDataReceived += WebServerMessageReceive;
webServer_.ErrorDataReceived += WebServerMessageReceive;
webServer_.Start();
webServer_.BeginOutputReadLine();
webServer_.BeginErrorReadLine();
}
catch (Exception e)
{
webServerOutputPane_.OutputString(Strings.WebServerStartFail + "\n");
webServerOutputPane_.OutputString("Exception: " + e.Message + "\n");
}
}
示例3: OnCommand
public void OnCommand(DTE2 application, OutputWindowPane pane)
{
// Check if we've selected stuff in the solution explorer and we currently have this as the active window.
if ("Tool" == application.ActiveWindow.Kind && application.ActiveWindow.Caption.StartsWith("Solution Explorer"))
{
int checkoutItems = 0;
foreach (SelectedItem sel in application.SelectedItems)
{
if (null != sel.ProjectItem)
{
if (P4EditItem.EditItem(sel.ProjectItem, pane))
checkoutItems++;
}
if (null != sel.Project)
{
if (P4EditItem.EditProject(sel.Project, pane))
checkoutItems++;
}
}
if (checkoutItems > 0)
return;
}
// Finally, let's just see if the text editor is active
if ("Document" == application.ActiveWindow.Kind && application.ActiveDocument != null)
{
string fullName = application.ActiveDocument.FullName;
if( !application.ActiveDocument.ReadOnly )
{
pane.OutputString( fullName + " is already opened for edit (is writeable on disk at least)\n" );
}
else
{
P4Operations.EditFile(pane, fullName);
}
}
}
示例4: UpdateStatus
/// <summary>
/// Updates the statusbar and output window with the same message
/// </summary>
/// <param name="output">The output pane</param>
/// <param name="status">The status bar</param>
/// <param name="text">The message to send to both</param>
private void UpdateStatus(OutputWindowPane output, StatusBar status, string text)
{
status.Text = text;
output.OutputString(text + "\r\n");
}
示例5: ProcessTest
void ProcessTest(OutputWindowPane pane)
{
string paneText;
var success = _threading.BeginInvokeAndWait("Reading pane",()=> ReadTest(pane), out paneText, _unloading);
if (!success) return;
if (paneText == null || paneText.Length <= PluginManager.RESHARPER_TEST.Length) return;
var methodName = paneText.Substring(PluginManager.RESHARPER_TEST.Length);
pane.Clear();
Debug.WriteLine("Running test " + methodName);
var runner = new ResharperTests(pane, _threading, _actionManager, _saManager, _solution);
var result = typeof(ResharperTests).GetMethod(methodName).Invoke(runner, new object[0]);
var msg = string.Format("!ReSharper{0}:{1}\r\n", methodName, result);
_output.Write(msg);
pane.OutputString(msg);
}
示例6: WriteLineToPane
private void WriteLineToPane(OutputWindowPane pane, string text)
{
pane.OutputString(text + Environment.NewLine);
}
示例7: DBUpdate
/// <summary>
/// Updates the DBML information
/// </summary>
/// <param name="output">The output window to report status</param>
public void DBUpdate(OutputWindowPane output)
{
using(SqlConnection conn = new SqlConnection(_connStr))
{
conn.Open();
foreach(DBMLTable t in _tables)
{
output.OutputString(string.Format("Getting Table {0} information...\r\n", t.Name));
t.DBUpdate(conn);
}
}
}
示例8: CreateDBML
/// <summary>
/// Creates a new DBML file with the updates
/// </summary>
public void CreateDBML(string fileName, OutputWindowPane output)
{
_newDoc = new XmlDocument();
XmlDeclaration dec = _newDoc.CreateXmlDeclaration("1.0", "utf-8", null);
_newDoc.AppendChild(dec);
XmlNode den = _newDoc.ImportNode(_doc.DocumentElement, false);
_newDoc.AppendChild(den);
bool doneTables = false;
foreach(XmlNode n in _doc.DocumentElement.ChildNodes)
{
XmlElement e = n as XmlElement;
if(e != null && e.Name == "Table")
{
if(!doneTables)
{
foreach(DBMLTable t in _tables)
{
output.OutputString(string.Format("Adding table {0}...\r\n", t.Name));
den.AppendChild(t.CreateDBML(this));
}
doneTables = true;
}
continue;
}
XmlNode un = _newDoc.ImportNode(n, true);
den.AppendChild(un);
}
output.OutputString(string.Format("Writing file \"{0}\"...\r\n", fileName));
_newDoc.Save(fileName);
}
示例9: ExecStmt2
//one of the test methods for debugging, running against
//sqlcmd - due to bug in S2K5, where we hang wen executing
//this method causes hang as well
bool ExecStmt2(string cmdText)
{
OutputWindow ow = _app.ToolWindows.OutputWindow;
ow.Parent.Activate();
try {
owp = ow.OutputWindowPanes.Item("Debug");
}
catch {
owp = ow.OutputWindowPanes.Add("Debug");
}
try {
_app.StatusBar.Text = "Debug started";
ow.Parent.Activate();
owp.Activate();
string buildPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
buildPath = Path.Combine(buildPath, "MSBUILD.exe");
owp.OutputString("Debug Started\n");
System.Diagnostics.Process p = new System.Diagnostics.Process();
string sqlFile = "";
//sqlcmd -d test2 -Q "select dbo.MyAdder99
sqlFile = Path.Combine(ProjectPath, "sql.proj");
//string paramString = string.Format("\"{0}\" /t:ExecDebug /p:CmdText=\"{1}\"", sqlFile, cmdText);
//p.StartInfo = new ProcessStartInfo("cmd.exe", "/k " + buildPath + " \"" + sqlFile + "\" /t:ExecDebug /p:CmdText=\"" + cmdText + "\"");
p.StartInfo = new ProcessStartInfo("sqlcmd.exe", "-d test2 -Q \"" + cmdText + "\"");
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardOutput = true;
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
p.Start();
p.BeginOutputReadLine();
//owp.OutputString(p.StandardOutput.ReadToEnd());
p.WaitForExit();
owp.Activate();
string statusMsg = "succeeded";
if (p.ExitCode != 0)
statusMsg = "failed";
_app.StatusBar.Text = string.Format("Debug {0}", statusMsg);
ow.Parent.Activate();
//ow.Parent.AutoHides = true;
return true;
}
catch (Exception e) {
_app.StatusBar.Text = "Debug failed";
string msg = string.Format("An unexpected exception occured.\n\nThe exception is: {0}", e.Message);
owp.OutputString(msg);
return false;
}
finally {
}
}
示例10: AddReferenceToProject
private void AddReferenceToProject(
Project targetProject,
string referencePath,
OutputWindowPane activePane)
{
dynamic javaProject = targetProject.Object;
// Visual update
dynamic jarReference = Activator.CreateInstance(
"Tvl.VisualStudio.Language.Java",
"Tvl.VisualStudio.Language.Java.Project.JarReferenceNode",
false,
0,
null,
new Object[2] { javaProject, referencePath },
null,
null).Unwrap();
dynamic referenceContainer = javaProject.GetReferenceContainer();
referenceContainer.AddChild(jarReference);
// File update
Microsoft.Build.Evaluation.Project msBuildProject = javaProject.BuildProject;
var node = msBuildProject.Xml.AddItem("JarReference", referencePath);
node.AddMetadata("IncludeInBuild", "true");
node.AddMetadata("Private", "false");
activePane.OutputString(referencePath + "\n");
}
示例11: ProvisionProject
private void ProvisionProject(DTE2 dte, OutputWindowPane activePane, Project targetProject)
{
string classpathFile = Path.GetDirectoryName(targetProject.FullName) + "\\.classpath";
if (!File.Exists(classpathFile))
{
activePane.Activate();
activePane.OutputString("File not found: .classpath. A provisioning build needs to complete successfully first\n");
return;
}
var doc = new XmlDocument();
doc.Load(classpathFile);
var entries = doc.GetElementsByTagName("classpathentry");
// filter entries by kind = "lib"
for (int i = 0; i < entries.Count; ++i)
{
var node = entries.Item(i);
var path = node.Attributes["path"];
var type = node.Attributes["kind"];
if (path != null)
{
if (type != null && type.Value.Equals("lib"))
{
AddReferenceToProject(targetProject, path.Value.EndsWith(".jar") ? path.Value : path.Value + "/", activePane);
}
}
}
targetProject.Save();
}
示例12: RunCommand
static private bool RunCommand(OutputWindowPane output, string executable, string commandline, string workingdir, int timeout)
{
try
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = executable;
if( 0 == timeout )
{
// We are not for these processes reading the stdout and thus they could if they wrote more
// data on the output line hang.
process.StartInfo.RedirectStandardOutput = false;
process.StartInfo.RedirectStandardError = false;
}
else
{
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
}
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WorkingDirectory = workingdir;
process.StartInfo.Arguments = commandline;
Log.Debug("executableName : " + executable);
Log.Debug("workingDirectory : " + workingdir);
Log.Debug("command : " + commandline);
if(!process.Start())
{
Log.Error("{0}: {1} Failed to start. Is Perforce installed and in the path?\n", executable, commandline);
return false;
}
if (0 == timeout)
{
// Fire and forget task.
return true;
}
bool exited = false;
string alloutput = "";
using (Process.Handler stderr = new Process.Handler(), stdout = new Process.Handler())
{
process.OutputDataReceived += stdout.OnOutput;
process.BeginOutputReadLine();
process.ErrorDataReceived += stderr.OnOutput;
process.BeginErrorReadLine();
exited = process.WaitForExit(timeout);
/*
* This causes the plugin to unexpectedly crash, since it brings the entire thread down, and thus the entire environment?!?
*
if (0 != process.ExitCode)
{
throw new Process.Error("Failed to execute {0} {1}, exit code was {2}", executable, process.StartInfo.Arguments, process.ExitCode);
}*/
stderr.sentinel.WaitOne();
stdout.sentinel.WaitOne();
alloutput = stdout.buffer + "\n" + stderr.buffer;
}
if(!exited)
{
Log.Info("{0}: {1} timed out ({2} ms)", executable, commandline, timeout);
process.Kill();
return false;
}
else
{
if(null != output)
{
output.OutputString(executable + ": " + commandline + "\n");
output.OutputString(alloutput);
}
System.Diagnostics.Debug.WriteLine(commandline + "\n");
System.Diagnostics.Debug.WriteLine(alloutput);
if(0 != process.ExitCode)
{
Log.Debug("{0}: {1} exit code {2}", executable, commandline, process.ExitCode);
return false;
}
}
return true;
}
catch(System.ComponentModel.Win32Exception e)
{
Log.Error("{0}: {1} failed to spawn: {2}", executable, commandline, e.ToString());
return false;
}
}
开发者ID:transformersprimeabcxyz,项目名称:_To-Do-unreal-3D-niftyplugins-ben-marsh,代码行数:97,代码来源:AsyncProcess.cs
示例13: SetupOutputWindow
private void SetupOutputWindow(DTE2 applicationObject)
{
window = applicationObject.Windows.Item(Constants.vsWindowKindOutput);
outputWindow = (OutputWindow)window.Object;
owp = outputWindow.OutputWindowPanes.Add("new pane");
owp.OutputString("hello\n");
}
示例14: StartNet
private static System.Diagnostics.Process StartNet(DTE2 dte, OutputWindowPane outputWindowPane)
{
Project startupProject = dte.Solution.Item(((object[])dte.Solution.SolutionBuild.StartupProjects)[0]);
Property startArguments = GetProperty(startupProject.ConfigurationManager.ActiveConfiguration.Properties,
"StartArguments");
string fileName = GetProgramFileName(startupProject);
string arguments = (string)startArguments.Value;
outputWindowPane.OutputString(string.Format("MonoHelper: Running {0} {1}\r\n", fileName, arguments));
System.Diagnostics.Process process = new System.Diagnostics.Process
{
StartInfo =
new ProcessStartInfo
{
FileName = string.Format(@"{0}", fileName),
Arguments = string.Format(@"{0}", arguments),
UseShellExecute = true,
WorkingDirectory = Path.GetDirectoryName(fileName)
}
};
process.Start();
return process;
}
示例15: GenerateDebugSymbols
private static void GenerateDebugSymbols(string absoluteOutputPath, OutputWindowPane outputWindowPane)
{
FileInfo[] files = (new DirectoryInfo(absoluteOutputPath)).GetFiles();
foreach (FileInfo file in files)
{
if (file.Name.EndsWith(".dll") || file.Name.EndsWith(".exe"))
{
if (files.Any(x => x.Name.EndsWith(".mdb") && x.Name.Substring(0, x.Name.Length - 4) == file.Name))
{
outputWindowPane.OutputString(string.Format("MonoHelper: Assembly {0}\r\n", file.Name));
string assemblyPath = file.FullName;
AssemblyDefinition assemblyDefinition = AssemblyDefinition.ReadAssembly(assemblyPath,
new ReaderParameters { SymbolReaderProvider = new MdbReaderProvider(), ReadSymbols = true });
CustomAttribute debuggableAttribute =
new CustomAttribute(
assemblyDefinition.MainModule.Import(
typeof(DebuggableAttribute).GetConstructor(new[] { typeof(DebuggableAttribute.DebuggingModes) })));
debuggableAttribute.ConstructorArguments.Add(
new CustomAttributeArgument(assemblyDefinition.MainModule.Import(typeof(DebuggableAttribute.DebuggingModes)),
DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints |
DebuggableAttribute.DebuggingModes.EnableEditAndContinue |
DebuggableAttribute.DebuggingModes.DisableOptimizations));
if (assemblyDefinition.CustomAttributes.Any(x => x.AttributeType.Name == typeof(DebuggableAttribute).Name))
{
// Replace existing attribute
int indexOf =
assemblyDefinition.CustomAttributes.IndexOf(
assemblyDefinition.CustomAttributes.Single(x => x.AttributeType.Name == typeof(DebuggableAttribute).Name));
assemblyDefinition.CustomAttributes[indexOf] = debuggableAttribute;
}
else
{
assemblyDefinition.CustomAttributes.Add(debuggableAttribute);
}
assemblyDefinition.Write(assemblyPath,
new WriterParameters { SymbolWriterProvider = new PdbWriterProvider(), WriteSymbols = true });
}
}
}
}