コード例 #1
0
        public ActionResult Edit(Edition edition)
        {
            if (ModelState.IsValid)
            {
                //if entity is new, it will not pass through TransferFromTo() and we must attach the serials
                if(edition.IsTransient() && edition.Limited)
                        for (int i = 1; i <= edition.LimitedQty; i++)
                            edition.LimitedEditionSerials.Add(new LimitedEditionSerial { Edition = edition, Number = i });

                var artworkId = edition.Artwork.Id;
                edition.Artwork = _artworkRepository.Get(artworkId);
                var confirmation = _editionTasks.SaveOrUpdate(edition);
                if (confirmation.WasSuccessful)
                {
                    //edition may have been deleted, orphaning the serials.  Search and delete
                    var serialsToDelete = _limitedEditionSerialRepository.GetAll().GetToBeDeleted().ToList();
                    foreach(var item in serialsToDelete)
                    {
                        _limitedEditionSerialCudTasks.Delete(item.Id);
                    }
                    TempData["message"] = confirmation.Message;
                    return RedirectToAction("Edit", "Artwork", new { id = artworkId });
                }

                ViewData["message"] = confirmation.Message;
            }
            return View(_editionTasks.CreateEditViewModel(edition));
        }
コード例 #2
0
ファイル: LoaderEventArgs.cs プロジェクト: vandango/Lhurgoyf
 public LoaderEventArgs(Card card, Edition edition, int index, int maxIndex)
 {
     this.Card = card;
     this.Edition = edition;
     this.Index = index;
     this.MaxIndex = maxIndex;
 }
コード例 #3
0
ファイル: AutoUpdater.cs プロジェクト: lapuinka/naps2
 public AutoUpdater(ILatestVersionSource latestVersionSource, ICurrentVersionSource currentVersionSource, IUrlFileDownloader urlFileDownloader, Edition edition)
 {
     this.latestVersionSource = latestVersionSource;
     this.currentVersionSource = currentVersionSource;
     this.urlFileDownloader = urlFileDownloader;
     this.edition = edition;
 }
コード例 #4
0
 public ImageLoaderEventArgs(Card card, Edition edition, int index, TimeSpan totalTime, TimeSpan loadingTime)
 {
     this.Card = card;
     this.Edition = edition;
     this.Index = index;
     this.TotalTime = totalTime;
     this.LoadingTime = loadingTime;
 }
コード例 #5
0
ファイル: AutoUpdaterTests.cs プロジェクト: rprenhol/naps2
 private AutoUpdater GetAutoUpdater(Edition edition)
 {
     //const string versionFileUrl = "https://sourceforge.net/p/naps2/code/ci/master/tree/version.xml?format=raw";
     // TODO: Make these tests fully offline (configurable, preferably)
     string versionFileUrl = "file://" + Path.Combine(Environment.CurrentDirectory, "../../../version.xml");
     return new AutoUpdater(new LatestVersionSource(versionFileUrl, new UrlStreamReader()),
         new CurrentVersionSource(), new UrlFileDownloader(new UrlStreamReader()), edition);
 }
コード例 #6
0
        public async Task<ActionResult> TradeInfo(int sectorX, int sectorY, int hexX, int hexY, int maxJumpDistance, bool advancedMode = false, bool illegalGoods = false, int brokerScore = 0, Edition edition = Edition.MGT, int? seed = null, bool advancedCharacters = false, int streetwiseScore = 0)
        {
            ManifestCollection model = null;

            if (edition == Edition.MGT)
                model = await Global.TradeEngineMgt.BuildManifestsAsync(sectorX, sectorY, hexX, hexY, maxJumpDistance, advancedMode, illegalGoods, brokerScore, seed, advancedCharacters, streetwiseScore);
            else if (edition == Edition.MGT2)
                model = await Global.TradeEngineMgt2.BuildManifestsAsync(sectorX, sectorY, hexX, hexY, maxJumpDistance, advancedMode, illegalGoods, brokerScore, seed, advancedCharacters, streetwiseScore);

            return View(model);
        }
コード例 #7
0
        public ActionResult EditEdition(Edition edition)
        {
            if (ModelState.IsValid)
            {
                int artworkId = edition.Artwork.Id;
                edition.Artwork = _artworkRepository.Get(artworkId);
                ActionConfirmation<Edition> confirmation = _editionTasks.SaveOrUpdate(edition);
                if (confirmation.WasSuccessful)
                {
                    TempData["message"] = confirmation.Message;
                    return RedirectToAction("Edit", new{id = artworkId});
                }

                ViewData["message"] = confirmation.Message;
            }
            return View(_editionTasks.CreateEditViewModel(edition));
        }
コード例 #8
0
        public static List<string> Sort(List<Book> books, List<Magazine> magazines)
        {
            var edition = new List<Edition>();
            foreach (var book in books)
            {
                var editionItem = new Edition() { EditionName = book.Name, Order = book.Id };
                edition.Add(editionItem);
            }

            foreach (var magazine in magazines)
            {
                var editionItem = new Edition() { EditionName = magazine.Title, Order = magazine.ISBN };
                edition.Add(editionItem);
            }

            var stringList = new List<string>();
            var orderEditions = edition.OrderBy(x => x.EditionName).ToList();

            while (true)
            {
                if (orderEditions.Count < 1)
                {
                    break;
                }

                var tempEditionList = new List<Edition>();
                var currentItem = orderEditions.FirstOrDefault();
                for (int i = 0; i < orderEditions.Count; i++)
                {
                    if (orderEditions[i].EditionName == currentItem.EditionName)
                    {
                        tempEditionList.Add(orderEditions[i]);
                        orderEditions.Remove(orderEditions[i]);
                        i--;
                    }
                }
                var orderedTemp = tempEditionList.OrderBy(x => x.Order).ToList();
                foreach (var item in orderedTemp)
                {
                    stringList.Add(String.Format("{0} - {1}", item.EditionName, item.Order));
                }
                orderedTemp.Clear();
            }
            return stringList;
        }
コード例 #9
0
        public void Parse()
        {
            {
                string url = "sitemap.html";
                UrlScraper scraper = new UrlScraper();
                string html = scraper.Scrape(McdiSiteParser.PREFIX + url);

                int startpos = html.IndexOf("<h2>");
                //int endpos = startpos + 400;
                int endpos = html.IndexOf("<h2>", startpos + 1);
                string leftToken = "<li><a href=\"";
                string split1Token = "\">";
                string split2Token = "</a> <small style=\"color: #aaa;\">";
                string rightToken = "</small></li>";

                // While what we are about to process is english...
                int curpos = startpos;
                while (html.IndexOf(leftToken, curpos) < endpos)
                {
                    int leftIndex = html.IndexOf(leftToken, curpos);
                    int split1Index = html.IndexOf(split1Token, leftIndex);
                    int split2Index = html.IndexOf(split2Token, split1Index);
                    int rightIndex = html.IndexOf(rightToken, split2Index);

                    Edition edition = new Edition();
                    edition.SourceUrl = html.Substring(leftIndex + leftToken.Length, split1Index - leftIndex - leftToken.Length);
                    edition.Name = html.Substring(split1Index + split1Token.Length, split2Index - split1Index - split1Token.Length);
                    edition.Abbreviation = html.Substring(split2Index + split2Token.Length, rightIndex - split2Index - split2Token.Length);

                    // Collect
                    database.Editions.Add(edition);

                    curpos = rightIndex;
                }
            }

            // Process the sets
            foreach (Edition ed in database.Editions)
            {
                System.Console.WriteLine("====" + ed + ":" + ed.SourceUrl + "====");
                McdiEditionParser editionParser = new McdiEditionParser(database);
                editionParser.ParseUrl(ed.SourceUrl);
                //break;
            }
        }
