public static string get_BodyName(Encoding aThis) { mDebugger.SendInternal($"Get Body name for {aThis.CodePage}"); cp cp = (cp)aThis.CodePage; switch (cp) { case cp.CodePageASCII: return("us-ascii"); case cp.CodePageUTF7: return("UTF-7"); case cp.CodePageUTF8: return("UTF-8"); case cp.CodePageUnicode: return("utf-16"); case cp.CodePageBigEndian: return("utf-16BE"); case cp.CodePageUTF32: return("utf-32"); case cp.CodePageUTF32BE: return("utf-32BE"); default: return("null"); } }
// Receive public static void RecvProcessCmd(cp p) { switch (p.cmd) { case CMD_SCREEN: break; case CMD_MOUSE: break; case CMD_KEYBOARD: break; } }
public void Send_p(cp p1, IntPtr data1) { /* * byte[] SendingBuffer = null; * TcpClient client = null; * lblStatus.Text = ""; * NetworkStream netstream = null; * try * { * client = new TcpClient(IPA, PortN); * lblStatus.Text = "Connected to the Server...\n"; * netstream = client.GetStream(); * FileStream Fs = new FileStream(M, FileMode.Open, FileAccess.Read); * int NoOfPackets = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Fs.Length) / Convert.ToDouble(SendBufferSize))); * progressBar1.Maximum = NoOfPackets; * int TotalLength = (int)Fs.Length, CurrentPacketLength, counter = 0; * for (int i = 0; i < NoOfPackets; i++) * { * if (TotalLength > SendBufferSize) * { * CurrentPacketLength = SendBufferSize; * TotalLength = TotalLength - CurrentPacketLength; * } * else * CurrentPacketLength = TotalLength; * SendingBuffer = new byte[CurrentPacketLength]; * Fs.Read(SendingBuffer, 0, CurrentPacketLength); * netstream.Write(SendingBuffer, 0, (int)SendingBuffer.Length); * if (progressBar1.Value >= progressBar1.Maximum) * progressBar1.Value = progressBar1.Minimum; * progressBar1.PerformStep(); * } * * lblStatus.Text = lblStatus.Text + "Sent " + Fs.Length.ToString() + " bytes to the server"; * Fs.Close(); * } * catch (Exception ex) * { * Console.WriteLine(ex.Message); * } * finally * { * netstream.Close(); * client.Close(); * * } */ }
public void createGraph(int Lp, List <CDesc> Lst, int [] pi, out List <cp>[] Nast, out List <cp>[] Pop) { Nast = new List <cp> [Lp + 2]; Pop = new List <cp> [Lp + 2]; for (int i = 0; i < Lp + 1; i++) { Nast[i] = new List <cp>(); Pop[i] = new List <cp>(); } for (int s = 0; s < Lst.Count - 1; s++) { int nst = Lst[s].nast + 1; int w = (int)(Lst[s].przerwa); if (Lst[s].nast == 0) { continue; } cp ee = new cp(); ee.nst = nst; ee.w = w; Nast[s + 1].Add(ee); cp p = new cp(); p.nst = s + 1; p.w = w; Pop[nst].Add(p); } for (int s = 0; s < Lp + 1; s++) { int node = pi[s]; int nst = pi[s + 1]; if (node == 0) { continue; } if (nst == 0) { continue; } int w = 0; cp ee = new cp(); ee.nst = nst; ee.w = w; Nast[node].Add(ee); cp p = new cp(); p.nst = node; p.w = w; Pop[nst].Add(p); } }
public static cp operator -(cp s) { cp p = new cp(s.x, s.y); p.x = -p.x; p.y = -p.y; return(p); }