Exemplo n.º 1
0
        public static void Main(params string[] args)
        {
            Console.WriteLine();
            Arguments inputArgs = new Arguments(args);

            if (!String.IsNullOrEmpty(inputArgs["map"]))
            {
                MapLoader loader = new MapLoader(inputArgs["map"]);

                if (loader.MapIsValid)
                {
                    MapArguments mapArgs = new MapArguments(inputArgs, loader);

                    if (mapArgs.ArgumentsAreValid)
                    {
                        DateTime start = DateTime.Now;
                        Packer = new Packer(loader, mapArgs);
                        Packer.Pack(Console.Out, Console.Error);
                        Console.WriteLine(TIME, DateTime.Now.Subtract(start).TotalSeconds, DateTime.Now);

                        if (!String.IsNullOrEmpty(inputArgs["watch"]) && Convert.ToBoolean(inputArgs["watch"]))
                        {
                            Console.WriteLine(WATCHING);
                            LastChange = DateTime.Now;

                            FileSystemWatcher watcher = new FileSystemWatcher(mapArgs.SourcePath);
                            watcher.IncludeSubdirectories = true;
                            watcher.Changed            += new FileSystemEventHandler(watcher_Changed);
                            watcher.EnableRaisingEvents = true;

                            while (true)
                            {
                                Console.ReadKey();
                            }
                        }
                    }
                    else
                    {
                        Console.Error.WriteLine(mapArgs.ArgumentsInvalidReason);
                    }
                }
                else
                {
                    Console.Error.WriteLine(loader.MapIsInvalidReason);
                }
            }
            else
            {
                Console.Error.WriteLine(USAGE);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="loader">The loader containing the map file to pack.</param>
 /// <param name="arguments">The arguments defining the packing behavior.</param>
 public Packer(MapLoader loader, MapArguments arguments)
 {
     Loader    = loader;
     Arguments = arguments;
 }