示例#1
0
        static void RunGist(string gist)
        {
            var gistid = NetAccess.ExtractGist(gist);

            if (gistid == null)
            {
                _output.WriteLine("*** invalid gist id: '{0}'", gist);
            }
            else
            {
                _output.WriteLine("Loading gist: '{0}'", gistid);
                var script = NetAccess.LoadGist(gistid);
                if (script == null)
                {
                    _output.WriteLine("*** gist not found: '{0}'", gist);
                }
                else
                {
                    RunScript($"Gist: {_gist}", script, _inputs, _startlevel);
                }
            }
        }
示例#2
0
 static void RunGistConvert(string listname, string dir)
 {
     _output.WriteLine($"Converting gists: '{listname}' to '{dir}'");
     if (!Directory.Exists(dir))
     {
         Directory.CreateDirectory(dir);
     }
     foreach (var line in ReadLines(ReadFile(listname)))
     {
         var gistid = NetAccess.ExtractGist(line);
         if (gistid == null)
         {
             _output.WriteLine("*** invalid gist id: '{0}'", line);
         }
         else
         {
             var script  = NetAccess.LoadGist(gistid);
             var outpath = Path.Combine(dir, gistid + ".txt");
             using (var sw = new StreamWriter(outpath))
                 sw.Write(script);
         }
     }
 }