Beispiel #1
0
 public void PackAllBinaries(PackageDescriptor desc)
 {
     using (var p = new Package(desc.Path, this.f.ParentPath)) {
         p.Add(q.files("^/dlls/release/*.(dll|pdb)$"), "/", "dlls/release");
         p.Add(q.files("^/[^/]+.txt$"));
     }
 }
Beispiel #2
0
 public void PackMin(PackageDescriptor desc)
 {
     // 'min' - /dlls/release/ImageResizer.* - /
     // /*.txt
     using (var p = new Package(desc.Path, this.f.ParentPath)) {
         p.Add(q.files("^/dlls/release/ImageResizer.(Mvc.)?(dll|pdb|xml)$"), "/", "dlls/release");
         p.Add(q.files("^/readme.txt$"));
         p.Add(q.files("^/Core/license.txt$"), "");
         p.Add(q.files("^/Web.config$"));
     }
 }
Beispiel #3
0
        /*
         * public void setPackage()
         * {
         *  AllCards.Add(new Card(1, "WaterGoblin", 37, "water", "spell"));
         *  AllCards.Add(new Card(2, "Dragon", 42, "fire", "monster"));
         *  AllCards.Add(new Card(3, "WaterSpell", 11, "water", "spell"));
         *  AllCards.Add(new Card(4, "Ork", 39, "water", "monster"));
         *  AllCards.Add(new Card(5, "Wizzard", 9, "normal", "spell"));
         *  AllCards.Add(new Card(6, "Knight", 11, "normal", "monster"));
         *  AllCards.Add(new Card(7, "Kraken", 43, "water", "monster"));
         *  AllCards.Add(new Card(8, "FireElves", 29, "fire", "monster"));
         *  AllCards.Add(new Card(9, "FireTroll", 38, "fire", "spell"));
         *  AllCards.Add(new Card(10, "WaterGoblin", 33, "water", "spell"));
         *  AllCards.Add(new Card(11, "Dragon", 46, "fire", "monster"));
         *  AllCards.Add(new Card(12, "FireSpell", 44, "fire", "spell"));
         *  AllCards.Add(new Card(13, "Ork", 46, "water", "spell"));
         *  AllCards.Add(new Card(14, "Wizzard", 17, "normal", "spell"));
         *  AllCards.Add(new Card(15, "Knight", 15, "normal", "spell"));
         *  AllCards.Add(new Card(16, "Kraken", 12, "water", "spell"));
         *  AllCards.Add(new Card(17, "FireElves", 14, "fire", "monster"));
         *  AllCards.Add(new Card(18, "FireTroll", 13, "fire", "spell"));
         *  AllCards.Add(new Card(19, "WaterTroll", 18, "water", "spell"));
         *  AllCards.Add(new Card(20, "WaterElves", 11, "water", "spell"));
         * }
         */

        public string randomZu()
        {
            string pack = "";
            int    index;

            do
            {
                Random rnd = new Random();
                index = rnd.Next(0, AllCards.Count - 1);
                Card c1 = AllCards[index];
                if (!Package.Contains(c1))
                {
                    Package.Add(c1);
                }
            } while (Package.Count != 5);


            //Console.WriteLine("r1: {0}", index);

            foreach (Object obj in Package)
            {
                //Console.Write("   {0}", obj);
                pack = pack + obj;
            }
            Console.WriteLine();
            //Console.WriteLine("DAS IST PACK: {0}", pack);
            Package.Clear();
            return(pack);
        }
        public void TestSellPackage()
        {
            var shop1 = new Shop(1, "Дикси", "Сытнинская ул., 4");

            shop1.DeliverProducts(100, "Black Monster Energy Ultra", 75, 20);
            shop1.DeliverProducts(101, "Pepsi", 36.5, 100);
            shop1.DeliverProducts(102, "Pepsi", 70, 90);
            shop1.DeliverProducts(103, "Snickers", 50, 45);
            shop1.DeliverProducts(104, "M&M's", 120, 30);
            shop1.DeliverProducts(105, "Dr. Pepper", 57, 40);
            shop1.DeliverProducts(106, "AriZona", 129, 15);
            shop1.DeliverProducts(107, "Mars", 37, 50);
            shop1.DeliverProducts(108, "Pringles", 90, 25);
            shop1.DeliverProducts(109, "M1911", 15500, 10);

            Package pack1 = new Package();

            pack1.Add(100, 10);
            pack1.Add(100, 5);
            pack1.Add(106, 10);
            pack1.Add(109, 2);

            Assert.AreEqual(33415, shop1.SellPackage(pack1));

            var shop2 = new Shop(2, "Дикси", "Саблинская ул., 13/15");

            try
            {
                shop2.SellPackage(pack1);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.AreEqual("No Product in the Shop №2 with Code 100!", e.Message);
            }
            shop2.DeliverProducts(100, "Black Monster Energy Ultra", 75, 5);
            try
            {
                shop2.SellPackage(pack1);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.AreEqual("Shop №2 can't sell enough Product №100 !", e.Message);
            }
        }
 public IEnumerable <IProduct> Resolve(ProductComplexViewModel source, Package destination, IEnumerable <IProduct> destMember, ResolutionContext context)
 {
     if (source.Parts != null)
     {
         source.Parts.ToList().ForEach(x => destination.Add(context.Mapper.Map <IProduct>(x)));
     }
     //return destination.Parts;
     return(null);
 }
