public PreAuth(NetComUser pUser) : base(pUser) { MsgType = MessageType.PREAUTH; Instruction = this.GetType().AssemblyQualifiedName; if (pUser.GetType() == typeof(NetComServer)) { Value = (pUser as NetComServer).RSA.PublicKey; } if (pUser.GetType() == typeof(NetComClient)) { Value = (pUser as NetComClient).RSA.PublicKey; } user = pUser; }
public NetComInstruction(NetComUser pUser, string pValue, object[] pParameters, string pReplyRequest) { MsgType = MessageType.INSTRUCTION; if (pUser.GetType() == typeof(NetComClient)) { Username = (pUser as NetComClient).Username; Password = (pUser as NetComClient).Password; } if (pUser.GetType() == typeof(NetComUserDummy)) { Username = (pUser as NetComUserDummy).Username; Password = (pUser as NetComUserDummy).Password; } Value = pValue; Parameters = pParameters; ReplyRequest = pReplyRequest; }
public NetComInstruction(NetComUser pUser, string pValue, string pReplyRequest) : this(pUser, pValue, null, pReplyRequest) { }
public NetComInstruction(NetComUser pUser, string pValue, object[] pParameters) : this(pUser, pValue, pParameters, null) { }
public NetComInstruction(NetComUser pUser, string pValue) : this(pUser, pValue, null, null) { }
public NetComInstruction(NetComUser pUser) : this(pUser, null, null, null) { }
public static IEnumerable <NetComInstruction> Parse(NetComUser pLocalUser, string pNetComInstructionString) { NetComRSAHandler RSA = null; string ncInstr = pNetComInstructionString; bool rsaMessage = false; if (pLocalUser.GetType() == typeof(NetComServer)) { RSA = (pLocalUser as NetComServer).RSA; } if (pLocalUser.GetType() == typeof(NetComClient)) { RSA = (pLocalUser as NetComClient).RSA; } // Split up multiple commands (e.g. blocked buffer) foreach (string instr in ncInstr.Split(';')) { if (string.IsNullOrEmpty(instr)) { continue; } // Check if Instruction is RSA-Encrypted if (pNetComInstructionString.StartsWith("RSA")) { rsaMessage = true; } string tmpInstr = instr.TrimStart('{').TrimEnd('}'); MessageType messageType = MessageType.NONE; string username = null; string password = null; string instruction = null; string value = null; List <string[]> parameters = new List <string[]>(); string replyrequest = null; foreach (string instrObj in tmpInstr.Split(',')) { if (string.IsNullOrEmpty(instrObj)) { continue; } string[] instrParts = instrObj.TrimStart('[').TrimEnd(']').Split(':'); switch (instrParts[0]) { case "MESSAGETYPE": Enum.TryParse(B64D(instrParts[1]), out messageType); break; case "USERNAME": username = B64D(instrParts[1]); break; case "PASSWORD": if (rsaMessage) { password = B64D(RSA.Decrypt(instrParts[1])); } else { password = B64D(instrParts[1]); } break; case "INSTRUCTION": instruction = B64D(instrParts[1]); break; case "VALUE": value = B64D(instrParts[1]); break; case "PARAMETERS": foreach (string paramGroup in instrParts[1].Split('|')) { if (string.IsNullOrEmpty(paramGroup)) { continue; } parameters.Add(paramGroup.TrimStart('<').TrimEnd('>').Split('=')); } break; case "REPREQ": replyrequest = instrParts[1]; break; } } yield return((NetComInstruction)Activator.CreateInstance(Type.GetType(instruction), new NetComUserDummy(username, password, value) as NetComUser, value, parameters.ToArray(), replyrequest)); } }
public MessageBox(NetComUser pUser, string pMessage, string pCaption, System.Windows.Forms.MessageBoxButtons pButtons, System.Windows.Forms.MessageBoxIcon pIcons) : base(pUser, pMessage, new object[] { pCaption, pButtons, pIcons }) => Instruction = this.GetType().AssemblyQualifiedName;
public MessageBox(NetComUser pUser, string pVal, object[] pParam, string pRepReq) : this(pUser, pVal, (string)pParam[0], (System.Windows.Forms.MessageBoxButtons)pParam[1], (System.Windows.Forms.MessageBoxIcon)pParam[2]) { }
public PlainText(NetComUser pUser, string pMessage) : base(pUser, pMessage) =>
public PlainText(NetComUser pUser, string pVal, object[] pParam, string pRepReq) : this(pUser, pVal) { }
public PreAuth(NetComUser pUser, string pVal, object[] pParam, string pRepReq) : this(pUser) { }