コード例 #10
0
        /// <summary>
        /// Generates the model from user input.
        /// </summary>
        /// <param name="model">This is null since the instance doesn't exist yet</param>
        /// <returns>The generated model from user input</returns>
        protected override IEnumerable <Model.AzureSqlManagedInstanceModel> ApplyUserInputToModel(IEnumerable <Model.AzureSqlManagedInstanceModel> model)
        {
            List <Model.AzureSqlManagedInstanceModel> newEntity = new List <Model.AzureSqlManagedInstanceModel>();

            Management.Internal.Resources.Models.Sku Sku = new Management.Internal.Resources.Models.Sku();

            if (string.Equals(this.ParameterSetName, NewBySkuNameParameterSet, System.StringComparison.OrdinalIgnoreCase))
            {
                Sku.Name = SkuName;
            }
            else if (string.Equals(this.ParameterSetName, NewByEditionAndComputeGenerationParameterSet, System.StringComparison.OrdinalIgnoreCase))
            {
                string editionShort = Edition.Equals(Constants.GeneralPurposeEdition) ? "GP" : Edition.Equals(Constants.BusinessCriticalEdition) ? "BC" : "Unknown";
                Sku.Name = editionShort + "_" + ComputeGeneration;
            }

            newEntity.Add(new Model.AzureSqlManagedInstanceModel()
            {
                Location                 = this.Location,
                ResourceGroupName        = this.ResourceGroupName,
                FullyQualifiedDomainName = this.Name,
                AdministratorLogin       = this.AdministratorCredential.UserName,
                AdministratorPassword    = this.AdministratorCredential.Password,
                Tags            = TagsConversionHelper.CreateTagDictionary(Tag, validate: true),
                Identity        = ResourceIdentityHelper.GetIdentityObjectFromType(this.AssignIdentity.IsPresent),
                LicenseType     = this.LicenseType,
                StorageSizeInGB = this.StorageSizeInGB,
                SubnetId        = this.SubnetId,
                VCores          = this.VCore,
                Sku             = Sku
            });
            return(newEntity);
        }
コード例 #11
0
 public long InsertEdition(Edition e)
 {
     return(_db.Insert(e));
 }
コード例 #12
0
        public async Task <ActionResult> TradeInfo(int sectorX, int sectorY, int hexX, int hexY, int maxJumpDistance, bool advancedMode = false, bool illegalGoods = false, int brokerScore = 0, Edition edition = Edition.MGT, int?seed = null, bool advancedCharacters = false, int streetwiseScore = 0)
        {
            ManifestCollection model = null;

            if (edition == Edition.MGT)
            {
                model = await Global.TradeEngineMgt.BuildManifestsAsync(sectorX, sectorY, hexX, hexY, maxJumpDistance, advancedMode, illegalGoods, brokerScore, seed, advancedCharacters, streetwiseScore);
            }
            else if (edition == Edition.MGT2)
            {
                model = await Global.TradeEngineMgt2.BuildManifestsAsync(sectorX, sectorY, hexX, hexY, maxJumpDistance, advancedMode, illegalGoods, brokerScore, seed, advancedCharacters, streetwiseScore);
            }

            return(View(model));
        }
コード例 #13
0
        /// <summary>
        /// Constructs the model to send to the update API
        /// </summary>
        /// <param name="model">The result of the get operation</param>
        /// <returns>The model to send to the update</returns>
        protected override IEnumerable <Model.AzureSqlManagedInstanceModel> ApplyUserInputToModel(IEnumerable <Model.AzureSqlManagedInstanceModel> model)
        {
            AzureSqlManagedInstanceModel existingInstance = ModelAdapter.GetManagedInstance(this.ResourceGroupName, this.Name);

            Management.Internal.Resources.Models.Sku Sku = new Management.Internal.Resources.Models.Sku();

            if (Edition != null)
            {
                string computeGeneration = existingInstance.Sku.Name.Contains(Constants.ComputeGenerationGen4) ? Constants.ComputeGenerationGen4 : Constants.ComputeGenerationGen5;
                string editionShort      = Edition.Equals(Constants.GeneralPurposeEdition) ? "GP" : Edition.Equals(Constants.BusinessCriticalEdition) ? "BC" : "Unknown";
                Sku.Name = editionShort + "_" + computeGeneration;
                Sku.Tier = Edition;
            }
            else
            {
                Sku = null;
            }

            // Construct a new entity so we only send the relevant data to the Managed instance
            List <Model.AzureSqlManagedInstanceModel> updateData = new List <Model.AzureSqlManagedInstanceModel>();

            updateData.Add(new Model.AzureSqlManagedInstanceModel()
            {
                ResourceGroupName        = this.ResourceGroupName,
                ManagedInstanceName      = this.Name,
                FullyQualifiedDomainName = this.Name,
                Location = model.FirstOrDefault().Location,
                Sku      = Sku,
                AdministratorPassword = this.AdministratorPassword,
                LicenseType           = this.LicenseType,
                StorageSizeInGB       = this.StorageSizeInGB,
                VCores   = this.VCore,
                Tags     = TagsConversionHelper.CreateTagDictionary(Tag, validate: true),
                Identity = model.FirstOrDefault().Identity ?? ResourceIdentityHelper.GetIdentityObjectFromType(this.AssignIdentity.IsPresent),
            });
            return(updateData);
        }
コード例 #14
0
 private Task SetFeatureValues(Edition edition, List <NameValueDto> featureValues)
 {
     return(_editionManager.SetFeatureValuesAsync(edition.Id,
                                                  featureValues.Select(fv => new NameValue(fv.Name, fv.Value)).ToArray()));
 }
コード例 #15
0
        public async Task DeleteEdition(EntityRequestInput input)
        {
            Edition byIdAsync = await this._editionManager.GetByIdAsync(input.Id);

            await this._editionManager.DeleteAsync(byIdAsync);
        }
コード例 #16
0
        internal static void Run(
            Edition plasticEdition,
            string installerDestinationPath,
            ProgressControlsForDialogs progressControls)
        {
            ((IProgressControls)progressControls).ShowProgress(
                PlasticLocalization.GetString(PlasticLocalization.Name.DownloadingProgress));

            NewVersionResponse plasticVersion = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                plasticVersion = WebRestApiClient.PlasticScm.
                                 GetLastVersion(plasticEdition);

                if (plasticVersion == null)
                {
                    return;
                }

                string installerUrl = GetInstallerUrl(
                    plasticVersion.Version,
                    plasticEdition == Edition.Cloud);

                DownloadInstaller(
                    installerUrl,
                    installerDestinationPath,
                    progressControls);

                if (!PlatformIdentifier.IsMac())
                {
                    return;
                }

                installerDestinationPath = UnZipMacOsPackage(
                    installerDestinationPath);
            },
                /*afterOperationDelegate*/ delegate
            {
                ((IProgressControls)progressControls).HideProgress();

                if (waiter.Exception != null)
                {
                    ((IProgressControls)progressControls).ShowError(
                        waiter.Exception.Message);
                    return;
                }

                if (plasticVersion == null)
                {
                    ((IProgressControls)progressControls).ShowError(
                        PlasticLocalization.GetString(PlasticLocalization.Name.ConnectingError));
                    return;
                }

                if (!File.Exists(installerDestinationPath))
                {
                    return;
                }

                RunInstaller(
                    installerDestinationPath,
                    progressControls);
            });
        }
コード例 #17
0
 protected EditionProperties(Edition edition)
 {
     Edition = edition;
     InstanceMap[edition] = this;
 }
