|
|
@@ -33,11 +33,26 @@ namespace UAS_PRINT
|
|
|
rk2.Close();
|
|
|
rk.Close();
|
|
|
httpPostRequest.Prefixes.Add("http://localhost:9100/");
|
|
|
- httpPostRequest.Start();
|
|
|
+ httpPostRequest.Start();
|
|
|
|
|
|
ThrednHttpPostRequest = new Thread(new ThreadStart(httpPostRequestHandle));
|
|
|
ThrednHttpPostRequest.Start();
|
|
|
- 提示.ShowBalloonTip(30,"提示","程序启动",ToolTipIcon.Info);
|
|
|
+ 提示.ShowBalloonTip(30, "提示", "程序启动", ToolTipIcon.Info);
|
|
|
+
|
|
|
+ //string req = File.ReadAllText(@"C:\Users\Hcsy\Documents\Tencent Files\814802334\FileRecv\4.txt", Encoding.UTF8);
|
|
|
+ //if (req.Contains("\"" + "chooseprintername" + "\""))
|
|
|
+ //{
|
|
|
+ // req = req.Remove(req.IndexOf("device"), req.IndexOf("data") - 3);
|
|
|
+ // lock ("A")
|
|
|
+ // {
|
|
|
+ // PrintHandler.vendorZplPrint(req);
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // PrintHandler.zplprint(req);
|
|
|
+ //}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -65,17 +80,10 @@ namespace UAS_PRINT
|
|
|
if (requestContext.Request.Url.PathAndQuery == "/write")
|
|
|
{
|
|
|
Stream stream = requestContext.Request.InputStream;
|
|
|
- var memoryStream = new MemoryStream();
|
|
|
- //将基础流写入内存流
|
|
|
- const int bufferLength = 2 * 1024 * 1024;
|
|
|
- byte[] buffera = new byte[bufferLength];
|
|
|
- int actual = stream.Read(buffera, 0, bufferLength);
|
|
|
- if (actual > 0)
|
|
|
- {
|
|
|
- memoryStream.Write(buffera, 0, actual);
|
|
|
- }
|
|
|
- memoryStream.Position = 0;
|
|
|
- string req = System.Text.Encoding.UTF8.GetString(buffera);
|
|
|
+ StreamReader sr = new StreamReader(stream);
|
|
|
+ string req = sr.ReadToEnd();
|
|
|
+ sr.Close();
|
|
|
+
|
|
|
if (req.Contains("\"" + "chooseprintername" + "\""))
|
|
|
{
|
|
|
req = req.Remove(req.IndexOf("device"), req.IndexOf("data") - 2);
|
|
|
@@ -86,7 +94,7 @@ namespace UAS_PRINT
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- PrintHandler.zplprint(req);
|
|
|
+ PrintHandler.zplprint(req);
|
|
|
}
|
|
|
}
|
|
|
else if (requestContext.Request.Url.PathAndQuery == "/default?type=printer")
|