Beispiel #6
0
        private void ProcessOneClickOrder(Product product, Card creditCard)
        {
            Package package;

            SendMessage(typeof(Customer), "ProcessingOneClickOrder");

            package = new Package();
            package.Add(product);

            SendMessage(typeof(Visa), "ChargeRequest", creditCard, product.Price, package);
        }
Beispiel #7
0
        public static void GetMessages(ref Package pkg)
        {
            DeCompress(pkg.codedBytes, ref pkg.originBytes, pkg.originLength);

            int offset = 0;

            while (offset < pkg.originLength)
            {
                CopyArrayToMsg(pkg.originBytes, out Message msg, ref offset);
                pkg.Add(msg);
            }
        }
        public Package Build()
        {
            var diagnostics = new DiagnosticsBuilder(packageSyntax.Diagnostics);
            var package = new Package(packageSyntax);
            var references = GetPackageReferences(package);
            package.Add(references);
            var globalDeclarations = new DeclarationBuilder(packageSyntax).Build();
            BuildDeclarations(package.GlobalNamespace, globalDeclarations);
            package.FindEntities();
            package.FindEntryPoints();
            var binders = new BindersBuilder(package).Build(diagnostics);
            // TODO resolve entity types

            Resolve(package, binders); // use binders to resolve rest of semantic model
                                       // TODO type check
                                       // TODO borrow check
            package.Set(diagnostics);
            return package;
        }
Beispiel #9
0
        public void Add_WhenPackageInfoIsCurrent_AddOperationIsNotCalled()
        {
            var packages = PackageSets.Instance.Many(kPackageTestName, 3, true);

            Factory.Packages = packages;
            var package            = new Package(kPackageTestName, packages);
            var addOperationCalled = false;

            OnAddOperation = operation =>
            {
                addOperationCalled = true;
            };

            package.AddSignal.OnOperation += OnAddOperation;
            package.Add(packages.First());
            package.AddSignal.OnOperation -= OnAddOperation;

            Assert.IsFalse(addOperationCalled);
        }
Beispiel #10
0
        public void PackStandard(PackageDescriptor desc)
        {
            // 'standard'
            List <Pattern> old = q.exclusions;

            q.exclusions = new List <Pattern>(old);
            q.exclusions.Add(new Pattern("^/Core/[^/]+.sln")); //Don't include the regular solution files, they won't load properly.
            using (var p = new Package(desc.Path, this.f.ParentPath)) {
                p.Add(q.files("^/dlls/release/ImageResizer.(Mvc.)?(dll|pdb|xml)$"), "/");
                p.Add(q.files("^/dlls/(debug|release)/"));
                p.Add(q.files("^/submodules/studiojs"), "/StudioJS"); //Copy submodules/studiojs -> /StudioJS
                p.Add(q.files("^/(core|samples)/"));
                p.Add(q.files("^/[^/]+.txt$"));
                p.Add(q.files("^/Web.config$"));
            }
            q.exclusions = old;
        }
        private void ProcessOneClickOrder(Product product, Card creditCard)
        {
            Package package;

            SendMessage(typeof(Customer), "ProcessingOneClickOrder");

            package = new Package();
            package.Add(product);

            SendMessage(typeof(Visa), "ChargeRequest", creditCard, product.Price, package);
        }
