| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 namespace NativeClientVSAddIn | 5 namespace NativeClientVSAddIn |
| 6 { | 6 { |
| 7 using System; | 7 using System; |
| 8 | 8 using System.IO; |
| 9 using EnvDTE; | 9 using EnvDTE; |
| 10 using Microsoft.VisualStudio.VCProjectEngine; | 10 using Microsoft.VisualStudio.VCProjectEngine; |
| 11 | 11 |
| 12 /// <summary> | 12 /// <summary> |
| 13 /// This class contains the functionality related to the web server which host
s the web page | 13 /// This class contains the functionality related to the web server which host
s the web page |
| 14 /// during debugging. | 14 /// during debugging. |
| 15 /// </summary> | 15 /// </summary> |
| 16 public class WebServer : IDisposable | 16 public class WebServer : IDisposable |
| 17 { | 17 { |
| 18 /// <summary> | 18 /// <summary> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 webServerOutputPane_ = outputWindowPane; | 55 webServerOutputPane_ = outputWindowPane; |
| 56 | 56 |
| 57 // Read port from properties, if invalid port then set to default value. | 57 // Read port from properties, if invalid port then set to default value. |
| 58 int webServerPort; | 58 int webServerPort; |
| 59 if (!int.TryParse(properties.WebServerPort, out webServerPort)) | 59 if (!int.TryParse(properties.WebServerPort, out webServerPort)) |
| 60 { | 60 { |
| 61 webServerPort = DefaultWebServerPort; | 61 webServerPort = DefaultWebServerPort; |
| 62 } | 62 } |
| 63 | 63 |
| 64 string webServerExecutable = "python.exe"; | 64 string webServerExecutable = "python.exe"; |
| 65 string webServerArguments = string.Format( | 65 string httpd = Path.Combine(properties.SDKRootDirectory, "examples", "http
d.py"); |
| 66 "{0}\\examples\\httpd.py --no_dir_check {1}", properties.SDKRootDirect
ory, webServerPort); | 66 if (!File.Exists(httpd)) |
| 67 httpd = Path.Combine(properties.SDKRootDirectory, "tools", "httpd.py")
; |
| 68 string webServerArguments = httpd + " --no_dir_check " + webServerPort; |
| 67 | 69 |
| 68 // Start the web server process. | 70 // Start the web server process. |
| 69 try | 71 try |
| 70 { | 72 { |
| 71 webServer_ = new System.Diagnostics.Process(); | 73 webServer_ = new System.Diagnostics.Process(); |
| 72 webServer_.StartInfo.CreateNoWindow = true; | 74 webServer_.StartInfo.CreateNoWindow = true; |
| 73 webServer_.StartInfo.UseShellExecute = false; | 75 webServer_.StartInfo.UseShellExecute = false; |
| 74 webServer_.StartInfo.RedirectStandardOutput = true; | 76 webServer_.StartInfo.RedirectStandardOutput = true; |
| 75 webServer_.StartInfo.RedirectStandardError = true; | 77 webServer_.StartInfo.RedirectStandardError = true; |
| 76 webServer_.StartInfo.FileName = webServerExecutable; | 78 webServer_.StartInfo.FileName = webServerExecutable; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 /// Receives output from the web server process to display in the Visual Stu
dio UI. | 135 /// Receives output from the web server process to display in the Visual Stu
dio UI. |
| 134 /// </summary> | 136 /// </summary> |
| 135 /// <param name="sender">The parameter is not used.</param> | 137 /// <param name="sender">The parameter is not used.</param> |
| 136 /// <param name="e">Contains the data to display.</param> | 138 /// <param name="e">Contains the data to display.</param> |
| 137 private void WebServerMessageReceive(object sender, System.Diagnostics.DataR
eceivedEventArgs e) | 139 private void WebServerMessageReceive(object sender, System.Diagnostics.DataR
eceivedEventArgs e) |
| 138 { | 140 { |
| 139 webServerOutputPane_.OutputString(e.Data + "\n"); | 141 webServerOutputPane_.OutputString(e.Data + "\n"); |
| 140 } | 142 } |
| 141 } | 143 } |
| 142 } | 144 } |
| OLD | NEW |