コード例 #18
0
 protected Card(
     string name,
     Expansion expansion,
     int coinCost      = 0,
     int potionCost    = 0,
     int debtCost      = 0,
     Edition edition   = Edition.First,
     bool isDeprecated = false,
     string pluralName = null,
     StartingLocation startingLocation = Dominion.StartingLocation.Supply,
     int plusActions = 0,
     int plusBuy     = 0,
     int plusCards   = 0,
     int plusCoins   = 0,
     VictoryPointCounter victoryPoints = null,
     int plusVictoryToken             = 0,
     int defaultSupplyCount           = 10,
     bool isAction                    = false,
     bool isAttack                    = false,
     bool attackDependsOnPlayerChoice = false,
     bool isAttackBeforeAction        = false,
     bool isCurse              = false,
     bool isReaction           = false,
     bool isNight              = false,
     bool isPrize              = false,
     bool isRuins              = false,
     bool isTreasure           = false,
     bool isDuration           = false,
     bool isLooter             = false,
     bool requiresSpoils       = false,
     bool isShelter            = false,
     bool isTraveller          = false,
     bool isReserve            = false,
     bool isGathering          = false,
     bool isHeirloom           = false,
     bool isFate               = false,
     bool isDoom               = false,
     bool isZombie             = false,
     bool isSpirit             = false,
     bool isCastle             = false,
     bool canOverpay           = false,
     bool canGivePlusAction    = false,
     bool mightMultiplyActions = false,
     bool isKingdomCard        = true,
     CardIntValue provideDiscountForWhileInPlay                    = null,
     GameStateMethod doSpecializedCleanupAtStartOfCleanup          = null,
     GameStateCardMethod doSpecializedActionOnBuyWhileInPlay       = null,
     GameStateCardPredicate doSpecializedActionOnTrashWhileInHand  = null,
     GameStateCardToPlacement doSpecializedActionOnGainWhileInPlay = null,
     GameStateCardToPlacement doSpecializedActionOnBuyWhileInHand  = null,
     GameStateCardToPlacement doSpecializedActionOnGainWhileInHand = null,
     GameStateCardMethod doSpecializedActionToCardWhileInPlay      = null)
     : base(name, expansion, edition, isDeprecated, pluralName)
 {
     this.coinCost                    = coinCost;
     this.potionCost                  = potionCost;
     this.debtCost                    = debtCost;
     this.plusAction                  = plusActions;
     this.plusBuy                     = plusBuy;
     this.plusCard                    = plusCards;
     this.plusCoin                    = plusCoins;
     this.victoryPointCounter         = victoryPoints;
     this.plusVictoryToken            = plusVictoryToken;
     this.isAction                    = isAction;
     this.isAttack                    = isAttack;
     this.attackDependsOnPlayerChoice = attackDependsOnPlayerChoice;
     this.isAttackBeforeAction        = isAttackBeforeAction;
     this.isCurse                     = isCurse;
     this.isReaction                  = isReaction;
     this.isNight                     = isNight;
     this.isPrize                     = isPrize;
     this.isRuins                     = isRuins;
     this.isTreasure                  = isTreasure;
     this.isFate                                = isFate;
     this.isDoom                                = isDoom;
     this.isHeirloom                            = isHeirloom;
     this.isSpirit                              = isSpirit;
     this.isZombie                              = isZombie;
     this.isCastle                              = isCastle;
     this.isLooter                              = isLooter;
     this.defaultSupplyCount                    = defaultSupplyCount;
     this.isLooter                              = isLooter;
     this.isDuration                            = isDuration;
     this.isShelter                             = isShelter;
     this.isTraveller                           = isTraveller;
     this.isReserve                             = isReserve;
     this.isGathering                           = isGathering;
     this.isKingdomCard                         = isKingdomCard;
     this.requiresSpoils                        = requiresSpoils;
     this.canOverpay                            = canOverpay;
     this.canGivePlusAction                     = canGivePlusAction;
     this.mightMultiplyActions                  = mightMultiplyActions;
     this.provideDiscountForWhileInPlay         = provideDiscountForWhileInPlay;
     this.doSpecializedCleanupAtStartOfCleanup  = doSpecializedCleanupAtStartOfCleanup;
     this.doSpecializedActionOnBuyWhileInPlay   = doSpecializedActionOnBuyWhileInPlay;
     this.doSpecializedActionOnTrashWhileInHand = doSpecializedActionOnTrashWhileInHand;
     this.doSpecializedActionOnGainWhileInPlay  = doSpecializedActionOnGainWhileInPlay;
     this.doSpecializedActionOnBuyWhileInHand   = doSpecializedActionOnBuyWhileInHand;
     this.doSpecializedActionOnGainWhileInHand  = doSpecializedActionOnGainWhileInHand;
     this.doSpecializedActionToCardWhileInPlay  = doSpecializedActionToCardWhileInPlay;
 }
コード例 #19
0
ファイル: CandidateEdition.cs プロジェクト: whoshoe/Readarr
 public CandidateEdition(Edition edition)
 {
     Edition       = edition;
     ExistingFiles = new List <BookFile>();
 }
