...
static void Main(string[] args)
{
%BLOCK_1%
//какой-то код
%BLOCK_2%
Console.ReadKey();
}
...
string code = File.ReadAllText(@"MyCompil.cs");
code =code.Replace("%BLOCK_1%", "string[] arr = new string[]{\"hello\",\"world\"};");
code =code.Replace("%BLOCK_2%", "foreach(var s in arr) Console.WriteLine(s);");
public static string GetRequestPostData(HttpListenerRequest request)
{
if (!request.HasEntityBody)
{
return null;
}
using (System.IO.Stream body = request.InputStream) // here we have data
{
using (var reader = new System.IO.StreamReader(body, request.ContentEncoding))
{
return reader.ReadToEnd();
}
}
}
string text = GetRequestPostData(context.Request);
Также если после строки Console.WriteLine(context); и перед строкой listener.Stop(); написать код, то выполнение до него не доходит
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:9901/");
listener.Start();
while(true){
HttpListenerContext context = listener.GetContext();
Console.WriteLine(context);
if(some)
break;
}
listener.Stop();
initChart(elem: any): void {
this.width = this.canvasValue?.nativeElement.offsetWidth;
this.dpi_width = this.width * 2;
elem.width = this.dpi_width;
elem.height = this.dpi_height;
this.view_height = this.dpi_height - this.padding * 2;
this.view_width = this.dpi_width - this.padding * 2;
this.yRatio = this.view_height / (this.ymax - this.ymin);
this.xRatio = this.view_width / (this.xmax - this.xmin);
}
Вы не слышали про форматирование даты?