private void OnReceived_SelfCMD(SelfCmdType type, string result) { switch (type) { case SelfCmdType.GetWorkingDirectory: workingDirectory = result; TerminalWindow.UpdateWorkingDir(); break; } }
private bool HandleReceivedSelfCmd(string text) { if (string.IsNullOrEmpty(text)) { return(true); } else if (ignoreLineCount > 0) { --ignoreLineCount; return(true); } else if (text.Contains(WinsCodeCMDToken)) { //입력 브로드캐스팅 무시 if (text.Contains("echo")) { return(true); } string[] words = text.Split(' '); if (words.Length > 2) { int cmdTypeNum; if (int.TryParse(words[1], out cmdTypeNum)) { selfCmdType = (SelfCmdType)cmdTypeNum; ignoreLineCount = 1; return(true); } } } else if (selfCmdType != SelfCmdType.None) { OnReceived_SelfCMD(selfCmdType, text); selfCmdType = SelfCmdType.None; return(true); } return(false); }
public void ExecuteSelfCMD(SelfCmdType type, string command) { Execute($"echo {WinsCodeCMDToken} {((int)type).ToString()} {Environment.NewLine}{command}", type != SelfCmdType.GetWorkingDirectory); }