コード例 #20
0
        public static void Run()
        {
            //StreamReader reader = new StreamReader(@"data\cards.xml");

            //string buffer = reader.ReadToEnd();

            //reader.Close();
            //reader.Dispose();

            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(buffer);

            int  index      = 0;
            bool setsLoaded = false;

            XmlNodeList mainNodeList = _xmlDoc.SelectNodes("//cockatrice_carddatabase");
            int         globalIndex  = 0;

            foreach (XmlNode node in mainNodeList)
            {
                if (node.HasChildNodes)
                {
                    foreach (XmlNode sub in node.ChildNodes)
                    {
                        switch (sub.Name)
                        {
                        case "sets":
                            /*
                             * SETS
                             * */
                            if (sub.HasChildNodes)
                            {
                                foreach (XmlNode item in sub.ChildNodes)
                                {
                                    XmlNode nameNode     = item.ChildNodes[0];
                                    XmlNode longNameNode = item.ChildNodes[1];

                                    // correct some edition short names
                                    string shortName = nameNode.InnerText;

                                    //if(shortName == "COM") {
                                    //    shortName = "CMD";
                                    //}

                                    Edition edition = new Edition();
                                    edition.Id        = index;
                                    edition.Name      = longNameNode.InnerText;
                                    edition.Shortname = shortName;

                                    index++;

                                    Toenda.Lhurgoyf.Data.CardBase.Editions.Add(edition);

                                    // raise event
                                    if (LoaderResponse != null)
                                    {
                                        LoaderResponse(new LoaderEventArgs(
                                                           null,
                                                           edition,
                                                           globalIndex,
                                                           MaxItems
                                                           ));
                                    }
                                }
                            }
                            break;

                        case "cards":
                            /*
                             * CARDS
                             * */
                            if (!setsLoaded)
                            {
                                index = 0;
                            }

                            setsLoaded = true;

                            if (sub.HasChildNodes)
                            {
                                foreach (XmlNode item in sub.ChildNodes)
                                {
                                    if (item.HasChildNodes)
                                    {
                                        Card card = new Card();

                                        card.Id = index;
                                        //card.Color = "";

                                        foreach (XmlNode single in item.ChildNodes)
                                        {
                                            switch (single.Name)
                                            {
                                            case "name":
                                                card.Name = single.InnerText;
                                                break;

                                            case "set":
                                                string editionShortName = single.InnerText;

                                                //if(editionShortName == "COM") {
                                                //    editionShortName = "CMD";
                                                //}

                                                string picture = single.Attributes["picURL"].InnerText;

                                                List <Edition> editions = CardFinder.FindEditionByName(editionShortName);

                                                if (editions != null &&
                                                    editions.Count > 0)
                                                {
                                                    foreach (Edition edition in editions)
                                                    {
                                                        card.EditionPictures.Add(
                                                            edition,
                                                            new EditionImage()
                                                        {
                                                            Url     = new Uri(picture),
                                                            Edition = edition,
                                                            Card    = card
                                                        }
                                                            );

                                                        //var ediPics =
                                                        //    from ediItem in card.EditionPictures
                                                        //    where ediItem.Key.Id == edition.Id
                                                        //    && ediItem.Key.Name == edition.Name
                                                        //    && ediItem.Key.Shortname == edition.Shortname
                                                        //    select ediItem;

                                                        //if(ediPics.Count() == 0) {
                                                        //    card.EditionPictures.Add(
                                                        //        edition,
                                                        //        new EditionImage() {
                                                        //            Url = new Uri(picture),
                                                        //            //BitmapStream = file,
                                                        //            Edition = edition,
                                                        //            Card = card
                                                        //        }
                                                        //    );
                                                        //}
                                                        //else {
                                                        //    card.EditionPictures[edition] = new EditionImage() {
                                                        //        Url = new Uri(picture),
                                                        //        //BitmapStream = file,
                                                        //        Edition = edition,
                                                        //        Card = card
                                                        //    };
                                                        //}
                                                    }
                                                }
                                                break;

                                            case "color":
                                                card.Color.Add(new CardColor()
                                                {
                                                    Symbol = single.InnerText.ToEnum <ColorSymbol>()
                                                });
                                                break;

                                            case "manacost":
                                                card.CastingCost = single.InnerText;
                                                break;

                                            case "type":
                                                card.Type = single.InnerText;
                                                break;

                                            case "pt":
                                                card.PowerThoughness = single.InnerText;
                                                break;

                                            case "tablerow":
                                                break;

                                            case "text":
                                                card.Text = single.InnerText;
                                                break;

                                            default:
                                                break;
                                            }
                                        }

                                        index++;

                                        //card = AddAdditionalInformation(card);

                                        Toenda.Lhurgoyf.Data.CardBase.Cards.Add(card);

                                        // raise event
                                        if (LoaderResponse != null)
                                        {
                                            LoaderResponse(new LoaderEventArgs(
                                                               card,
                                                               null,
                                                               globalIndex,
                                                               MaxItems
                                                               ));
                                        }
                                    }
                                }
                            }
                            break;
                        }

                        globalIndex++;
                    }
                }
            }

            //XmlNodeList setNodeList = doc.SelectNodes("//cockatrice_carddatabase/sets/set");

            //foreach(XmlNode node in setNodeList) {
            //    if(node.HasChildNodes) {
            //        /*
            //         * Nodes look like this:
            //         *
            //            <set>
            //                <name>5E</name>
            //                <longname>Fifth Edition</longname>
            //            </set>
            //         * */

            //        XmlNode nameNode = node.ChildNodes[0];
            //        XmlNode longNameNode = node.ChildNodes[1];

            //        // correct some edition short names
            //        string shortName = nameNode.InnerText;

            //        //if(shortName == "COM") {
            //        //    shortName = "CMD";
            //        //}

            //        Edition edition = new Edition();
            //        edition.Id = index;
            //        edition.Name = longNameNode.InnerText;
            //        edition.Shortname = shortName;

            //        index++;

            //        Toenda.Lhurgoyf.Data.CardBase.Editions.Add(edition);
            //    }
            //}

            //index = 0;

            //XmlNodeList cardNodeList = doc.SelectNodes("//cockatrice_carddatabase/cards/card");

            //foreach(XmlNode node in cardNodeList) {
            //    if(node.HasChildNodes) {
            //        /*
            //         * Nodes look like this:
            //         *
            //            <card>
            //                <name>Counterspell</name>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=14511&amp;type=card" picURLHq="" picURLSt="">6E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=185820&amp;type=card" picURLHq="" picURLSt="">DD2</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=3898&amp;type=card" picURLHq="" picURLSt="">5E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=2148&amp;type=card" picURLHq="" picURLSt="">4E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=2500&amp;type=card" picURLHq="" picURLSt="">IA</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=102&amp;type=card" picURLHq="" picURLSt="">A</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=397&amp;type=card" picURLHq="" picURLSt="">B</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=19570&amp;type=card" picURLHq="" picURLSt="">MM</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=1196&amp;type=card" picURLHq="" picURLSt="">R</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=11214&amp;type=card" picURLHq="" picURLSt="">7E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=20382&amp;type=card" picURLHq="" picURLSt="">ST</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=25503&amp;type=card" picURLHq="" picURLSt="">ST2K</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=4693&amp;type=card" picURLHq="" picURLSt="">TE</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=699&amp;type=card" picURLHq="" picURLSt="">U</set>
            //                <color>U</color>
            //                <manacost>UU</manacost>
            //                <type>Instant</type>
            //                <tablerow>3</tablerow>
            //                <text>Counter target spell.</text>
            //            </card>
            //         * */

            //        Card card = new Card();

            //        card.Id = index;
            //        //card.Color = "";

            //        foreach(XmlNode sub in node.ChildNodes) {
            //            switch(sub.Name) {
            //                case "name":
            //                    card.Name = sub.InnerText;
            //                    break;

            //                case "set":
            //                    string editionShortName = sub.InnerText;

            //                    //if(editionShortName == "COM") {
            //                    //    editionShortName = "CMD";
            //                    //}

            //                    string picture = sub.Attributes["picURL"].InnerText;

            //                    List<Edition> editions = CardFinder.FindEditionByName(editionShortName);

            //                    if(editions != null
            //                    && editions.Count > 0) {
            //                        foreach(Edition edition in editions) {
            //                            var ediPics =
            //                                from item in card.EditionPictures
            //                                where item.Key.Id == edition.Id
            //                                && item.Key.Name == edition.Name
            //                                && item.Key.Shortname == edition.Shortname
            //                                select item;

            //                            //Assembly thisExe = Assembly.GetExecutingAssembly();
            //                            //Stream file = thisExe.GetManifestResourceStream("Toenda.Lhurgoyf.Resources.EmptyCard.bmp");

            //                            if(ediPics.Count() == 0) {
            //                                card.EditionPictures.Add(
            //                                    edition,
            //                                    new EditionImage() {
            //                                        Url = new Uri(picture),
            //                                        //BitmapStream = file,
            //                                        Edition = edition,
            //                                        Card = card
            //                                    }
            //                                );
            //                            }
            //                            else {
            //                                card.EditionPictures[edition] = new EditionImage() {
            //                                    Url = new Uri(picture),
            //                                    //BitmapStream = file,
            //                                    Edition = edition,
            //                                    Card = card
            //                                };
            //                            }
            //                        }
            //                    }
            //                    break;

            //                case "color":
            //                    card.Color.Add(new CardColor() { Symbol = sub.InnerText.ToEnum<ColorSymbol>() });
            //                    //card.Color += sub.InnerText;
            //                    break;

            //                case "manacost":
            //                    card.CastingCost = sub.InnerText;
            //                    break;

            //                case "type":
            //                    card.Type = sub.InnerText;
            //                    break;

            //                case "pt":
            //                    card.PowerThoughness = sub.InnerText;
            //                    break;

            //                case "tablerow":
            //                    break;

            //                case "text":
            //                    card.Text = sub.InnerText;
            //                    break;

            //                default:
            //                    break;
            //            }
            //        }

            //        index++;

            //        Toenda.Lhurgoyf.Data.CardBase.Cards.Add(card);

            //        //Console.WriteLine("card {0} of {1} added...", index, cardNodeList.Count);
            //    }
            //}

            if (LoaderFinish != null)
            {
                LoaderFinish(new LoaderFinishEventArgs("Card database successfull loaded!"));
            }
        }
