Example #1
0
        public void WriteOutput(Stream o, UserVar u = null)
        {
            UserVar v = Output;

            if (OutType == OutputType.None)
            {
                return;
            }
            UserVar wr = (u != null && !u.IsNull()) ? u : new UserVar(o);

            if (!wr.IsNull())
            {
                List <string> Out = new List <string>();
                if (Output.Is(typeof(String[])))
                {
                    foreach (string s in Output.Get <string[]>())
                    {
                        Out.Add(s);
                    }
                }
                else if (Output.Is(typeof(String)))
                {
                    Out.Add(Output.Get <string>());
                }
                foreach (string a in Out)
                {
                    Write(a, wr, u);
                }
            }
        }
Example #2
0
 UserVar Run(string s, bool ExpectsOutput = false)
 {
     if (s.StartsWith("`") && s.EndsWith("`"))
     {
         if (RunCommand && !Equals(m, null))
         {
             string cm = s.Substring(1, s.Length - 2);
             m.HideOutput();
             m.RunCommand(cm, ExpectsOutput);
             m.ShowOutput();
             UserVar r = m.Ret;
             m.t.KillBuffer();
             if (r != null && !r.IsNull())
             {
                 return(r);
             }
             else
             {
                 return(new UserVar(m.Return));
             }
         }
     }
     return(new UserVar(new Null()));
 }