コード例 #1
0
            public override IElement Action(ArgumentContainer Args)
            {
                var path = Args.GetVisitedArgumentAs <Str>("path");

                if (localFiles.ContainsKey(path.Value))
                {
                    Directory.SetCurrentDirectory(localFiles[path.Value]);
                    RescanFiles();
                }

                return(new Noop());
            }
コード例 #2
0
ファイル: TimeActions.cs プロジェクト: inquisitorPinkie/lewd
            public override IElement Action(ArgumentContainer Args)
            {
                var arg = Args.GetVisitedArgumentAs <Str>("in", true);

                if (arg == null)
                {
                    return(new Time().Initialize(DateTime.UtcNow));
                }
                if (DateTime.TryParse(arg.Value, out DateTime result))
                {
                    return(new Time().Initialize(result));
                }
                throw new TypeException("Could not create Time from provided string.");
            }
コード例 #3
0
            public override IElement Action(ArgumentContainer Args)
            {
                var p = Args.GetVisitedArgumentAs <Str>("filename");

                return(new Str().Initialize(File.ReadAllText(p.Value)));
            }