コード例 #21
0
        public void Setup()
        {
            _bookpass1 = new Mock <IImportDecisionEngineSpecification <LocalEdition> >();
            _bookpass2 = new Mock <IImportDecisionEngineSpecification <LocalEdition> >();
            _bookpass3 = new Mock <IImportDecisionEngineSpecification <LocalEdition> >();

            _bookfail1 = new Mock <IImportDecisionEngineSpecification <LocalEdition> >();
            _bookfail2 = new Mock <IImportDecisionEngineSpecification <LocalEdition> >();
            _bookfail3 = new Mock <IImportDecisionEngineSpecification <LocalEdition> >();

            _pass1 = new Mock <IImportDecisionEngineSpecification <LocalBook> >();
            _pass2 = new Mock <IImportDecisionEngineSpecification <LocalBook> >();
            _pass3 = new Mock <IImportDecisionEngineSpecification <LocalBook> >();

            _fail1 = new Mock <IImportDecisionEngineSpecification <LocalBook> >();
            _fail2 = new Mock <IImportDecisionEngineSpecification <LocalBook> >();
            _fail3 = new Mock <IImportDecisionEngineSpecification <LocalBook> >();

            _bookpass1.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalEdition>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Accept());
            _bookpass2.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalEdition>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Accept());
            _bookpass3.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalEdition>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Accept());

            _bookfail1.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalEdition>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Reject("_bookfail1"));
            _bookfail2.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalEdition>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Reject("_bookfail2"));
            _bookfail3.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalEdition>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Reject("_bookfail3"));

            _pass1.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalBook>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Accept());
            _pass2.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalBook>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Accept());
            _pass3.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalBook>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Accept());

            _fail1.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalBook>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Reject("_fail1"));
            _fail2.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalBook>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Reject("_fail2"));
            _fail3.Setup(c => c.IsSatisfiedBy(It.IsAny <LocalBook>(), It.IsAny <DownloadClientItem>())).Returns(Decision.Reject("_fail3"));

            _author = Builder <Author> .CreateNew()
                      .With(e => e.QualityProfileId = 1)
                      .With(e => e.QualityProfile   = new QualityProfile {
                Items = Qualities.QualityFixture.GetDefaultQualities()
            })
                      .Build();

            _book = Builder <Book> .CreateNew()
                    .With(x => x.Author = _author)
                    .Build();

            _edition = Builder <Edition> .CreateNew()
                       .With(x => x.Book = _book)
                       .Build();

            _quality = new QualityModel(Quality.MP3_320);

            _localTrack = new LocalBook
            {
                Author  = _author,
                Quality = _quality,
                Book    = new Book(),
                Path    = @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi".AsOsAgnostic()
            };

            _idOverrides = new IdentificationOverrides
            {
                Author = _author
            };

            _idConfig = new ImportDecisionMakerConfig();

            GivenAudioFiles(new List <string> {
                @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi".AsOsAgnostic()
            });

            Mocker.GetMock <IIdentificationService>()
            .Setup(s => s.Identify(It.IsAny <List <LocalBook> >(), It.IsAny <IdentificationOverrides>(), It.IsAny <ImportDecisionMakerConfig>()))
            .Returns((List <LocalBook> tracks, IdentificationOverrides idOverrides, ImportDecisionMakerConfig config) =>
            {
                var ret     = new LocalEdition(tracks);
                ret.Edition = _edition;
                return(new List <LocalEdition> {
                    ret
                });
            });

            Mocker.GetMock <IMediaFileService>()
            .Setup(c => c.FilterUnchangedFiles(It.IsAny <List <IFileInfo> >(), It.IsAny <FilterFilesType>()))
            .Returns((List <IFileInfo> files, FilterFilesType filter) => files);

            GivenSpecifications(_bookpass1);
        }
コード例 #22
0
        // Méthode interne du construction du classement ATP pour les méthodes "RecomputeAtpRanking" et "RecomputeAtpLiveRanking"
        private void RecomputeAtpRankingInner(object sender, DoWorkEventArgs evt)
        {
            Dictionary <StatType, uint> statsDictionnary = Enum.GetValues(typeof(StatType)).Cast <StatType>().ToDictionary(st => st, st => (uint)0);

            statsDictionnary.Remove(StatType.round);

            List <Bindings.PlayerAtpRanking> playersRankList = new List <Bindings.PlayerAtpRanking>();

            object[]       arguments = evt.Argument as object[];
            List <Edition> editions  = Edition.GetByPeriod(
                (DateTime)arguments[0],
                (DateTime)arguments[1],
                arguments[3] as IEnumerable <Level>,
                arguments[4] as IEnumerable <Surface>,
                (bool)arguments[5]
                );

            foreach (Edition edition in editions)
            {
                // TODO : peut être pas la meilleure solution.
                if (!edition.StatisticsAreCompute)
                {
                    SqlMapping.Instance.LoadEditionsStatistics(edition);
                }
                foreach (Edition.Stats stat in edition.Statistics)
                {
                    Bindings.PlayerAtpRanking currentBinding = playersRankList.FirstOrDefault(prl => prl.InnerPlayer.ID == stat.Player.ID);
                    if (currentBinding == null)
                    {
                        currentBinding = new Bindings.PlayerAtpRanking(stat.Player, statsDictionnary);
                        playersRankList.Add(currentBinding);
                    }
                    if (currentBinding.Statistics.ContainsKey(stat.StatType))
                    {
                        if (stat.StatType == StatType.is_winner)
                        {
                            Edition.Stats roundStateValue = edition.Statistics.First(s => s.Player.ID == stat.Player.ID && s.StatType == StatType.round);
                            if (roundStateValue.Value == (uint)Round.F)
                            {
                                currentBinding.AggregateStatistic(stat.StatType, stat.Value);
                            }
                        }
                        else
                        {
                            currentBinding.AggregateStatistic(stat.StatType, stat.Value);
                        }
                    }
                }
            }

            // filtrage par nationalité
            if (arguments[6] != null)
            {
                playersRankList.RemoveAll(p => !p.InnerPlayer.Nationality.Equals(((Country)arguments[6]).CodeIso3, StringComparison.InvariantCultureIgnoreCase));
            }

            // Note : à chaque refiltrage, le tri est perdu
            _rankingStatsSortParameter.Clear();
            _rankingStatsSortParameter.Add(StatType.points.ToString(), true);

            Bindings.PlayerAtpRanking.SortAndSetRanking(ref playersRankList, _rankingStatsSortParameter);

            // filtrage par nom
            if (arguments[2] != null && !string.IsNullOrWhiteSpace(arguments[2].ToString()))
            {
                playersRankList.RemoveAll(p => !p.InnerPlayer.Name.ToLowerInvariant().Contains(arguments[2].ToString().ToLowerInvariant()));
            }

            evt.Result = playersRankList;
        }
コード例 #23
0
 public void UpdateEdition(Edition e)
 {
     _db.Update(e);
 }
コード例 #24
0
 public WorldWindow(Edition edition)
 {
     InitializeComponent();
     Edition = edition;
 }
コード例 #25
0
 public void DeleteEdition(Edition e)
 {
     _db.Delete(e);
 }
コード例 #26
0
ファイル: EditionService.cs プロジェクト: BabacarSobel/Amabra
 private void GenerateKnockout(Edition edition)
 {
     throw new NotImplementedException();
 }
