예제 #1
0
 protected BasePipeLine(ICollector collector, IOutputer outputer, List <IProcessor> processors, TransmitModel model)
 {
     this.processors = processors;
     this.collector  = collector;
     this.outputer   = outputer;
     this.model      = model;
 }
예제 #2
0
 public override void Add(string dirPath, IOutputer outputer)
 {
     if (!Directory.Exists(dirPath))
     {
         throw new InvalidOperationException($"invalid directory: <\"{dirPath}\">.");
     }
     base.Add(Path.GetFullPath(dirPath), outputer);
 }
예제 #3
0
        public virtual void Remove(string value, IOutputer outputer)
        {
            var exists = this.Paths.FirstOrDefault(z => Comparer.Equals(z, value));

            if (exists == null)
            {
                throw new InvalidOperationException($"value not exists: <{value}>");
            }
            this.Paths.Remove(exists);
            this.Save();
            outputer.WriteLine(OutputLevel.Normal, $"Removed <{value}> from {this._target} envvar <{this._name}>.");
        }
예제 #4
0
        public virtual void Add(string value, IOutputer outputer)
        {
            var exists = this.Paths.FirstOrDefault(z => Comparer.Equals(z, value));

            if (exists != null)
            {
                throw new InvalidOperationException($"exists value: <{exists}>");
            }
            this.Paths.Add(value);
            this.Save();
            outputer.WriteLine(OutputLevel.Normal, $"Added <{value}> into {this._target} envvar <{this._name}>.");
        }
예제 #5
0
        public void Map(string dirPath, IOutputer outputer)
        {
            if (!Directory.Exists(dirPath))
            {
                throw new InvalidOperationException($"invalid directory: <\"{dirPath}\">.");
            }
            dirPath = Path.GetFullPath(dirPath);

            var lastChar = dirPath[dirPath.Length - 1];

            if (lastChar == Path.DirectorySeparatorChar || lastChar == Path.AltDirectorySeparatorChar)
            {
                dirPath = dirPath.Substring(0, dirPath.Length - 1);
            }

            var dirPath2 = dirPath + Path.DirectorySeparatorChar;
            var removed  = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            var added    = new List <string>();

            this.Paths.RemoveAll(z =>
            {
                if (z.Equals(dirPath, StringComparison.OrdinalIgnoreCase) ||
                    z.StartsWith(dirPath2, StringComparison.OrdinalIgnoreCase))
                {
                    removed.Add(z);
                    return(true);
                }
                return(false);
            });

            foreach (var item in Directory.GetDirectories(dirPath))
            {
                if (!removed.Remove(item))
                {
                    added.Add(item);
                }
                this.Paths.Add(item);
            }

            outputer.WriteLine(OutputLevel.Normal, $"Added ({added.Count}):");
            foreach (var item in added)
            {
                outputer.WriteLine(OutputLevel.Normal, $"   {item}");
            }
            outputer.WriteLine(OutputLevel.Normal, $"Removed ({removed.Count}):");
            foreach (var item in removed)
            {
                outputer.WriteLine(OutputLevel.Normal, $"   {item}");
            }

            this.Save();
        }
예제 #6
0
 public UmiMiddleware(RequestDelegate next,
                      UmiMiddlewareOptions options,
                      JsonOutputer jsonOutputer,
                      HtmlOutputer htmlOutputer,
                      AssetOutputer assetOutputer)
 {
     this.next         = next;
     this.options      = options;
     this.jsonOutputer = jsonOutputer;
     this.jsonOutputer.SetOptions(this.options);
     this.htmlOutputer = htmlOutputer;
     this.htmlOutputer.SetOptions(this.options);
     this.assetOutputer = assetOutputer;
     this.assetOutputer.SetOptions(this.options);
 }
예제 #7
0
 public LinesPipeLine(ICollector collector, IOutputer outputer, List <IProcessor> processors)
     : base(collector, outputer, processors, TransmitModel.LINES)
 {
 }
예제 #8
0
파일: Filters.cs 프로젝트: dtila/ReStankins
 public NotEvenRowsTableFilter(IOutputer outputer)
 {
     Outputer = outputer;
 }
예제 #9
0
 public IBuilder SetOutputer(IOutputer outputer)
 {
     this.outputer = outputer;
     return(this);
 }
예제 #10
0
 public void Sort(IOutputer outputer)
 {
     this.Paths.Sort();
     this.Save();
     outputer.WriteLine(OutputLevel.Normal, $"Sorted {this._target} envvar <{this._name}>.");
 }
예제 #11
0
 public void List(IOutputer outputer)
 {
     outputer.WriteLine(OutputLevel.Normal, this.ToString());
 }
예제 #12
0
 public UsageDrawer(IOutputer outputer)
 {
     this._outputer = outputer;
 }
예제 #13
0
 public override void Remove(string dirPath, IOutputer outputer)
 {
     base.Remove(Path.GetFullPath(dirPath), outputer);
 }