Beispiel #12
0
        /// <summary>
        /// Execute the specified args.
        /// </summary>
        /// <param name="args">Arguments.</param>
        public override void Execute(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("arguments unvalid number :");
                Process.Handle(new string[2] {
                    "HELP", Name
                });
                return;
            }

            var resDirectory = args [0];
            var pakName      = args [1];

            if (!Directory.Exists(resDirectory))
            {
                Console.WriteLine("Directory not exists");
                return;
            }

            var pak = new Package(pakName);

            foreach (var file in Directory.GetFiles(resDirectory))
            {
                var extensions = Path.GetExtension(file).ToLower();
                var key        = Path.GetFileName(file);

                if (extensions == ".png" || extensions == ".jpg" || extensions == ".bmp")
                {
                    var isAdded = pak.Add(typeof(Texture), key, file);

                    if (isAdded)
                    {
                        Console.WriteLine(string.Format("Texture {0} added", file));
                    }
                }
                else if (extensions == "ttf" || extensions == "otf")
                {
                    var isAdded = pak.Add(typeof(Font), key, file);

                    if (isAdded)
                    {
                        Console.WriteLine(string.Format("Font {0} added", file));
                    }
                }
                else if (extensions == "wav")
                {
                    var isAdded = pak.Add(typeof(SoundBuffer), key, file);

                    if (isAdded)
                    {
                        Console.WriteLine(string.Format("Font {0} added", file));
                    }
                }
                else
                {
                    Console.WriteLine(string.Format("Unsupport file type : {0}", file));
                }
            }

            Package.Save(pak, resDirectory);
            Console.WriteLine("Resources added to pak {0}", pak.Name);
        }
        public void TestFindCheapestSource3()
        {
            var shop1 = new Shop(1, "Дикси", "Сытнинская ул., 4");

            shop1.DeliverProducts(100, "Black Monster Energy Ultra", 75, 20);
            shop1.DeliverProducts(101, "Pepsi", 36.5, 100);
            shop1.DeliverProducts(102, "Pepsi", 70, 90);
            shop1.DeliverProducts(103, "Snickers", 50, 45);
            shop1.DeliverProducts(104, "M&M's", 120, 30);
            shop1.DeliverProducts(105, "Dr. Pepper", 57, 40);
            shop1.DeliverProducts(106, "AriZona", 129, 15);
            shop1.DeliverProducts(107, "Mars", 37, 50);
            shop1.DeliverProducts(108, "Pringles", 90, 25);
            shop1.DeliverProducts(109, "M1911", 15500, 10);



            var shop2 = new Shop(2, "Дикси", "Саблинская ул., 13/15");

            shop2.DeliverProducts(100, "Black Monster Energy Ultra", 75.9, 22);
            shop2.DeliverProducts(101, "Pepsi", 36, 100);
            shop2.DeliverProducts(102, "Pepsi", 70, 90);
            shop2.DeliverProducts(103, "Snickers", 50, 45);
            shop2.DeliverProducts(104, "M&M's", 128.9, 30);
            shop2.DeliverProducts(105, "Dr. Pepper", 56.9, 40);
            shop2.DeliverProducts(106, "AriZona", 128.5, 15);
            shop2.DeliverProducts(107, "Mars", 37, 50);
            shop2.DeliverProducts(108, "Pringles", 90, 30);
            shop2.DeliverProducts(109, "M1911", 15490, 12);

            var shop3 = new Shop(3, "Реалъ", "Кирочная ул., 18");

            shop3.DeliverProducts(100, "Black Monster Energy Ultra", 90, 60);
            shop3.DeliverProducts(101, "Pepsi", 38, 111);
            shop3.DeliverProducts(102, "Pepsi", 69.9, 90);
            shop3.DeliverProducts(103, "Snickers", 50, 45);
            shop3.DeliverProducts(104, "M&M's", 123, 30);
            shop3.DeliverProducts(105, "Dr. Pepper", 60, 70);
            shop3.DeliverProducts(106, "AriZona", 128, 25);
            shop3.DeliverProducts(107, "Mars", 37, 60);
            shop3.DeliverProducts(108, "Pringles", 100, 40);
            shop3.DeliverProducts(109, "M1911", 55490, 2);

            var shop4 = new Shop(4, "SPAR", "Фурштатская ул., 2/12, лит.А");

            shop4.DeliverProducts(100, "Black Monster Energy Ultra", 100, 55);
            shop4.DeliverProducts(101, "Pepsi", 37, 35);
            shop4.DeliverProducts(102, "Pepsi", 69.9, 75);
            shop4.DeliverProducts(103, "Snickers", 49.9, 45);
            shop4.DeliverProducts(104, "M&M's", 130, 100);
            shop4.DeliverProducts(105, "Dr. Pepper", 65, 70);
            shop4.DeliverProducts(106, "AriZona", 128, 25);
            shop4.DeliverProducts(107, "Mars", 36, 80);
            shop4.DeliverProducts(108, "Pringles", 97, 60);
            shop4.DeliverProducts(109, "M1911", 45500, 1);

            var myShops = new StoreChain(new List <Shop>()
            {
                shop1, shop2, shop3, shop4
            });

            Package pack1 = new Package();

            pack1.Add(100, 10);
            pack1.Add(100, 5);
            pack1.Add(106, 10);
            pack1.Add(109, 2);

            Package pack2 = new Package();

            pack2.Add(100, 10);
            pack2.Add(100, 5);
            pack2.Add(106, 1000);
            pack2.Add(109, 2);
            try
            {
                myShops.FindCheapestSource(pack2);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.AreEqual("Can't buy all products in any shop.", e.Message);
            }
        }
