Example #1
0
 /// <summary>
 /// Output module names.
 /// </summary>
 /// <param name="o">Input options.</param>
 /// <param name="mns">Module names.</param>
 public static void Output(Option o, IList <string> mns)
 {
     Console0.Verbose(o, "Module\tSource\tTarget");
     Console0.Verbose(o, "------\t------\t------");
     foreach (var mn in mns)
     {
         var m = Get(mn, true);
         Console.WriteLine("{0}\t{1}\t{2}", mn, Module.GetSource(m)[0], Module.GetTarget(m));
     }
 }
Example #2
0
 /// <summary>
 /// Command: Remove links.
 /// </summary>
 /// <param name="o">Input arguments.</param>
 public static void CmdRemove(Option o)
 {
     foreach (var ln in List(o))
     {
         var l = Link.Get(Root, ln);
         Console0.Verbose(o, "Link: X {0} -> Module: {1}", ln, Link.GetDescription(l));
         Link.Destroy(l);
     }
     Console0.Verbose(o, "(done)");
 }
Example #3
0
 /// <summary>
 /// Output link names.
 /// </summary>
 /// <param name="o">Input options.</param>
 /// <param name="lns">Link names.</param>
 public static void Output(Option o, IList <string> lns)
 {
     Console0.Verbose(o, "Link\tModule\tTarget");
     Console0.Verbose(o, "----\t------\t------");
     foreach (var ln in lns)
     {
         var l = Get(ln, true);
         Console.WriteLine("{0}\t{1}\t{2}", ln, Link.GetDescription(l), Link.GetTarget(l));
     }
 }
Example #4
0
 /// <summary>
 /// Output modules.
 /// </summary>
 /// <param name="o">Input options.</param>
 /// <param name="mns">Module names.</param>
 private static void ModulesOutput(Option o, IList <string> mns)
 {
     Console0.Verbose(o, "Module\tTarget\tSource");
     Console0.Verbose(o, "------\t------\t------");
     foreach (var mn in mns)
     {
         var m = Module.Get(Module0.Root, mn);
         Console.WriteLine("{0}\t{1}\t{2}", mn, Module.GetTarget(m), Module.GetSource(m));
     }
 }
Example #5
0
 /// <summary>
 /// Command: Remove modules.
 /// </summary>
 /// <param name="o">Input options.</param>
 public static void CmdRemove(Option o)
 {
     foreach (var mn in List(o))
     {
         foreach (var ln in Link.List(Link0.Root, ".*", mn, ".*"))
         {
             Console0.Verbose(o, "Link: X {0} -> Module: {1}", ln, mn);
             Link.Destroy(Link.Get(Link0.Root, ln));
         }
         Module.Destroy(Module.Get(Root, mn));
         Console0.Verbose(o, "Module: X {0} (removed)", mn);
     }
 }
Example #6
0
 /// <summary>
 /// Update modules.
 /// </summary>
 /// <param name="o">Input options.</param>
 public static void CmdUpdate(Option o)
 {
     o.Link = null;
     foreach (var mn in List(o))
     {
         var m = Get(mn, true);
         o.Module = mn;
         o.Source = Module.GetSource(m)[0];
         o.Target = Module.GetTarget(m)[0];
         CmdRemove(o);
         CmdAdd(o);
         Console0.Verbose(o, "");
     }
 }
Example #7
0
        /// <summary>
        /// Command: Add link.
        /// </summary>
        /// <param name="o">Input options.</param>
        public static void CmdAdd(Option o)
        {
            if (o.Link == null)
            {
                throw new Exception("Bad link: (none)");
            }
            var l  = Get(o.Link, false);
            var mn = Module0.ListOne(o);
            var m  = Module.Get(Module0.Root, mn);
            var mt = o.Target == null?Module.GetTarget(m)[0] : o.Target;

            Link.Create(l, mn, mt);
            Console0.Verbose(o, "Link: {0} -> Module: {1} (linked)", o.Link, Link.GetDescription(l));
            Console0.Verbose(o, "[Target: {0}]", mt);
        }
Example #8
0
        /// <summary>
        /// Command: Add module.
        /// </summary>
        /// <param name="o">Input options.</param>
        public static void CmdAdd(Option o)
        {
            if (o.Source == null)
            {
                throw new Exception("Bad source: (none)");
            }
            var mn = o.Module == null?Source.GetName(o.Source) : o.Module;

            var m = Get(mn, false);

            Console0.Verbose(o, "Module: {0} (adding)", mn);
            Module.Create(m, o.Source);
            var mt = Module.GetTarget(m)[0];
            var ln = o.Link == null?Path.GetFileNameWithoutExtension(mt) : o.Link;

            var l = Link0.Get(ln, false);

            Console0.Verbose(o, "Link: {0} (linking)", ln);
            Link.Create(l, mn, mt);
            Console0.Verbose(o, "Link: {0} -> Module: {1} (done)", ln, mn);
            Console0.Verbose(o, "[Target: {0}]", mt);
            Console0.Verbose(o, "[Source: {0}]", o.Source);
        }