コード例 #1
0
                public void BeginInput()
                {
                    string result = ParsePS1(MainSession.GetEnvValue("PS1"));

                    StdOut.Write(result);
                    // Important!
                    StdOut.Write("\x1b[s");
                }
コード例 #2
0
                public List <string> Parse(string input)
                {
                    List <string> result = new List <string>();
                    string        curr   = "";

                    foreach (Match m in Parser.Matches(input))
                    {
                        if (m.Value.Length == 0)
                        {
                            continue;
                        }
                        char first = m.Value[0];
                        if (first == '<' || first == '>' || first == '|')
                        {
                            curr = curr.Trim();
                            if (curr.Length > 0)
                            {
                                result.Add(curr);
                            }
                            result.Add(first.ToString());
                            curr = "";
                        }
                        else if (first == '$' && m.Value.Length > 1)
                        {
                            curr += MainSession.GetEnvValue(m.Value.Substring(1));
                        }
                        else
                        {
                            curr += m.Value;
                        }
                    }
                    curr = curr.Trim();
                    if (curr.Length > 0)
                    {
                        result.Add(curr);
                    }
                    return(result);
                }
コード例 #3
0
            public string GetTempFilenameHandler()
            {
                string tmpFolder = MainSession.GetEnvValue("TMPDIR", "/tmp");

                return(tmpFolder + "/" + System.Guid.NewGuid().ToString());
            }