示例#1
0
文件: Use.cs 项目: tefarov/teo_core
        public override IBatchable Create(Input item)
        {
            string fil = null;
            bool   onc = false;

            if (!item.TrySet(ref fil, 1, "file"))
            {
                throw new ArgumentException("Codesource file not specified");
            }

            if (string.IsNullOrEmpty(fil))
            {
                return(null);
            }

            if (item.TrySet(ref onc, 2, "once") && PRT.FilesUsed.Contains(fil))
            {
                return(null);
            }

            PRT.FilesUsed.Add(fil);

            var gfil = new GetterTextFile(fil);

            return(PRT.Parse(gfil));
        }
示例#2
0
            public IBatchable Create(Input item)
            {
                string src = null, typ = "exception";

                if (!item.TrySet(ref src, 1, "file"))
                {
                    throw new ArgumentException("Не установлено свойство: file(1)");
                }
                if (!item.TrySet(ref typ, 2, "modify"))
                {
                }

                var mdf               = Helpers.ParseBehaviour(typ);
                IGetter <string> gfil = null;

                if (FFiles != null)
                {
                    gfil = new GetterTextFile(FFiles, src, mdf);
                }
                else
                {
                    gfil = new GetterTextFile(src, mdf);
                }

                return(new CmdReadText(gfil, Destination));
            }
示例#3
0
文件: Run.cs 项目: tefarov/teo_core
        public override IBatchable Create(Input item)
        {
            string fil = null;
            bool   onc = false, ask = false;

            if (!item.TrySet(ref fil, 1, "file"))
            {
                throw new ArgumentException("Codesource file not specified");
            }
            if (string.IsNullOrEmpty(fil))
            {
                return(null);
            }

            item.TrySet(ref onc, 2, "once");

            ask = fil == Language.KwAsk;    // we will ask the user for a command if he has input word ASK instead of a filename
            onc = onc && !ask;              // we do not use once-mode when asking

            IGetter <string> gcmd = null;

            if (ask)
            {
                gcmd = new GetterAskConsole("Какой файл запустить:");
                gcmd = new GetterTextFile(gcmd);
            }
            else
            {
                gcmd = new GetterTextFile(fil);
            }

            var itm = new bch_file(this, gcmd);

            if (onc)
            {
                itm.Filepath = fil;      // this will make once-mode work
            }
            return(itm);
        }