コード例 #27
0
 public static EditionProperties FromEdition(Edition edition) => InstanceMap[edition];
コード例 #28
0
 /// <summary>
 /// retrieves data about current available ext-version
 /// </summary>
 /// <param name="targetApp">app this extension is designated for</param>
 /// <param name="targetAppVersion">current version of targetApp</param>
 /// <returns>update data of most recent extension version, or null if no data was found, or feature isn't supported. it is valid to return update data of current version. extension-update will take place only if returned value indicaes a newer version</returns>
 public ExtensionVersionInfo GetUpdateData(Edition targetApp, System.Version targetAppVersion)
 {
     return new ExtensionVersionInfo(extensionVersion, extensionVersionRange, downloadURI);
 }
 public static void FillWithDefaultValues(this EditionTranslation editionTranslation, Edition edition)
 {
     editionTranslation.Edition      = edition;
     editionTranslation.LanguageCode = "en-gb";
     editionTranslation.CreateTime   = DateTime.Now;
     editionTranslation.CreateUser   = 1;
     editionTranslation.UpdateUser   = 1;
 }
コード例 #30
0
 public ExtensionVersionInfo GetUpdateData(Edition targetApp, Version targetAppVersion)
 {
     return null;
 }
コード例 #31
0
ファイル: CockatriceImport.cs プロジェクト: vandango/Lhurgoyf
        public static void Run()
        {
            //StreamReader reader = new StreamReader(@"data\cards.xml");

            //string buffer = reader.ReadToEnd();

            //reader.Close();
            //reader.Dispose();

            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(buffer);

            int index = 0;
            bool setsLoaded = false;

            XmlNodeList mainNodeList = _xmlDoc.SelectNodes("//cockatrice_carddatabase");
            int globalIndex = 0;

            foreach(XmlNode node in mainNodeList) {
                if(node.HasChildNodes) {
                    foreach(XmlNode sub in node.ChildNodes) {
                        switch(sub.Name) {
                            case "sets":
                                /*
                                 * SETS
                                 * */
                                if(sub.HasChildNodes) {
                                    foreach(XmlNode item in sub.ChildNodes) {
                                        XmlNode nameNode = item.ChildNodes[0];
                                        XmlNode longNameNode = item.ChildNodes[1];

                                        // correct some edition short names
                                        string shortName = nameNode.InnerText;

                                        //if(shortName == "COM") {
                                        //    shortName = "CMD";
                                        //}

                                        Edition edition = new Edition();
                                        edition.Id = index;
                                        edition.Name = longNameNode.InnerText;
                                        edition.Shortname = shortName;

                                        index++;

                                        Toenda.Lhurgoyf.Data.CardBase.Editions.Add(edition);

                                        // raise event
                                        if(LoaderResponse != null) {
                                            LoaderResponse(new LoaderEventArgs(
                                                null,
                                                edition,
                                                globalIndex,
                                                MaxItems
                                            ));
                                        }
                                    }
                                }
                                break;

                            case "cards":
                                /*
                                 * CARDS
                                 * */
                                if(!setsLoaded) {
                                    index = 0;
                                }

                                setsLoaded = true;

                                if(sub.HasChildNodes) {
                                    foreach(XmlNode item in sub.ChildNodes) {
                                        if(item.HasChildNodes) {
                                            Card card = new Card();

                                            card.Id = index;
                                            //card.Color = "";

                                            foreach(XmlNode single in item.ChildNodes) {
                                                switch(single.Name) {
                                                    case "name":
                                                        card.Name = single.InnerText;
                                                        break;

                                                    case "set":
                                                        string editionShortName = single.InnerText;

                                                        //if(editionShortName == "COM") {
                                                        //    editionShortName = "CMD";
                                                        //}

                                                        string picture = single.Attributes["picURL"].InnerText;

                                                        List<Edition> editions = CardFinder.FindEditionByName(editionShortName);

                                                        if(editions != null
                                                        && editions.Count > 0) {
                                                            foreach(Edition edition in editions) {
                                                                card.EditionPictures.Add(
                                                                    edition,
                                                                    new EditionImage() {
                                                                        Url = new Uri(picture),
                                                                        Edition = edition,
                                                                        Card = card
                                                                    }
                                                                );

                                                                //var ediPics =
                                                                //    from ediItem in card.EditionPictures
                                                                //    where ediItem.Key.Id == edition.Id
                                                                //    && ediItem.Key.Name == edition.Name
                                                                //    && ediItem.Key.Shortname == edition.Shortname
                                                                //    select ediItem;

                                                                //if(ediPics.Count() == 0) {
                                                                //    card.EditionPictures.Add(
                                                                //        edition,
                                                                //        new EditionImage() {
                                                                //            Url = new Uri(picture),
                                                                //            //BitmapStream = file,
                                                                //            Edition = edition,
                                                                //            Card = card
                                                                //        }
                                                                //    );
                                                                //}
                                                                //else {
                                                                //    card.EditionPictures[edition] = new EditionImage() {
                                                                //        Url = new Uri(picture),
                                                                //        //BitmapStream = file,
                                                                //        Edition = edition,
                                                                //        Card = card
                                                                //    };
                                                                //}
                                                            }
                                                        }
                                                        break;

                                                    case "color":
                                                        card.Color.Add(new CardColor() { Symbol = single.InnerText.ToEnum<ColorSymbol>() });
                                                        break;

                                                    case "manacost":
                                                        card.CastingCost = single.InnerText;
                                                        break;

                                                    case "type":
                                                        card.Type = single.InnerText;
                                                        break;

                                                    case "pt":
                                                        card.PowerThoughness = single.InnerText;
                                                        break;

                                                    case "tablerow":
                                                        break;

                                                    case "text":
                                                        card.Text = single.InnerText;
                                                        break;

                                                    default:
                                                        break;
                                                }
                                            }

                                            index++;

                                            //card = AddAdditionalInformation(card);

                                            Toenda.Lhurgoyf.Data.CardBase.Cards.Add(card);

                                            // raise event
                                            if(LoaderResponse != null) {
                                                LoaderResponse(new LoaderEventArgs(
                                                    card,
                                                    null,
                                                    globalIndex,
                                                    MaxItems
                                                ));
                                            }
                                        }
                                    }
                                }
                                break;
                        }

                        globalIndex++;
                    }
                }
            }

            //XmlNodeList setNodeList = doc.SelectNodes("//cockatrice_carddatabase/sets/set");

            //foreach(XmlNode node in setNodeList) {
            //    if(node.HasChildNodes) {
            //        /*
            //         * Nodes look like this:
            //         *
            //            <set>
            //                <name>5E</name>
            //                <longname>Fifth Edition</longname>
            //            </set>
            //         * */

            //        XmlNode nameNode = node.ChildNodes[0];
            //        XmlNode longNameNode = node.ChildNodes[1];

            //        // correct some edition short names
            //        string shortName = nameNode.InnerText;

            //        //if(shortName == "COM") {
            //        //    shortName = "CMD";
            //        //}

            //        Edition edition = new Edition();
            //        edition.Id = index;
            //        edition.Name = longNameNode.InnerText;
            //        edition.Shortname = shortName;

            //        index++;

            //        Toenda.Lhurgoyf.Data.CardBase.Editions.Add(edition);
            //    }
            //}

            //index = 0;

            //XmlNodeList cardNodeList = doc.SelectNodes("//cockatrice_carddatabase/cards/card");

            //foreach(XmlNode node in cardNodeList) {
            //    if(node.HasChildNodes) {
            //        /*
            //         * Nodes look like this:
            //         *
            //            <card>
            //                <name>Counterspell</name>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=14511&amp;type=card" picURLHq="" picURLSt="">6E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=185820&amp;type=card" picURLHq="" picURLSt="">DD2</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=3898&amp;type=card" picURLHq="" picURLSt="">5E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=2148&amp;type=card" picURLHq="" picURLSt="">4E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=2500&amp;type=card" picURLHq="" picURLSt="">IA</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=102&amp;type=card" picURLHq="" picURLSt="">A</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=397&amp;type=card" picURLHq="" picURLSt="">B</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=19570&amp;type=card" picURLHq="" picURLSt="">MM</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=1196&amp;type=card" picURLHq="" picURLSt="">R</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=11214&amp;type=card" picURLHq="" picURLSt="">7E</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=20382&amp;type=card" picURLHq="" picURLSt="">ST</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=25503&amp;type=card" picURLHq="" picURLSt="">ST2K</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=4693&amp;type=card" picURLHq="" picURLSt="">TE</set>
            //                <set picURL="http://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=699&amp;type=card" picURLHq="" picURLSt="">U</set>
            //                <color>U</color>
            //                <manacost>UU</manacost>
            //                <type>Instant</type>
            //                <tablerow>3</tablerow>
            //                <text>Counter target spell.</text>
            //            </card>
            //         * */

            //        Card card = new Card();

            //        card.Id = index;
            //        //card.Color = "";

            //        foreach(XmlNode sub in node.ChildNodes) {
            //            switch(sub.Name) {
            //                case "name":
            //                    card.Name = sub.InnerText;
            //                    break;

            //                case "set":
            //                    string editionShortName = sub.InnerText;

            //                    //if(editionShortName == "COM") {
            //                    //    editionShortName = "CMD";
            //                    //}

            //                    string picture = sub.Attributes["picURL"].InnerText;

            //                    List<Edition> editions = CardFinder.FindEditionByName(editionShortName);

            //                    if(editions != null
            //                    && editions.Count > 0) {
            //                        foreach(Edition edition in editions) {
            //                            var ediPics =
            //                                from item in card.EditionPictures
            //                                where item.Key.Id == edition.Id
            //                                && item.Key.Name == edition.Name
            //                                && item.Key.Shortname == edition.Shortname
            //                                select item;

            //                            //Assembly thisExe = Assembly.GetExecutingAssembly();
            //                            //Stream file = thisExe.GetManifestResourceStream("Toenda.Lhurgoyf.Resources.EmptyCard.bmp");

            //                            if(ediPics.Count() == 0) {
            //                                card.EditionPictures.Add(
            //                                    edition,
            //                                    new EditionImage() {
            //                                        Url = new Uri(picture),
            //                                        //BitmapStream = file,
            //                                        Edition = edition,
            //                                        Card = card
            //                                    }
            //                                );
            //                            }
            //                            else {
            //                                card.EditionPictures[edition] = new EditionImage() {
            //                                    Url = new Uri(picture),
            //                                    //BitmapStream = file,
            //                                    Edition = edition,
            //                                    Card = card
            //                                };
            //                            }
            //                        }
            //                    }
            //                    break;

            //                case "color":
            //                    card.Color.Add(new CardColor() { Symbol = sub.InnerText.ToEnum<ColorSymbol>() });
            //                    //card.Color += sub.InnerText;
            //                    break;

            //                case "manacost":
            //                    card.CastingCost = sub.InnerText;
            //                    break;

            //                case "type":
            //                    card.Type = sub.InnerText;
            //                    break;

            //                case "pt":
            //                    card.PowerThoughness = sub.InnerText;
            //                    break;

            //                case "tablerow":
            //                    break;

            //                case "text":
            //                    card.Text = sub.InnerText;
            //                    break;

            //                default:
            //                    break;
            //            }
            //        }

            //        index++;

            //        Toenda.Lhurgoyf.Data.CardBase.Cards.Add(card);

            //        //Console.WriteLine("card {0} of {1} added...", index, cardNodeList.Count);
            //    }
            //}

            if(LoaderFinish != null) {
                LoaderFinish(new LoaderFinishEventArgs("Card database successfull loaded!"));
            }
        }