Beispiel #14
0
 public void AddSavories()
 {
     p.Add("1 Savories");
 }
Beispiel #15
0
 private void AddToCart(Product product)
 {
     _user_cart.Add(product);
 }
Beispiel #16
0
 public int AddPackage(Model.PO.PackagePO package)
 {
     return(_daoPackage.Add(package));
 }
Beispiel #17
0
        public void PackFull(PackageDescriptor desc)
        {
            // 'full'
            using (var p = new Package(desc.Path, this.f.ParentPath)) {
                p.Add(q.files("^/(core|contrib|core.mvc|plugins|samples|tests|studiojs)/"));
                p.Add(q.files("^/tools/COMInstaller"));
                p.Add(q.files("^/dlls/(debug|release)"));
                p.Add(q.files("^/dlls/release/ImageResizer.(Mvc.)?(dll|pdb|xml)$"), "/"); //Make a copy in the root
                p.Add(q.files("^/submodules/studiojs"), "/StudioJS");                     //Copy submodules/studiojs -> /StudioJS
                p.Add(q.files("^/submodules/(lightresize|libwebp-net)"));
                p.Add(q.files("^/[^/]+.txt$"));
                p.Add(q.files("^/Web.config$"));

                //Make a empty sample app for IIS
                p.Add(q.files("^/dlls/release/ImageResizer.(Mvc.)?(dll|pdb)$"), "/Samples/BasicIISSite/bin/");
                p.Add(q.files("^/dlls/release/ImageResizer.(Mvc.)?(dll|pdb)$"), "/Samples/SampleAspSite/bin/");
                p.Add(q.files("^/dlls/release/ImageResizer.Plugins.RemoteReader.(dll|pdb)$"), "/Samples/SampleAspSite/bin/");
                p.Add(q.files("^/Web.config$"), "/Samples/BasicIISSite/");
            }
        }