Ejemplo n.º 1
0
        private static IO ioForOption(String option, SnippetInfo info)
        {
            option = option.TrimStart();

            if (String.IsNullOrEmpty(option))
            {
                throw new Exception("No IO destination specified");
            }

            if (option.StartsWith("console", StringComparison.OrdinalIgnoreCase))
            {
                return(frmMyDlg.getIOToConsole());
            }
            else if (option.StartsWith("append", StringComparison.OrdinalIgnoreCase))
            {
                return(new IOAppendCurrentDoc());
            }
            else if (option.StartsWith("insert", StringComparison.OrdinalIgnoreCase))
            {
                return(new IOInsertAtPosition());
            }
            else if (option.StartsWith("new", StringComparison.OrdinalIgnoreCase))
            {
                return(IONewDoc.NewDocFactory());
            }
            else if (option.StartsWith("file", StringComparison.OrdinalIgnoreCase))
            {
                string filename = option.Substring(4, option.Length - 4);
                if (!Path.IsPathRooted(filename))
                {
                    filename = Path.Combine(info.workingDirectory, filename);
                }

                //create an IO to that document
                return(IOFileDoc.FileDocFactory(filename));
            }
            else
            {
                //TODO: new IOWriteDoc();
                throw new NotImplementedException("silent file");
            }
        }
Ejemplo n.º 2
0
 public static IONewDoc NewDocFactory()
 {
     return(IONewDoc.NewDocFactory(string.Empty));
 }