コード例 #32
0
 private Task SetFeatureValues(Edition edition, List <NameValueDto> featureValues)
 {
     return(this._editionManager.SetFeatureValuesAsync(edition.Id, (
                                                           from fv in featureValues
                                                           select new NameValue(fv.Name, fv.Value)).ToArray <NameValue>()));
 }
コード例 #33
0
 private async Task OpenEdition(Edition edition)
 {
     await navigation.GoToAsync(Constants.Navigation.Paths.Articles, Constants.Navigation.ParameterNames.EditionId, edition.Id);
 }
コード例 #34
0
ファイル: FiletoEXD.cs プロジェクト: regret1537/filetoexd
 /// <summary>
 /// retrieves data about current available ext-version
 /// </summary>
 /// <param name="targetApp">app this extension is designated for</param>
 /// <param name="targetAppVersion">current version of targetApp</param>
 /// <returns>update data of most recent extension version, or null if no data was found, or feature isn't supported. it is valid to return update data of current version. extension-update will take place only if returned value indicaes a newer version</returns>
 public ExtensionVersionInfo GetUpdateData(Edition targetApp, System.Version targetAppVersion)
 {
     return(null);
 }
コード例 #35
0
ファイル: CardBase.cs プロジェクト: vandango/Lhurgoyf
        public static void LoadFromDatabase()
        {
            // load abilities
            List<Ability> abilities = new List<Ability>();

            using(DAL dal = DAL.FromConfiguration("sqlite")) {
                IDbCommand cmd = dal.CreateCommand();
                cmd.CommandText = "SELECT * FROM Abilities";

                dal.OpenConnection();

                using(IDataReader reader = dal.ExecuteQueryForDataReader(cmd)) {
                    while(reader.Read()) {
                        Ability item = new Ability();

                        long id = reader.GetSafeValue<long>("Id");
                        item.Id = Convert.ToInt32(id);

                        long cardId = reader.GetSafeValue<long>("CardId");
                        item.CardId = Convert.ToInt32(cardId);

                        item.Name = reader.GetSafeValue<string>("Name");
                        item.Description = reader.GetSafeValue<string>("Description");
                        item.ActivationCost = reader.GetSafeValue<string>("ActivationCost");
                        item.TapToActivate = reader.GetSafeValue<bool>("TapToActivate");

                        abilities.Add(item);
                    }
                }
            }

            using(DAL dal = DAL.FromConfiguration("sqlite")) {
                IDbCommand cmd = dal.CreateCommand();
                cmd.CommandText = @"
                    SELECT c.Id, c.Name, CastingCost, Type
                        ,Color, Flavour, Abilities, Rarity, Artist
                        ,e.Name AS EditionName, e.Id AS EditionId, Shortname
                    FROM Cards AS c
                    INNER JOIN Cards2Editions AS c2e ON c.Id = c2e.CardId
                    INNER JOIN Editions AS e ON c2e.EditionId = e.Id
                ";

                dal.OpenConnection();

                using(IDataReader reader = dal.ExecuteQueryForDataReader(cmd)) {
                    while(reader.Read()) {
                        Card card = new Card();

                        long cardId = reader.GetSafeValue<long>("Id");
                        card.Id = Convert.ToInt32(cardId);

                        card.Name = reader.GetSafeValue<string>("Name");
                        card.CastingCost = reader.GetSafeValue<string>("CastingCost");
                        card.Type = reader.GetSafeValue<string>("Type");

                        card.Color = new List<CardColor>();
                        //card.Color = "";
                        string colors = reader.GetSafeValue<string>("Color");
                        foreach(char color in colors) {
                            card.Color.Add(new CardColor() { Symbol = color.ToString().ToEnum<ColorSymbol>() });
                            //card.Color += color;
                        }

                        card.Flavour = reader.GetSafeValue<string>("Flavour");
                        card.Rarity = reader.GetSafeValue<string>("Rarity").ToEnum<Rarity>();
                        card.Artist = reader.GetSafeValue<string>("Artist");
                        card.PowerThoughness = reader.GetSafeValue<string>("PT");
                        card.Text = reader.GetSafeValue<string>("Text");

                        // edition
                        Edition edition = new Edition();
                        long editionId = reader.GetSafeValue<long>("EditionId");
                        edition.Id = Convert.ToInt32(editionId);
                        edition.Name = reader.GetSafeValue<string>("EditionName");
                        edition.Shortname = reader.GetSafeValue<string>("Shortname");

                        var edi =
                            from item in Editions
                            where item.Id == edition.Id
                            && item.Name == edition.Name
                            && item.Shortname == edition.Shortname
                            select item;

                        if(edi.Count() == 0
                        ) {
                            edition.Cards.Add(card);

                            Editions.Add(edition);
                        }
                        else {
                            ((Edition)edi).Cards.Add(card);
                        }

                        var ediPics =
                            from item in card.EditionPictures
                            where item.Key.Id == edition.Id
                            && item.Key.Name == edition.Name
                            && item.Key.Shortname == edition.Shortname
                            select item;

                        if(ediPics.Count() == 0) {
                            card.EditionPictures.Add(edition, null);
                        }
                        else {
                            card.EditionPictures[edition] = null;
                        }

                        //// load abilities
                        //var abi = from item in abilities
                        //          where item.CardId == card.Id
                        //          select item;

                        //foreach(Ability item in abi) {
                        //    card.Abilities.Add(item);
                        //}

                        Cards.Add(card);
                    }
                }
            }

            IsInitialized = true;
        }
