Example #1
0
        static void Main(string[] args)
        {
            //runner0.Run(Properties.Resources.ExampleInput, "ExampleInput", 1, true);

            Runner <ProblemInput, ProblemOutput> runner1 = new Runner <ProblemInput, ProblemOutput>("2017", new Parser(), new SolverRambo(), new Printer());

            ZipCreator.CreateCodeZip("2017");
            runner1.Run(Properties.Resources.MeAtTheZoo, "MeAtTheZoo", 1, true);

            Runner <ProblemInput, ProblemOutput> runner2 = new Runner <ProblemInput, ProblemOutput>("2017", new Parser(), new SolverRambo(), new Printer());

            runner2.Run(Properties.Resources.TrendingToday, "TrendingToday", 1, true);

            Runner <ProblemInput, ProblemOutput> runner3 = new Runner <ProblemInput, ProblemOutput>("2017", new Parser(), new SolverRambo(), new Printer());

            runner3.Run(Properties.Resources.VideosWorthSpreading, "VideosWorthSpreading", 1, true);

            Runner <ProblemInput, ProblemOutput> runner4 = new Runner <ProblemInput, ProblemOutput>("2017", new Parser(), new SolverRambo(), new Printer());

            runner4.Run(Properties.Resources.Kittens, "Kittens", 1, true);

            ZipCreator.CreateCodeZip("2017");

            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            Runner <ProblemInput, ProblemOutput> runner1 = new Runner <ProblemInput, ProblemOutput>(
                "2017_Final", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner1.Run(Properties.Resources.charleston_road, "charleston_road", 1, true);

            Runner <ProblemInput, ProblemOutput> runner2 = new Runner <ProblemInput, ProblemOutput>(
                "2017_Final", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner2.Run(Properties.Resources.lets_go_higher, "lets_go_higher", 1, true);

            Runner <ProblemInput, ProblemOutput> runner3 = new Runner <ProblemInput, ProblemOutput>(
                "2017_Final", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner3.Run(Properties.Resources.opera, "opera", 1, true);

            Runner <ProblemInput, ProblemOutput> runner4 = new Runner <ProblemInput, ProblemOutput>(
                "2017_Final", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner4.Run(Properties.Resources.rue_de_londres, "rue_de_londres", 1, true);

            //DataAnalyze();

            ZipCreator.CreateCodeZip("2017_Final");
            Console.Read();
        }
Example #3
0
        static void Main(string[] args)
        {
            Runner <ProblemInput, ProblemOutput> runner1 = new Runner <ProblemInput, ProblemOutput>(
                "2018", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner1.Run(Properties.Resources.a_example, "a_example", 1, true);

            Runner <ProblemInput, ProblemOutput> runner2 = new Runner <ProblemInput, ProblemOutput>(
                "2018", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner2.Run(Properties.Resources.b_should_be_easy, "b_should_be_easy", 1, true);

            Runner <ProblemInput, ProblemOutput> runner3 = new Runner <ProblemInput, ProblemOutput>(
                "2018", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner3.Run(Properties.Resources.c_no_hurry, "c_no_hurry", 1, true);

            Runner <ProblemInput, ProblemOutput> runner4 = new Runner <ProblemInput, ProblemOutput>(
                "2018", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner4.Run(Properties.Resources.d_metropolis, "d_metropolis", 1, true);

            Runner <ProblemInput, ProblemOutput> runner5 = new Runner <ProblemInput, ProblemOutput>(
                "2018", new Parser(), new Solver(), new Printer(), new Calcutaor());

            runner5.Run(Properties.Resources.e_high_bonus, "e_high_bonus", 1, true);

            ZipCreator.CreateCodeZip("e_high_bonus");

            Console.Read();
        }
        public static void zip(ApplicationContext context, ActiveEventArgs e)
        {
            using (new ArgsRemover(e.Args)) {
                // Getting root folder
                var rootFolder = Helpers.GetBaseFolder(context);

                // Getting destination file
                var destination = Helpers.GetSystemPath(context, e.Args.GetExValue <string> (context));

                // Getting destination path, and verify path can be legally written to
                var destinationFile = Helpers.GetLegalDestinationFilename(
                    context,
                    e.Args,
                    rootFolder,
                    destination);

                // Getting source file(s)
                var source = XUtil.Sources(context, e.Args, "compression-level", "password", "key-size");

                // Making sure we are able to delete zip file, if an exception occurs
                try {
                    // Creating zip file, supplying FileStream as stream to store results into
                    using (ZipCreator creator = new ZipCreator(
                               context,
                               File.Create(rootFolder + destinationFile),
                               e.Args.GetExChildValue("compression-level", context, 3),
                               e.Args.GetExChildValue <string> ("password", context, null),
                               e.Args.GetExChildValue("key-size", context, 256))) {
                        // Looping through each input file/folder given
                        foreach (var idxSourceFileFolder in source)
                        {
                            var idxSource = Helpers.GetSystemPath(context, Utilities.Convert <string> (context, idxSourceFileFolder));

                            // Verifies source folder can be read from
                            Helpers.VerfifySourceFileFolderCanBeReadFrom(
                                context,
                                e.Args,
                                rootFolder,
                                destinationFile,
                                idxSource);

                            // Adding currently iterated file/folder to zip file stream
                            creator.AddToArchive(rootFolder + idxSource, e.Args);
                        }
                    }

                    // Making sure we return actual destination to caller
                    e.Args.Value = destinationFile;
                } catch {
                    // Checking if destination file exist, and if so, delete it, before we rethrow exception
                    if (File.Exists(rootFolder + destinationFile))
                    {
                        File.Delete(rootFolder + destinationFile);
                    }
                    throw;
                }
            }
        }
Example #5
0
        static void Main(string[] args)
        {
            Runner <ProblemInput, ProblemOutput> runner = new Runner <ProblemInput, ProblemOutput> ("2015", new Parser(), new Solver(), new Printer(), new ScoreCalculator());

            runner.Run(Properties.Resources.Input, "Example", 1, true);
            // runner.Run(Properties.Resources.TestInput, "Example", 1, true);

            ZipCreator.CreateCodeZip("Example");

            Console.Read();
        }
Example #6
0
        static void Main(string[] args)
        {
            Runner <ProblemInput, ProblemOutput> runner1 = new Runner <ProblemInput, ProblemOutput>("2016", new Parser(), new Solver(), new Printer(), new Scorer());

            runner1.Run("constellation", Resources.weekend);
            runner1.Run("constellation", Resources.forever_alone);
            runner1.Run("constellation", Resources.constellation);
            runner1.Run("constellation", Resources.overlap);
            ZipCreator.CreateCodeZip("2016");
            // TODO: input file
            //runner1.Run(Properties.Resources.MeAtTheZoo, "MeAtTheZoo", 1, true);

            ZipCreator.CreateCodeZip("2016");
            Console.ReadKey();
        }
Example #7
0
        static void Main(string[] args)
        {
            // DataAnalyze();
            Stopwatch watch = Stopwatch.StartNew();

            ZipCreator.CreateCodeZip("2018_Final");

            // RunAll(new Calculator());

            //Runner<ProblemInput, ProblemOutput> runner6 = new Runner<ProblemInput, ProblemOutput>(
            //    "2018_Final", new Parser(), new EScroer(), new Printer(), new Calculator());
            //runner6.Run(Properties.Resources.e_precise_fit, "e_precise_fit", 1, true);
            var runner = new Runner <ProblemInput, ProblemOutput>("2018_Final", new Parser(), new EfficintSolver(), new Printer(), new Calculator());

            runner.Run(Resources.c_going_green, "c_going_green", 1, true);
            Console.WriteLine("Time:" + watch.ElapsedMilliseconds);
            Console.Read();
        }
Example #8
0
        static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch t = new System.Diagnostics.Stopwatch();
            t.Start();
            var parserBase = new Parser();

            Runner <ProblemInput, ProblemOutput> runner1 = new Runner <ProblemInput, ProblemOutput>(
                "2019", parserBase, new StupidDolver(), new Printer(), new Calcutaor());

            runner1.Run(Properties.Resources.a_example, "a_example", 10, false);
            runner1.Run(Properties.Resources.b_lovely_landscapes, "b_lovely_landscapes", 1, false);
            runner1.Run(Properties.Resources.c_memorable_moments, "c_memorable_moments", 100, false);
            runner1.Run(Properties.Resources.d_pet_pictures, "d_pet_pictures", 1, false);
            runner1.Run(Properties.Resources.e_shiny_selfies, "e_shiny_selfies", 1, false);
            t.Stop();
            Console.WriteLine("Finished in {0}", t.Elapsed);
            ZipCreator.CreateCodeZip(string.Empty);

            Console.Read();
        }
Example #9
0
        static void Main(string[] args)
        {
            Calculator calculator = new Calculator();

            var runner1 = new Runner <ProblemInput, ProblemOutput>("2020_SecondPractice", new Parser(), new Solver(), new Printer(), calculator);
            // runner1.Run(Resources.Example, "example");
            List <double> runParams = new List <double>();

            for (int i = 0; i < 100; i++)
            {
                runParams.Add(1 + i / 100.0);
            }

            var runner2 = new Runner <ProblemInput, ProblemOutput>("2020_SecondPractice", new Parser(), new Solver(), new Printer(), calculator);

            runner2.Run(Resources.dc_in, "dc_in", 1, true, new List <double> {
                1.3
            });
            // runner2.Run(Resources.dc_in, "dc_in", 100, true, runParams);

            ZipCreator.CreateCodeZip(@"..\..\..\output\2020_SecondPractice");

            Console.ReadLine();
        }
Example #10
0
 public ZipCreatorProxy(IWriteableDirectory directory)
 {
     ZipCreator = directory as ZipCreator;
 }