/// <summary> /// Initializes a new instance of the <see cref="Connection"/> class. /// </summary> /// <param name="url">The url to connect to.</param> /// <param name="queryString">The query string data to pass to the server.</param> public Connection(string url, string queryString) { if (url == null) { throw new ArgumentNullException("url"); } if (url.Contains("?")) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.Error_UrlCantContainQueryStringDirectly), "url"); } if (!url.EndsWith("/", StringComparison.Ordinal)) { url += "/"; } Url = url; QueryString = queryString; _disconnectTimeoutOperation = DisposableAction.Empty; Items = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); State = ConnectionState.Disconnected; TraceLevel = TraceLevels.All; TraceWriter = new DebugTextWriter(); Headers = new HeaderDictionary(this); }
/// <summary> /// Initializes a new instance of the <see cref="Connection"/> class. /// </summary> /// <param name="url">The url to connect to.</param> /// <param name="queryString">The query string data to pass to the server.</param> public Connection(string url, string queryString) { if (url == null) { throw new ArgumentNullException("url"); } if (url.Contains("?")) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.Error_UrlCantContainQueryStringDirectly), "url"); } if (!url.EndsWith("/", StringComparison.Ordinal)) { url += "/"; } Url = url; QueryString = queryString; _disconnectTimeoutOperation = DisposableAction.Empty; _lastMessageAt = DateTime.UtcNow; _lastActiveAt = DateTime.UtcNow; _reconnectWindow = TimeSpan.Zero; Items = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); State = ConnectionState.Disconnected; TraceLevel = TraceLevels.All; TraceWriter = new DebugTextWriter(); Headers = new HeaderDictionary(this); TransportConnectTimeout = TimeSpan.Zero; _totalTransportConnectTimeout = TimeSpan.Zero; // Current client protocol Protocol = new Version(1, 4); }
partial void OnCreated() { #if DEBUG // write log to Debug output Log = new DebugTextWriter(); #endif }
static void Main(string[] args) { var console = Console.Out; Tracer.LinePart(""); Console.SetOut(console); DebugTextWriter.Register(false); RemotingConfiguration.RegisterWellKnownServiceType (typeof(ManageModsAndSavefiles), "", WellKnownObjectMode.Singleton); using (var server = new FileBasedServer("Mmasf")) { var instance = new ManageModsAndSavefiles { FactorioInformation = "FactorioInformation Test", UserConfigurations = new[] { new UserConfiguration { Path = "Test path" } } }; server.Register(instance); "(Server)Press any key:".WriteLine(); var k = Console.ReadKey(); } }
/// <summary> /// Initializes a new instance of the <see cref="Connection" /> class. /// </summary> /// <param name="url">The url to connect to.</param> /// <param name="queryString">The query string data to pass to the server.</param> public Connection(string url, string queryString) { if (url == null) { throw new ArgumentNullException("url"); } if (url.Contains("?")) { throw new ArgumentException( "Url cannot contain QueryString directly. Pass QueryString values in using available overload.", "url"); } if (!url.EndsWith("/", StringComparison.Ordinal)) { url += "/"; } Url = url; QueryString = queryString; Groups = new List <string>(); Items = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); State = ConnectionState.Disconnected; TraceWriter = new DebugTextWriter(); Headers = new HeaderDictionary(this); }
public static ApplicationDbContext Create() { ApplicationDbContext Db = new ApplicationDbContext(); //Feature to catch queries from Entity. #if DEBUG Db.Database.Log = s => DebugTextWriter.Write("EFApp", s); #endif return(Db); }
public void TestAutoPartialQuery() { var debugTextWriter = new DebugTextWriter(); var context = new Agp2pDataContext { Log = debugTextWriter }; var users = context.dt_users.AsEnumerableAutoPartialQuery().Skip(1000).ToList(); Debug.WriteLine("Query count: " + debugTextWriter.writeCount); Debug.WriteLine("Entities count: " + users.Count); }
/// <summary> /// Collect Arguments /// </summary> /// <param name="args">The arguments</param> /// <param name="logLevel">Output: The LogLevel from the arguments</param> /// <param name="logWriter">Output: The Log Writer from the arguments</param> static void GetArguments(String[] args, out ServerLogLevel logLevel, out TextWriter logWriter) { logLevel = ServerLogLevel.Lifecycle; logWriter = null; try { if (args != null && args.Length != 0) {//Standard output try { // args[0] : Trace level logLevel = (ServerLogLevel)Int32.Parse(args[0]); if (!System.Enum.IsDefined(typeof(ServerLogLevel), (Int32)logLevel)) { ; } { logLevel = ServerLogLevel.Protocol; } } catch (Exception e) { System.Console.Error.WriteLine(e.Message); } if (args.Length > 1) { // Open log file // args[1] : Log file name string logFile = args[1]; try { StreamWriter sw = new StreamWriter(logFile); sw.AutoFlush = true; logWriter = sw; } catch (Exception e) { System.Console.Error.WriteLine(e.Message); } } } } finally { if (logWriter == null) { logWriter = new DebugTextWriter(); } } }
static void Main(string[] args) { var console = Console.Out; Tracer.LinePart(""); Console.SetOut(console); DebugTextWriter.Register(false); 1.Seconds().Sleep(); var client = new FileBasedClient("Mmasf"); var data = client.Get <ManageModsAndSavefiles>(); "Response to FactorioInformation: ".WriteLine(); data.FactorioInformation.WriteLine(); "Response to TestFunction: ".WriteLine(); data.UserConfigurations[0].Path.WriteLine(); "(End)Press any key:".WriteLine(); var k = Console.ReadKey(); }
public async Task Start() { _hubConnection = new HubConnection("http://192.168.1.155/CodevelopService"); //_hubConnection = new HubConnection(@"http://smartsolar.azurewebsites.net"); var writer = new DebugTextWriter(); _hubConnection.TraceLevel = TraceLevels.All; _hubConnection.TraceWriter = writer; _hubConnection.Error += _hubConnection_Error; _hubConnection.StateChanged += _hubConnection_StateChanged; // set up backchannel _hubProxy = _hubConnection.CreateHubProxy("DeviceFeed"); _hubProxy.On <string>("hello", message => LogMessage(message) ); LogMessage("Starting"); await _hubConnection.Start(); }
public void OnLoad(ISsmsExtendedFunctionalityProvider provider) { _provider4 = (ISsmsFunctionalityProvider4)provider; _Dte2 = _provider4.SsmsDte2 as DTE2; ISsmsExtendedFunctionalityProvider a; if (_provider4 == null) { throw new ArgumentException(); } var debugWriter = new DebugTextWriter(); Console.SetOut(debugWriter); try { LoadCommandPlugins(); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
/// <summary> /// Initializes a new instance of the <see cref="Connection"/> class. /// </summary> /// <param name="url">The url to connect to.</param> /// <param name="queryString">The query string data to pass to the server.</param> public Connection(string url, string queryString) { if (url == null) { throw new ArgumentNullException("url"); } if (url.Contains("?")) { throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, Resources.Error_UrlCantContainQueryStringDirectly), "url"); } if (!url.EndsWith("/", StringComparison.Ordinal)) { url += "/"; } Url = url; QueryString = queryString; _disconnectTimeoutOperation = DisposableAction.Empty; _connectingMessageBuffer = new ConnectingMessageBuffer(this, OnMessageReceived); Items = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); State = ConnectionState.Disconnected; TraceLevel = TraceLevels.All; TraceWriter = new DebugTextWriter(); Headers = new HeaderDictionary(this); TransportConnectTimeout = TimeSpan.Zero; // Current client protocol Protocol = new Version(1, 3); }
// Update is called once per frame void FixedUpdate() { DebugTextWriter.ReflectionText(); }
// Use this for initialization void Start() { DebugTextWriter.SetTextArea(textArea); }
static int Main(string[] args) { bool help = false; bool version = false; var p = new OptionSet() { "USAGE", " " + ProgName + " [OPTIONS]", "", "VERSION:", " " + Version, "", "DESCRIPTION:", " Run the Language Server Robot.", { "l|loglevel=", "Logging level (1=Lifecycle, 2=Message, 3=Protocol).", (string v) => { if (v != null) { try { // args[0] : Trace level LogLevel = (ServerLogLevel)Int32.Parse(v); if (!System.Enum.IsDefined(typeof(ServerLogLevel), (Int32)LogLevel)) { LogLevel = ServerLogLevel.Protocol; } } catch (Exception e) { System.Console.Error.WriteLine(e.Message); } } } }, { "v|version", "Show version", _ => version = true }, { "h|help", "Show help", _ => help = true }, { "lf|logfile=", "{PATH} the target log file", (string v) => LogFile = v }, { "nologs", "No log message notifications", _ => NoLogsMessageNotification = true }, { "r|robot", "Robot Client mode.", _ => LsrMode = true }, { "lsr=", "{PATH} the lsr path", (string v) => LsrPath = v }, { "s|script=", "{PATH} script path in lsr", (string v) => LsrScript = v }, { "td|timerdisabled", "Disable the delay that handle the automatic launch of Node Phase analyze", _ => TimerDisabledOption = true }, { "ro|roptions=", "LSR options", (string v) => LsrOptions = v + " " }, { "tsource", "Source document testing mode.", _ => LsrSourceTesting = true }, { "tscanner", "Scanner testing mode.", _ => LsrScannerTesting = true }, { "tpreprocess", "Preprocessing testing mode.", _ => LsrPreprocessTesting = true }, { "tparser", "parsing testing mode.", _ => LsrParserTesting = true }, { "tsemantic", "Semantic analysis testing mode.", _ => LsrSemanticTesting = true }, { "antlrp", "Use ANTLR to parse a Program.", _ => UseAntlrProgramParsing = true }, }; System.Collections.Generic.List <string> arguments; try { arguments = p.Parse(args); } catch (OptionException ex) { return(exit(1, ex.Message)); } if (help) { p.WriteOptionDescriptions(System.Console.Out); return(0); } if (version) { System.Console.WriteLine(Version); return(0); } TextWriter logWriter = null; if (LogFile != null) { try { StreamWriter sw = new StreamWriter(LogFile); sw.AutoFlush = true; logWriter = sw; } catch (Exception e) { if (!LsrMode) { System.Console.Error.WriteLine(e.Message); } } } if (logWriter == null) { logWriter = new DebugTextWriter(); } if (LsrMode && LsrPath != null && LsrScript != null) { if (!StartLsr(LsrPath, (LsrOptions ?? "") + "-ioc -c -script=" + LsrScript)) { System.Console.Error.WriteLine("Fail to run LSR process"); return(-1); } } //Run this server try { //Queue storing messages coming from client, this queue is read by readingThread MessagesActionQueue = new Queue <MessageActionWrapper>(); // Configure the protocols stack var httpServer = new StdioHttpServer(Encoding.UTF8, LogLevel, logWriter, MessagesActionQueue); httpServer.IsLsrTdMode = TimerDisabledOption; if (Process != null) { httpServer.RedirectedInputStream = Process.StandardOutput.BaseStream; httpServer.RedirectedOutpuStream = Process.StandardInput; } var jsonRPCServer = new JsonRPCServer(httpServer); var typeCobolServer = new TypeCobolServer(jsonRPCServer, MessagesActionQueue); typeCobolServer.NoLogsMessageNotification = NoLogsMessageNotification; typeCobolServer.LsrSourceTesting = LsrSourceTesting; typeCobolServer.LsrScannerTesting = LsrScannerTesting; typeCobolServer.LsrPreprocessTesting = LsrPreprocessTesting; typeCobolServer.LsrParserTesting = LsrParserTesting; typeCobolServer.LsrSemanticTesting = LsrSemanticTesting; typeCobolServer.TimerDisabledOption = TimerDisabledOption; typeCobolServer.UseAntlrProgramParsing = UseAntlrProgramParsing; //Creating the thread that will read mesages and handle them var backgroundExecutionThread = new Thread(() => { MessageHandler(jsonRPCServer, typeCobolServer); }) { IsBackground = true }; backgroundExecutionThread.Start(); // Start listening to incoming request (block, infinite loop) httpServer.StartReceivingMessagesFor(jsonRPCServer); } finally { if (logWriter != System.Console.Error) { logWriter.Close(); } } return(0); }
partial void OnCreated() { // write log to Debug output Log = new DebugTextWriter(); }
/// <summary> /// Initializes a new instance of the <see cref="Connection" /> class. /// </summary> /// <param name="url">The url to connect to.</param> /// <param name="queryString">The query string data to pass to the server.</param> public Connection(string url, string queryString) { if (url == null) { throw new ArgumentNullException("url"); } if (url.Contains("?")) { throw new ArgumentException( "Url cannot contain QueryString directly. Pass QueryString values in using available overload.", "url"); } if (!url.EndsWith("/", StringComparison.Ordinal)) { url += "/"; } Url = url; QueryString = queryString; Groups = new List<string>(); Items = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase); State = ConnectionState.Disconnected; TraceWriter = new DebugTextWriter(); Headers = new HeaderDictionary(this); }