コード例 #36
0
 public ServiceTierMetadataAttribute(Edition edition, string performanceLevel)
 {
     Edition          = edition;
     PerformanceLevel = String.IsNullOrEmpty(performanceLevel) ? Guid.Empty : new Guid(performanceLevel);
 }
コード例 #37
0
ファイル: EditionService.cs プロジェクト: BabacarSobel/Amabra
        private void GenerateLeague(Edition edition)
        {
            var teamsNumber = edition.Tournement.numberOfTeams;
            var leagueStage = new LeagueStage(edition);
            var first       = leagueStage.Teams[0];
            var queueH      = new Queue <Team>();
            var queueA      = new Queue <Team>();

            queueH.Enqueue(first);
            queueA.Enqueue(leagueStage.Teams[1]);
            for (var i = 2; i <= teamsNumber / 2; i++)
            {
                queueH.Enqueue(leagueStage.Teams[i]);
                queueA.Enqueue(leagueStage.Teams[i + (teamsNumber / 2) - 1]);
            }
            Team TopQueueH;
            Team TopQueueA;

            // OK

            //TODO DELETE
            leagueStage.Rounds = new List <Round>();

            for (var i = 0; i < (teamsNumber - 1); i++)
            {
                var rd = new Round();
                rd.Stage = leagueStage;
                leagueStage.Rounds.Add(rd);
                // TODO DELETE
                //rd.Games = new List<Game>();
                var j = 0;
                while (j < teamsNumber / 2)
                {
                    TopQueueH = queueH.Dequeue();
                    TopQueueA = queueA.Dequeue();
                    var game = new Game();
                    game.Round = rd;
                    game.Team1 = TopQueueH;
                    game.Team2 = TopQueueA;
                    rd.Games.Add(game);
                    if (TopQueueH == first)
                    {
                        queueH.Enqueue(TopQueueH);
                        queueH.Enqueue(TopQueueA);
                    }
                    else if (j == ((teamsNumber / 2) - 1))
                    {
                        queueA.Enqueue(TopQueueA);
                        queueA.Enqueue(TopQueueH);
                    }
                    else
                    {
                        queueH.Enqueue(TopQueueH);
                        queueA.Enqueue(TopQueueA);
                    }

                    j++;
                }
            }

            dbContext.Stages.Add(leagueStage);
        }
コード例 #38
0
        public MinecraftData(Edition edition, String version)
        {
            var asm = typeof(MinecraftData).GetTypeInfo().Assembly;

            foreach (String str in asm.GetManifestResourceNames())
            {
                Console.WriteLine(str);
            }

            using (Stream stream =
                       asm.GetManifestResourceStream("dotnet_minecraft_data.minecraft_data.data.dataPaths.json"))
            {
                byte[] bufferDataPathJson = new byte[stream.Length];
                stream.Read(bufferDataPathJson);

                using (JsonDocument dataPathDocument = JsonDocument.Parse(Encoding.UTF8.GetString(bufferDataPathJson)))
                {
                    JsonElement versionPathElement = dataPathDocument.RootElement.GetProperty(edition.ToString().ToLower()).GetProperty(version);

                    foreach (JsonProperty pathProperty in versionPathElement.EnumerateObject())
                    {
                        JsonElement element = pathProperty.Value;
                        String      asmPath =
                            $"dotnet_minecraft_data.minecraft_data.data.{element.GetString().Replace(".", "._").Replace("/", "._")}.{pathProperty.Name}.json";
                        using (Stream dataStream =
                                   asm.GetManifestResourceStream(asmPath))
                        {
                            Console.WriteLine($"Reading {asmPath}");
                            byte[] fileBuffer = new byte[dataStream.Length];
                            dataStream.Read(fileBuffer);

                            JsonDocument dataDocument = JsonDocument.Parse(Encoding.UTF8.GetString(fileBuffer));
                            switch (pathProperty.Name)
                            {
                            case "biomes":
                            {
                                Biomes = dataDocument;
                                break;
                            }

                            case "blocks":
                            {
                                Blocks = dataDocument;
                                break;
                            }

                            case "items":
                            {
                                Items = dataDocument;
                                break;
                            }

                            case "foods":
                            {
                                Foods = dataDocument;
                                break;
                            }

                            case "recipies":
                            {
                                Recipes = dataDocument;
                                break;
                            }

                            case "instruments":
                            {
                                Instruments = dataDocument;
                                break;
                            }

                            case "materials":
                            {
                                Materials = dataDocument;
                                break;
                            }

                            case "entities":
                            {
                                Entities = dataDocument;
                                break;
                            }

                            case "enchantments":
                            {
                                Enchantments = dataDocument;
                                break;
                            }

                            case "protocol":
                            {
                                Protocol = dataDocument;
                                break;
                            }

                            case "windows":
                            {
                                Windows = dataDocument;
                                break;
                            }

                            case "version":
                            {
                                Version = dataDocument;
                                break;
                            }

                            case "effects":
                            {
                                Effects = dataDocument;
                                break;
                            }

                            case "particles":
                            {
                                Particles = dataDocument;
                                break;
                            }

                            case "entityLoot":
                            {
                                EntityLoot = dataDocument;
                                break;
                            }

                            case "blockLoot":
                            {
                                BlockLoot = dataDocument;
                                break;
                            }

                            case "language":
                            {
                                Language = dataDocument;
                                break;
                            }

                            default:
                            {
                                Console.WriteLine("Missing " + pathProperty.Name);
                                break;
                            }
                            }
                        }
                    }
                }
            }
        }
コード例 #39
0
 public EditionFormBase()
 {
     InitializeComponent();
     m_Edition = new Edition();
 }
コード例 #40
0
 private BookFile MapTrack(BookFile file, Edition book)
 {
     file.Edition = book;
     return(file);
 }