Ejemplo n.º 1
0
        internal override void DownloadChapters(Serie a_serie, Action<int, 
            IEnumerable<Chapter>> progressCallback)
        {
            var doc = DownloadDocument(a_serie);

            var ch1 = doc.DocumentNode.SelectNodes("//ul[@class='chlist']/li/div/h3/a");
            var ch2 = doc.DocumentNode.SelectNodes("//ul[@class='chlist']/li/div/h4/a");

            var chapters = new List<HtmlNode>();
            if (ch1 != null)
                chapters.AddRange(ch1);
            if (ch2 != null)
                chapters.AddRange(ch2);

            var result = (from chapter in chapters
                          select new Chapter(a_serie, chapter.GetAttributeValue("href", ""),
                              chapter.InnerText)).ToList();

            progressCallback(100, result);

            if (result.Count != 0) return;
            if (!doc.DocumentNode.SelectSingleNode("//div[@id='chapters']/div[@class='clear']").
                InnerText.Contains("No Manga Chapter"))
            {
                throw new Exception("Serie has no chapters");
            }
        }
Ejemplo n.º 2
0
 protected override string _GetSerieMiniatureUrl(Serie serie)
 {
     var web = new HtmlWeb();
     var doc = web.Load(serie.URL);
     var img = doc.DocumentNode.SelectSingleNode("//div[@id='series_info']/div[@class='cover']/img");
     return img.GetAttributeValue("src", "");
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Append data to an data serie
        /// </summary>
        /// <param name="serieName">the name of the serie to append</param>
        /// <param name="data">Value of the data </param>
        public void AddData(String serieName, float data)
        {
            Serie currentSerie;

            // Add data serie to the dictonary
            if (!series.Contains(serieName))
            {
                currentSerie = new Serie();
                currentSerie.Name = serieName;
                currentSerie.NbOfPoint = this.NbOfPoint;
                series.Add(serieName, currentSerie);

            }
            else
            {
                currentSerie = (Serie)series[serieName];
            }

            // Add data to the serie and compute Stats
            currentSerie.Add(data);
            float value = currentSerie.Maximum;
            if (value > _dataMax)
            {
                _dataMax = value * 1.1f;
            }
            value = currentSerie.Minimum;
            if (value < _dataMin)
            {
                _dataMin = value - (int)System.Math.Abs((int)(value * 0.1f));
            }

        }
Ejemplo n.º 4
0
        static void Main()
        {
            //DatabaseManager.GetInstance();

            Serie serie = new Serie("Frank & Dale");
            Seizoen seizoen = new Seizoen(1, serie);
            Seizoen seizoen2 = new Seizoen(2, serie);

            serie.AddSeizoen(seizoen);
            serie.AddSeizoen(seizoen2);

            serie.WriteToDatabase();
            seizoen.WriteToDatabase();
            seizoen2.WriteToDatabase();

            //try
            {
                //Account test = Account.GetFromDatabase("username=\'corpelijn\'");
                //Customer c = Customer.GetFromDatabase("id=1");

                //Console.WriteLine(c);
                //Console.WriteLine(test);
            }
            //catch (Exception ex)
            {
                //Console.WriteLine(ex.Message);
            }
            Console.ReadKey();

            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
        }
Ejemplo n.º 5
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> a_progress_callback)
        {
            HtmlDocument doc = DownloadDocument(a_serie);

            var chapters = doc.DocumentNode.SelectNodes("//div[@class='detail_list']/ul/li/span/a");

            if (chapters == null)
            {
                var no_chapters = doc.DocumentNode.SelectSingleNode("//div[@class='detail_list']/ul/li/div");
                if ((no_chapters != null) && no_chapters.InnerText.Contains("No Manga Chapter"))
                {
                    a_progress_callback(100, new Chapter[0]);
                    return;
                }

                var licensed = doc.DocumentNode.SelectSingleNode("//div[@class='detail_list']/div");
                if ((licensed != null) && licensed.InnerText.Contains("has been licensed, it is not available in"))
                {
                    a_progress_callback(100, new Chapter[0]);
                    return;
                }
            }

            var result = (from chapter in chapters
                          select new Chapter(a_serie, chapter.GetAttributeValue("href", ""), chapter.InnerText)).ToList();

            a_progress_callback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
Ejemplo n.º 6
0
        public void CanReturnTheCorrectProgress(int currentEpisode, int lastEpisode, int? season)
        {
            Progress expectedProgress = season.HasValue ? new Progress(currentEpisode, lastEpisode, season) : null;
            ISerie serie = new Serie(0, string.Empty, expectedProgress, 0, string.Empty, string.Empty, string.Empty);

            Assert.AreEqual(expectedProgress, serie.Progress);
        }
Ejemplo n.º 7
0
        public void Remove(Serie a_serie)
        {
            var copy = m_bookmarks.ToList();
            copy.Remove(a_serie);
            m_bookmarks = copy;

            Save();
        }
Ejemplo n.º 8
0
 internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> progressCallback)
 {
     var result = from chapter in DownloadDocument(a_serie).DocumentNode.SelectSingleNode("//div[@class='comicchapters']").SelectNodes(".//a")
                  let i = chapter.InnerHtml.IndexOf('<')
                  select new Chapter(a_serie, chapter.GetAttributeValue("href", ""), (i < 0) ? chapter.InnerText : chapter.InnerHtml.Substring(0, i));
     
     progressCallback(100, result);
 }
        public void CanCorrectlyGenerateNextEpisodesStreamWithoutCachedStreams(SerieType serieType, string expected, int? season)
        {
            ISerie serie = new Serie(0, "TestMovie", new Progress(0, 1, season), 0, serieType.ToString(), string.Empty, string.Empty);

            string actual = streamManagerSUT.GenerateNextEpisodeStream(serie, new List<IStreamItem>());

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 10
0
        public void Remove(Serie serie)
        {
            var copy = _bookmarks.ToList();
            copy.Remove(serie);
            _bookmarks = copy;

            Save();
        }
Ejemplo n.º 11
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> progressCallback)
        {
            var doc = DownloadDocument(a_serie);

            var nodes = doc.DocumentNode.SelectNodes("//b");
            var node = nodes.Where(n => n.InnerText.StartsWith("Current Status")).FirstOrDefault();

            if (node == null)
                node = nodes.Where(n => n.InnerText.StartsWith("View Comic Online")).FirstOrDefault();

            if (node == null)
            {
                var note = doc.DocumentNode.SelectSingleNode("//div[@class='mainbgtop']/p/em");
                if (note != null)
                {
                    if (note.InnerText.Contains("has been taken down as per request from the publisher"))
                    {
                        progressCallback(100, new Chapter[0]);
                        return;
                    }
                }
            }

            for (;;)
            {
                if (node == null)
                    break;

                if (node.Name == "a")
                    if (node.GetAttributeValue("href", "").Contains("thespectrum.net"))
                        break;

                node = node.NextSibling;

                if (node.InnerText.Contains("Sorry! Series removed as requested"))
                {
                    progressCallback(100, new Chapter[0]);
                    return;
                }
            }

            var href = node.GetAttributeValue("href", "");

            doc = DownloadDocument(a_serie, href);

            var chapters = doc.DocumentNode.SelectNodes("//select[@name='ch']/option");

            var result = (from chapter in chapters
                          select new Chapter(
                              a_serie,
                              href + "?ch=" + chapter.GetAttributeValue("value", "").Replace(" ", "+") + "&page=1",
                              chapter.NextSibling.InnerText)).Reverse().ToList();

            progressCallback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
Ejemplo n.º 12
0
 protected override string _GetSerieMiniatureUrl(Serie serie)
 {
     var web = new HtmlWeb();
     var doc = web.Load(serie.URL);
     var rightside = doc.DocumentNode.SelectSingleNode("//div[@id='rightside']");
     var rightbox = rightside.SelectSingleNode("./div[@class='rightBox']");
     var img = rightbox.SelectSingleNode(".//img");
     return img.GetAttributeValue("src", string.Empty);
 }
Ejemplo n.º 13
0
 internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> progressCallback)
 {
     var chapters = DownloadDocument(a_serie).DocumentNode.SelectNodes("//div[@class='element']/div[@class='title']/a");
     var result = (from chapter in chapters
                   select new Chapter(a_serie, chapter.GetAttributeValue("href", ""), chapter.InnerText)).ToList();
     progressCallback(100, result);
     if (result.Count == 0)
         throw new Exception("Serie has no chapters");
 }
Ejemplo n.º 14
0
        public void Add(Serie serie)
        {
            var copy = _bookmarks.ToList();
            copy.Add(serie);
            _bookmarks = copy;

            DownloadManager.Instance.BookmarksVisited(serie.Chapters);

            Save();
        }
Ejemplo n.º 15
0
 public void Should_identify_end_of_serie_with_no_strike_in_last_frame()
 {
     var serie = new Serie();
     for (var i = 0; i < 19; i++)
     {
         serie.AddRoll(3);
     }
     serie.IsDone.ShouldBeFalse();
     serie.AddRoll(3);
     serie.IsDone.ShouldBeTrue();
 }
        public void CanCorrectlyGenerateNextEpisodesForStreamWithCachedStreams(int? season, string title, int currentEpisode, string pattern, string expected)
        {
            List<IStreamItem> streams = new List<IStreamItem>();
            streams.Add(new StreamItem(pattern, "_"));

            ISerie serie = new Serie(0, title, new Progress(currentEpisode, 1, season), 0, SerieType.Mixed.ToString(), string.Empty, string.Empty);

            string actual = streamManagerSUT.GenerateNextEpisodeStream(serie, streams);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 17
0
        public void SerieCreationPerformanceTest()
        {
            Stopwatch chrono = Stopwatch.StartNew();

            var serie = new Serie {Name = "foo", ColumnNames = new[] {"value", "value_str"}};
            const long N = (long) 1e6;
            for (long i = 0; i < N; i++)
            {
                serie.Points.Add(new object[] {i, "some text"});
            }

            chrono.Stop();
            Debug.Write("Create Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine);
        }
Ejemplo n.º 18
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> a_progress_callback)
        {
            string url = String.Format("{0}/chapter-001/page001.html", a_serie.URL);
            HtmlDocument doc = DownloadDocument(a_serie);

            var chapters = doc.DocumentNode.SelectNodes("//table[@class='datalist']/tr/td[4]/a");

            var result = (from chapter in chapters
                          select new Chapter(a_serie, chapter.GetAttributeValue("href", ""),
                              chapter.ParentNode.ParentNode.ChildNodes[3].InnerText)).ToList();

            a_progress_callback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
Ejemplo n.º 19
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> progressCallback)
        {
            var doc = DownloadDocument(a_serie);

            var chapters = doc.DocumentNode.SelectNodes("//table[@id='listing']/tr/td/a");

            var result = (from chapter in chapters.Reverse()
                          select new Chapter(
                              a_serie,
                              "http://www.mangareader.net" + chapter.GetAttributeValue("href", ""),
                              chapter.InnerText)).ToList();

            progressCallback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
Ejemplo n.º 20
0
        public void PerformanceTest()
        {
            var client = new InfluxDBClient("192.168.1.100", 8086, "root", "root", "PerfTests");

            // Create a database for this test
            List<string> databaseList = client.GetDatabaseList();
            if (!databaseList.Contains("PerfTests"))
            {
                client.CreateDatabase("PerfTests");
            }

            client.Query("DROP SERIES foo");

            // Create
            var serie = new Serie {Name = "foo", ColumnNames = new[] {"value", "value_str"}};
            var series = new List<Serie> {serie};

            const int N = 10000;
            for (int i = 0; i < N; i++)
            {
                serie.Points.Add(new object[] {i, "yoyo"});
            }

            // Measure insert
            Stopwatch chrono = Stopwatch.StartNew();
            client.Insert(series);
            chrono.Stop();
            Debug.Write("Insert Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine);

            // Ugly
            Thread.Sleep(1000); // Give some time to the database to process insert. There must be a better way to do this

            // Make sure write was succesful
            List<Serie> result = client.Query("select count(value) from foo");
            Assert.AreEqual(N, result[0].Points[0][1]);

            // Measure query
            chrono.Restart();
            result = client.Query("select * from foo");
            chrono.Stop();
            Assert.AreEqual(N, result[0].Points.Count);
            Debug.Write("Query Elapsed:" + chrono.Elapsed.TotalMilliseconds + " ms" + Environment.NewLine);

            // Clean up
            client.DeleteDatabase("PerfTests");
        }
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> a_progress_callback)
        {
            HtmlDocument doc = DownloadDocument(a_serie);

            var chapters = doc.DocumentNode.SelectNodes(
                "//table[@class='table table-striped']/tr/td/a");

            var result = (from chapter in chapters
                          select new Chapter(a_serie,
                                             chapter.GetAttributeValue("href", ""),
                                             chapter.InnerText)).ToList();
            
            a_progress_callback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> a_progress_callback)
        {
            HtmlDocument doc = DownloadDocument(a_serie);

            var chapters = doc.DocumentNode.SelectNodes(
                "/html/body/center/table/tr/td/table[5]/tr/td/table/tr/td/table/tr/td/blockquote/a");

            var result = (from chapter in chapters.Skip(1)
                          select new Chapter(a_serie,
                                                 "http://www.anime-source.com/banzai/" + chapter.GetAttributeValue("href", ""),
                                                 chapter.InnerText)).Reverse().ToList();

            a_progress_callback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
Ejemplo n.º 23
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> progressCallback)
        {
            var li = (from l in DownloadDocument(a_serie).DocumentNode.SelectNodes("//li")
                      where l.InnerText.TrimStart().StartsWith("Series &#038; Releases")
                      select l.SelectNodes("./ul/li")).First();

            var chapters = (from l in li
                            where HttpUtility.HtmlDecode(l.SelectSingleNode(".//a").InnerText.Trim()) == a_serie.Title
                            select l.SelectNodes(".//li")).First();

            var result = from ch in chapters
                         where ch.SelectNodes(".//ul") == null
                         let a = ch.SelectSingleNode("./a")
                         select new Chapter(a_serie, a.GetAttributeValue("href", ""), a.InnerText);

            progressCallback(100, result);
        }
        public ActionResult Cadastrar(SerieModel serieModel)
        {
            var serie = new Serie();
            var repositorioTipo = new Tipos();
            var repositorio = new Series();
            var repositorioExercicios = new Exercicios();
            serie.Exercicios = new List<Exercicio>();
            serie.Tipo = repositorioTipo.Obter(int.Parse(serieModel.Tipo));
            serie.Nome = serieModel.Nome;
            serie.Objetivo = serieModel.Objetivo;

            foreach (var Id in serieModel.Exercicios)
            {
               var exercicio = repositorioExercicios.Obter(int.Parse(Id));
               serie.Exercicios.Add(exercicio);
            }
            repositorio.Salvar(serie);
            return View("Index");
        }
Ejemplo n.º 25
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> progressCallback)
        {
            SetDefaultImage("http://www.readmanga.today/assets/img/favicon.ico");

            var doc = DownloadDocument(a_serie);
            var ul = doc.DocumentNode.SelectSingleNode("//ul[@class='chp_lst']");
            var links = ul.SelectNodes(".//a");
            /*var result = new List<Chapter>();
            foreach(var link in links)
            {
                HtmlNode span = null;
                if(link != null)
                    span = link.ChildNodes.First();
                if(span != null)
                    result.Add(new Chapter(a_serie, link.GetAttributeValue("href", ""), span.InnerText));
            }*/
            var result = from a in links let span = a.SelectSingleNode("./span[@class='val']") select new Chapter(a_serie, a.GetAttributeValue("href", ""), span.InnerText);
            progressCallback(100, result);
        }
Ejemplo n.º 26
0
        protected override string _GetSerieMiniatureUrl(Serie serie)
        {
            var doc = new HtmlDocument();
            var request = (HttpWebRequest) WebRequest.Create(serie.URL);
            request.Method = "GET";

            using (var response = (HttpWebResponse) request.GetResponse())
            {
                using (var stream = response.GetResponseStream())
                {
                    if (stream != null && stream.CanRead)
                    {
                        var stremReader = new StreamReader(stream /*, Encoding.UTF8*/);
                        doc.LoadHtml(stremReader.ReadToEnd());
                    }
                }
            }
            var info = doc.DocumentNode.SelectSingleNode("//div[@class='comic info']");
            var img = info.SelectSingleNode("./div[@class='thumbnail']/img");
            return img.GetAttributeValue("src", "");
        }
Ejemplo n.º 27
0
        internal override void DownloadSeries(Server server, Action<int, 
            IEnumerable<Serie>> progressCallback)
        {
            var doc = DownloadDocument(server);

            var series = doc.DocumentNode.SelectNodes("//div[@class='mangaJump']/select").Elements().ToList();

            for (var i = series.Count - 1; i >= 0; i--)
            {
                if (series[i].NodeType != HtmlNodeType.Text)
                    continue;
                var str = series[i].InnerText;
                str = str.Trim();
                str = str.Replace("\n", "");
                if (str == "")
                    series.RemoveAt(i);
            }
            
            var splitter = series.FirstOrDefault(s => s.InnerText.Contains("---"));
            if (splitter != null)
            {
                var splitter_index = series.IndexOf(splitter);
                series.RemoveRange(0, splitter_index + 1);
            }

            var result = new List<Serie>();

            for (var i = 0; i < series.Count; i += 2)
            {
                var si = new Serie(
                    server,
                    "http://www.thespectrum.net" + series[i].GetAttributeValue("value", ""), 
                    series[i + 1].InnerText);

                result.Add(si);
            }

            progressCallback(100, result);
        }
        public void Alterar(Serie serie)
        {
            try
            {
                Serie serieAux = new Serie();
                serieAux.ID = serie.ID;

                List<Serie> resultado = this.Consultar(serieAux, TipoPesquisa.E);

                if (resultado == null || resultado.Count == 0)
                    throw new SerieNaoAlteradaExcecao();

                serieAux = resultado[0];
                serieAux.Nome = serie.Nome;
                serieAux.Status = serie.Status;
                Confirmar();
            }
            catch (Exception)
            {
                throw new SerieNaoAlteradaExcecao();
            }
        }
Ejemplo n.º 29
0
        internal override void DownloadChapters(Serie a_serie, Action<int, IEnumerable<Chapter>> a_progress_callback)
        {
            HtmlDocument doc = DownloadDocument(a_serie);

            var chapters = doc.DocumentNode.SelectNodes(
                "//div/div/a[@class='download-link']");

            if (chapters == null)
            {
                var mature = doc.DocumentNode.SelectSingleNode("//a[@href='?mature_confirm=1']");
                if (mature != null)
                {
                    a_serie.URL = a_serie.URL + "?mature_confirm=1";
                    DownloadChapters(a_serie, a_progress_callback);
                    return;
                }

                var no_chapters = doc.DocumentNode.SelectNodes("//div/div/div[@class='c_h2']");
                if (no_chapters != null)
                {
                    if (no_chapters.Any(el => el.InnerText.Contains("We don't have any chapters for this manga. Do you?")))
                    {
                        a_progress_callback(100, new Chapter[0]);
                        return;
                    }
                }
            }

            var result = (from chapter in chapters
                          select new Chapter(a_serie,
                                             "http://starkana.com" + chapter.GetAttributeValue("href", ""),
                                             chapter.InnerText)).ToList();

            a_progress_callback(100, result);

            if (result.Count == 0)
                throw new Exception("Serie has no chapters");
        }
Ejemplo n.º 30
0
 abstract public void GetPictureData(Serie serie);
Ejemplo n.º 31
0
 abstract public void GetSerieData(Serie serie);
Ejemplo n.º 32
0
        // GET: Articulo/Create
        public ActionResult Create()
        {
            Serie sol = new Serie();

            return(View(sol));
        }
Ejemplo n.º 33
0
        /// <summary>
        /// we draw based on the fist export type of the asset, no need to check others it's a waste of time
        /// i don't cache images because i don't wanna store a lot of SKCanvas in the memory
        /// </summary>
        /// <returns>true if an icon has been drawn</returns>
        public static bool TryDrawIcon(string assetPath, string exportType, IUExport export)
        {
            var    d           = new DirectoryInfo(assetPath);
            string assetName   = d.Name;
            string assetFolder = d.Parent.Name;

            if (Text.TypeFaces.NeedReload(false))
            {
                Text.TypeFaces = new Typefaces(); // when opening bundle creator settings without loading paks first
            }
            // please respect my wave if you wanna add a new exportType
            // Athena first, then Fort, thank you
            switch (exportType)
            {
            case "AthenaConsumableEmoteItemDefinition":
            case "AthenaSkyDiveContrailItemDefinition":
            case "AthenaLoadingScreenItemDefinition":
            case "AthenaVictoryPoseItemDefinition":
            case "AthenaPetCarrierItemDefinition":
            case "AthenaMusicPackItemDefinition":
            case "AthenaBattleBusItemDefinition":
            case "AthenaCharacterItemDefinition":
            case "AthenaBackpackItemDefinition":
            case "AthenaPickaxeItemDefinition":
            case "AthenaGadgetItemDefinition":
            case "AthenaGliderItemDefinition":
            case "AthenaDailyQuestDefinition":
            case "AthenaSprayItemDefinition":
            case "AthenaDanceItemDefinition":
            case "AthenaEmojiItemDefinition":
            case "AthenaItemWrapDefinition":
            case "AthenaToyItemDefinition":
            case "FortHeroType":
            case "FortTokenType":
            case "FortAbilityKit":
            case "FortWorkerType":
            case "FortBannerTokenType":
            case "FortVariantTokenType":
            case "FortFeatItemDefinition":
            case "FortStatItemDefinition":
            case "FortTrapItemDefinition":
            case "FortAmmoItemDefinition":
            case "FortQuestItemDefinition":
            case "FortBadgeItemDefinition":
            case "FortAwardItemDefinition":
            case "FortGadgetItemDefinition":
            case "FortPlaysetItemDefinition":
            case "FortGiftBoxItemDefinition":
            case "FortSpyTechItemDefinition":
            case "FortAccoladeItemDefinition":
            case "FortCardPackItemDefinition":
            case "FortDefenderItemDefinition":
            case "FortCurrencyItemDefinition":
            case "FortResourceItemDefinition":
            case "FortSchematicItemDefinition":
            case "FortIngredientItemDefinition":
            case "FortWeaponMeleeItemDefinition":
            case "FortContextTrapItemDefinition":
            case "FortPlayerPerksItemDefinition":
            case "FortPlaysetPropItemDefinition":
            case "FortHomebaseNodeItemDefinition":
            case "FortWeaponRangedItemDefinition":
            case "FortNeverPersistItemDefinition":
            case "FortPlaysetGrenadeItemDefinition":
            case "FortPersonalVehicleItemDefinition":
            case "FortHardcoreModifierItemDefinition":
            case "FortConsumableAccountItemDefinition":
            case "FortConversionControlItemDefinition":
            case "FortPersistentResourceItemDefinition":
            case "FortCampaignHeroLoadoutItemDefinition":
            case "FortConditionalResourceItemDefinition":
            case "FortChallengeBundleScheduleDefinition":
            case "FortWeaponMeleeDualWieldItemDefinition":
            case "FortDailyRewardScheduleTokenDefinition":
            {
                BaseIcon icon   = new BaseIcon(export, exportType, ref assetName);
                int      height = icon.Size + icon.AdditionalSize;
                using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            Rarity.DrawRarity(c, icon);
                        }

                        LargeSmallImage.DrawPreviewImage(c, icon);

                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
                            {
                                Text.DrawBackground(c, icon);
                                Text.DrawDisplayName(c, icon);
                                Text.DrawDescription(c, icon);
                                if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini)
                                {
                                    if (!icon.ShortDescription.Equals(icon.DisplayName) && !icon.ShortDescription.Equals(icon.Description))
                                    {
                                        Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription);
                                    }
                                    Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource);
                                }
                            }
                            UserFacingFlag.DrawUserFacingFlags(c, icon);

                            // has more things to show
                            if (height > icon.Size)
                            {
                                Statistics.DrawStats(c, icon);
                            }
                        }

                        Watermark.DrawWatermark(c);     // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }
                return(true);
            }

            case "FortMtxOfferData":
            {
                BaseOffer icon = new BaseOffer(export);
                using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            icon.DrawBackground(c);
                        }
                        icon.DrawImage(c);

                        Watermark.DrawWatermark(c);     // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }
                return(true);
            }

            case "FortItemSeriesDefinition":
            {
                BaseIcon icon = new BaseIcon();
                using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        Serie.GetRarity(icon, export);
                        Rarity.DrawRarity(c, icon);

                        Watermark.DrawWatermark(c);     // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }
                return(true);
            }

            case "PlaylistUserOptionEnum":
            case "PlaylistUserOptionBool":
            case "PlaylistUserOptionString":
            case "PlaylistUserOptionIntEnum":
            case "PlaylistUserOptionIntRange":
            case "PlaylistUserOptionColorEnum":
            case "PlaylistUserOptionFloatEnum":
            case "PlaylistUserOptionFloatRange":
            case "PlaylistUserOptionPrimaryAsset":
            case "PlaylistUserOptionCollisionProfileEnum":
            {
                BaseUserOption icon = new BaseUserOption(export);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        icon.Draw(c);

                        Watermark.DrawWatermark(c);     // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }
                return(true);
            }

            case "FortChallengeBundleItemDefinition":
            {
                BaseBundle icon = new BaseBundle(export, assetFolder);
                using (var ret = new SKBitmap(icon.Width, icon.HeaderHeight + icon.AdditionalSize, SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        HeaderStyle.DrawHeaderPaint(c, icon);
                        HeaderStyle.DrawHeaderText(c, icon);
                        QuestStyle.DrawQuests(c, icon);
                        QuestStyle.DrawCompletionRewards(c, icon);

                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }
                return(true);
            }
            }
            return(false);
        }
Ejemplo n.º 34
0
        public void CargaSerieTxt()
        {
            //isan   #Titulo  #anio #pais    #descripcion #Imagenn #IdGenero #Tipo #True bajalogica
            String carpeta       = "ArchivosTxt";
            string nombreArchivo = "Series.txt";
            int    pocisionNumeral;
            string ruta = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, carpeta, nombreArchivo);

            // string path = Directory.GetCurrentDirectory();
            string[] lines = System.IO.File.ReadAllLines(ruta);

            foreach (string line in lines)
            {
                string ultimaParte = "";
                pocisionNumeral = line.IndexOf('#');
                string AuxIsan = line.Remove(pocisionNumeral);

                ultimaParte     = line.Substring(pocisionNumeral + 1);
                pocisionNumeral = ultimaParte.IndexOf('#');
                string tituloSerie = ultimaParte.Remove(pocisionNumeral);

                ultimaParte     = ultimaParte.Substring(pocisionNumeral + 1);
                pocisionNumeral = ultimaParte.IndexOf('#');
                int anioSerie = Convert.ToInt32(ultimaParte.Remove(pocisionNumeral));

                ultimaParte     = ultimaParte.Substring(pocisionNumeral + 1);
                pocisionNumeral = ultimaParte.IndexOf('#');
                string paisSerie = ultimaParte.Remove(pocisionNumeral);

                ultimaParte     = ultimaParte.Substring(pocisionNumeral + 1);
                pocisionNumeral = ultimaParte.IndexOf('#');
                string descripcionSerie = ultimaParte.Remove(pocisionNumeral);

                ultimaParte     = ultimaParte.Substring(pocisionNumeral + 1);
                pocisionNumeral = ultimaParte.IndexOf('#');
                string ImagenSerie = ultimaParte.Remove(pocisionNumeral);

                ultimaParte     = ultimaParte.Substring(pocisionNumeral + 1);
                pocisionNumeral = ultimaParte.IndexOf('#');
                int IdGeneroSerie = Convert.ToInt32(ultimaParte.Remove(pocisionNumeral)); ///la mo una funcion para obtener el genero de la BD

                ultimaParte = ultimaParte.Substring(pocisionNumeral + 1);
                string DatosSerie = ultimaParte;
                //pocisionNumeral = ultimaParte.IndexOf('#');
                //string DatosMaterial = ultimaParte.Remove(pocisionNumeral);

                var    db     = new MyDbContext();
                Genero genero = db.generos.SingleOrDefault(x => x.ID == IdGeneroSerie);


                // genero el material con los campos obtenidos del archivo de texto
                Serie serie = new Serie
                {
                    Isan        = AuxIsan,
                    Titulo      = tituloSerie,
                    Anio        = anioSerie,
                    Pais        = paisSerie,
                    Descripcion = descripcionSerie,
                    Imagen      = ImagenSerie,
                    Genero      = genero,
                    Datos       = DatosSerie
                                  //TipoMaterial = TipoMaterial
                };
                db.series.AddOrUpdate(serie);
                db.SaveChanges();

                //compre material = null
            }
        }
Ejemplo n.º 35
0
 public override int GetHashCode()
 {
     return(Serie.GetHashCode() ^ Number.GetHashCode());
 }
Ejemplo n.º 36
0
        private static void LoadAuthors(ILibraryContext context)
        {
            var authors = new List <Author>();
            // Simon
            var simon = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Simon",
                LastName = "Scarrow",
                Born     = 1962,
                Photo    = "http://simonscarrow.bookswarm.co.uk/wp-content/uploads/2014/08/simon.png"
            };

            context.Authors.Add(simon);
            var eagle = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Eagles of the Empire",
                AuthorId = simon.Id,
                Photo    = "https://pictures.abebooks.com/isbn/9787421174855-us.jpg"
            };

            context.Series.Add(eagle);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Under the Eagle", Published = 2000, Genre = "Historical novel", SerieId = eagle.Id, Photo = "https://inconsistentpacing.files.wordpress.com/2015/06/under-the-eagle.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle's Conquest", Published = 2001, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1355117222i/6460909._UY200_.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "When the Eagle Hunts", Published = 2002, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://ecx.images-amazon.com/images/I/5194UJX%2B2JL.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle and the Wolves", Published = 2003, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1349126380i/7013830._UY200_.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle's Prey", Published = 2004, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://i.gr-assets.com/images/S/compressed.photo.goodreads.com/books/1349129330i/6064639._UY200_.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle's Prophecy", Published = 2005, Genre = "Historical novel", SerieId = eagle.Id, Photo = "https://images.gr-assets.com/books/1408929000l/601301.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle in the Sand", Published = 2006, Genre = "Historical novel", SerieId = eagle.Id, Photo = "https://images-na.ssl-images-amazon.com/images/I/51lkS6VUEDL._SY346_.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Centurion", Published = 2008, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://3.bp.blogspot.com/_8WPhHS45xsI/SW4CE3ejKsI/AAAAAAAAKDE/7IS2V-ERlUU/s400/centurion.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Gladiator", Published = 2009, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://images.gr-assets.com/books/1348743578l/6097176.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Legion", Published = 2010, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://1.bp.blogspot.com/-IULtRvll-68/UWUyWfFvqVI/AAAAAAAAXCM/BrylF3wvls0/s1600/La+legi%C3%B3n+de+Simon+Scarrow.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Praetorian", Published = 2011, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://images.gr-assets.com/books/1348053656l/12101705.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Blood Crows", Published = 2013, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://simonscarrow.co.uk/wp-content/uploads/2014/09/Blood-Crows.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Brothers in Blood", Published = 2014, Genre = "Historical novel", SerieId = eagle.Id, Photo = "https://images-na.ssl-images-amazon.com/images/I/81spvoF56fL.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Britannia", Published = 2015, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://simonscarrow.co.uk/wp-content/uploads/2015/09/9781472213303-195x300.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Invictus", Published = 2016, Genre = "Historical novel", SerieId = eagle.Id, Photo = "http://simonscarrow.co.uk/wp-content/uploads/2016/08/Invictus-HBR-frt-v9_RGB.jpg"
            });

            // end Simon

            // posteguillo
            var posteguillo = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Santiago",
                LastName = "Posteguillo",
                Born     = 1967,
                Photo    = "http://d3iln1l77n73l7.cloudfront.net/couch_images/attachments/000/025/611/original/author-santiago-posteguillo-gomez.jpg?2013"
            };

            context.Authors.Add(posteguillo);
            var africanus = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Scipio Africanus",
                AuthorId = posteguillo.Id,
                Photo    = "https://i.ytimg.com/vi/9m5_QPtkoyM/maxresdefault.jpg"
            };

            context.Series.Add(africanus);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "Africanus: Son of the Consul", Published = 2006, Genre = "Historical novel", SerieId = africanus.Id, Photo = "http://2.bp.blogspot.com/-Bwla4nj7u5E/T24A8Qo4vjI/AAAAAAAAAUc/180j875wqsA/s1600/africanus.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Accursed Legions", Published = 2008, Genre = "Historical novel", SerieId = africanus.Id, Photo = "http://www.santiagoposteguillo.es/wp-content/uploads/legiones.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Betrayal of Rome", Published = 2009, Genre = "Historical novel", SerieId = africanus.Id, Photo = "http://1.bp.blogspot.com/-OnWf7XvAtvY/T8MV1SXG3XI/AAAAAAAAAv0/_KPIed3K8So/s1600/portada_latraicionderoma.jpg"
            });

            var trajan = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Trajan",
                AuthorId = posteguillo.Id,
                Photo    = "https://i.ytimg.com/vi/pfqJWLJH_pc/maxresdefault.jpg"
            };

            context.Series.Add(trajan);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Emperor's Assassins", Published = 2011, Genre = "Historical novel", SerieId = trajan.Id, Photo = "https://pictures.abebooks.com/isbn/9786070720437-es-300.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "Circo Maximo - Trajan's rage", Published = 2013, Genre = "Historical novel", SerieId = trajan.Id, Photo = "http://www.santiagoposteguillo.es/wp-content/uploads/santiago-posteguillo-circo-maximo-310x475.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Lost Legion", Published = 2016, Genre = "Historical novel", SerieId = trajan.Id, Photo = "https://imagessl1.casadellibro.com/a/l/t0/81/9788408151081.jpg"
            });

            // end posteguillo

            // orson
            var orson = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Orson",
                LastName = "Scott Card",
                Born     = 1951,
                Photo    = "http://www.wired.com/images_blogs/underwire/2013/10/ut_endersgame_f1.jpg?w=240"
            };

            context.Authors.Add(orson);
            var ender = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Ender's Game",
                AuthorId = orson.Id,
                Photo    = "http://www.gestornoticias.com/archivos/religionenlibertad.com/image/ender_orson_scott_card.jpg"
            };

            context.Series.Add(ender);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Ender's Game", Published = 1985, Genre = "fiction", SerieId = ender.Id, Photo = "https://images-na.ssl-images-amazon.com/images/I/610KU5avW4L.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Speaker for the Dead", Published = 1986, Genre = "fiction", SerieId = ender.Id, Photo = "https://upload.wikimedia.org/wikipedia/en/0/05/Speaker_dead_cover.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Xenocide", Published = 1991, Genre = "fiction", SerieId = ender.Id, Photo = "https://upload.wikimedia.org/wikipedia/en/6/6f/Xenocide_cover.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Children of the Mind", Published = 1996, Genre = "fiction", SerieId = ender.Id, Photo = "https://upload.wikimedia.org/wikipedia/en/1/10/Children_mind_cover.jpg"
            });

            // end orson

            // patrick
            var patrick = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Patrick",
                LastName = "Rothfuss",
                Born     = 1973,
                Photo    = "https://upload.wikimedia.org/wikipedia/commons/7/7f/Patrick-rothfuss-2014-kyle-cassidy.jpg"
            };

            context.Authors.Add(patrick);
            var kingkiller = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "The Kingkiller",
                AuthorId = patrick.Id,
                Photo    = "http://www.tracking-board.com/wp-content/uploads/2015/10/PicMonkey-Collage1.jpg"
            };

            context.Series.Add(kingkiller);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = patrick.Id, Name = "The Name of the Wind", Published = 2007, Genre = "fantasy", SerieId = kingkiller.Id, Photo = "http://www.patrickrothfuss.com/images/page/cover_277.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = patrick.Id, Name = "The Wise Man's Fear", Published = 2011, Genre = "fantasy", SerieId = kingkiller.Id, Photo = "http://www.patrickrothfuss.com/images/page/cover-paperback-wise-man_277.jpg"
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = patrick.Id, Name = "The Doors of Stone", Published = 3100, Genre = "fantasy", SerieId = kingkiller.Id, Photo = "http://4.bp.blogspot.com/-RkBSGaLLtg4/VlbYicCdSTI/AAAAAAAAU_E/gUduGPRl2Rw/s1600/The%2BDoor%2Bof%2BStone%2Bby%2BPatrick%2BRothfuss.jpg"
            });

            // end patrick
        }
        private void loadAuthors(IContext context)
        {
            context.Authors = new List <Author>();
            context.Books   = new List <Book>();
            context.Series  = new List <Serie>();
            var authors = new List <Author>();
            // Simon
            var simon = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Simon",
                LastName = "Scarrow",
                Born     = 1962,
            };

            context.Authors.Add(simon);
            var eagle = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Eagles of the Empire",
                AuthorId = simon.Id
            };

            context.Series.Add(eagle);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Under the Eagle", Published = 2000, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle's Conquest ", Published = 2001, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "When the Eagle Hunts ", Published = 2002, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle and the Wolves", Published = 2003, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle's Prey", Published = 2004, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle's Prophecy", Published = 2005, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Eagle in the Sand", Published = 2006, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Centurion", Published = 2008, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Gladiator", Published = 2009, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Legion", Published = 2010, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Praetorian", Published = 2011, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "The Blood Crows", Published = 2013, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Brothers in Blood", Published = 2014, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Britannia", Published = 2015, Genre = "Historical novel", SerieId = eagle.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = simon.Id, Name = "Invictus", Published = 2016, Genre = "Historical novel", SerieId = eagle.Id
            });

            // end Simon

            // posteguillo
            var posteguillo = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Santiago",
                LastName = "Posteguillo",
                Born     = 1967,
            };

            context.Authors.Add(posteguillo);
            var africanus = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Scipio Africanus",
                AuthorId = posteguillo.Id
            };

            context.Series.Add(africanus);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "Africanus: Son of the Consul", Published = 2006, Genre = "Historical novel", SerieId = africanus.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Accursed Legions", Published = 2008, Genre = "Historical novel", SerieId = africanus.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Betrayal of Rome", Published = 2009, Genre = "Historical novel", SerieId = africanus.Id
            });

            var trajan = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Trajan",
                AuthorId = posteguillo.Id
            };

            context.Series.Add(trajan);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Emperor's Assassins", Published = 2011, Genre = "Historical novel", SerieId = trajan.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "Circo Maximo - Trajan's rage", Published = 2013, Genre = "Historical novel", SerieId = trajan.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = posteguillo.Id, Name = "The Lost Legion", Published = 2016, Genre = "Historical novel", SerieId = trajan.Id
            });

            // end posteguillo

            // orson
            var orson = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Orson",
                LastName = "Scott Card",
                Born     = 1951,
            };

            context.Authors.Add(orson);
            var ender = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "Ender's Game",
                AuthorId = orson.Id
            };

            context.Series.Add(ender);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Ender's Game", Published = 1985, Genre = "fiction", SerieId = ender.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Speaker for the Dead", Published = 1986, Genre = "fiction", SerieId = ender.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Xenocide", Published = 1991, Genre = "fiction", SerieId = ender.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = orson.Id, Name = "Children of the Mind", Published = 1996, Genre = "fiction", SerieId = ender.Id
            });

            // end orson

            // patrick
            var patrick = new Author()
            {
                Id       = Guid.NewGuid(),
                Name     = "Patrick",
                LastName = "Rothfuss",
                Born     = 1973,
            };

            context.Authors.Add(patrick);
            var kingkiller = new Serie
            {
                Id       = Guid.NewGuid(),
                Name     = "The Kingkiller",
                AuthorId = patrick.Id
            };

            context.Series.Add(kingkiller);

            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = patrick.Id, Name = "The Name of the Wind", Published = 2007, Genre = "fantasy", SerieId = kingkiller.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = patrick.Id, Name = "The Wise Man's Fear", Published = 2011, Genre = "fantasy", SerieId = kingkiller.Id
            });
            context.Books.Add(new Book()
            {
                Id = Guid.NewGuid(), AuthorId = patrick.Id, Name = "The Doors of Stone", Published = 3100, Genre = "fantasy", SerieId = kingkiller.Id
            });

            // end patrick
        }
Ejemplo n.º 38
0
        /// <summary>
        /// i don't cache images because i don't wanna store a lot of SKCanvas in the memory
        /// </summary>
        /// <returns>true if an icon has been drawn</returns>
        public static bool TryDrawIcon(string assetPath, FName[] exportTypes, IUExport[] exports)
        {
            var    d           = new DirectoryInfo(assetPath);
            string assetName   = d.Name;
            string assetFolder = d.Parent.Name;

            if (Text.TypeFaces.NeedReload(false))
            {
                Text.TypeFaces = new Typefaces(); // when opening bundle creator settings without loading paks first
            }
            int index;
            {
                if (Globals.Game.ActualGame == EGame.Valorant || Globals.Game.ActualGame == EGame.Spellbreak)
                {
                    index = 1;
                }
                else
                {
                    index = 0;
                }
            }
            string exportType;

            {
                if (exportTypes.Length > index && (exportTypes[index].String == "BlueprintGeneratedClass" || exportTypes[index].String == "FortWeaponAdditionalData_AudioVisualizerData" || exportTypes[index].String == "FortWeaponAdditionalData_SingleWieldState"))
                {
                    index++;
                }

                exportType = exportTypes.Length > index ? exportTypes[index].String : string.Empty;
            }

            switch (exportType)
            {
            case "AthenaConsumableEmoteItemDefinition":
            case "AthenaSkyDiveContrailItemDefinition":
            case "AthenaLoadingScreenItemDefinition":
            case "AthenaVictoryPoseItemDefinition":
            case "AthenaPetCarrierItemDefinition":
            case "AthenaMusicPackItemDefinition":
            case "AthenaBattleBusItemDefinition":
            case "AthenaCharacterItemDefinition":
            case "FortAlterationItemDefinition":
            case "AthenaBackpackItemDefinition":
            case "AthenaPickaxeItemDefinition":
            case "AthenaGadgetItemDefinition":
            case "AthenaGliderItemDefinition":
            case "AthenaDailyQuestDefinition":
            case "FortBackpackItemDefinition":
            case "AthenaSprayItemDefinition":
            case "AthenaDanceItemDefinition":
            case "AthenaEmojiItemDefinition":
            case "AthenaItemWrapDefinition":
            case "AthenaToyItemDefinition":
            case "FortHeroType":
            case "FortTokenType":
            case "FortAbilityKit":
            case "FortWorkerType":
            case "RewardGraphToken":
            case "FortBannerTokenType":
            case "FortVariantTokenType":
            case "FortDecoItemDefinition":
            case "FortFeatItemDefinition":
            case "FortStatItemDefinition":
            case "FortTrapItemDefinition":
            case "FortAmmoItemDefinition":
            case "FortQuestItemDefinition":
            case "FortBadgeItemDefinition":
            case "FortAwardItemDefinition":
            case "FortGadgetItemDefinition":
            case "FortPlaysetItemDefinition":
            case "FortGiftBoxItemDefinition":
            case "FortSpyTechItemDefinition":
            case "FortOutpostItemDefinition":
            case "FortAccoladeItemDefinition":
            case "FortCardPackItemDefinition":
            case "FortDefenderItemDefinition":
            case "FortCurrencyItemDefinition":
            case "FortResourceItemDefinition":
            case "FortCodeTokenItemDefinition":
            case "FortSchematicItemDefinition":
            case "FortExpeditionItemDefinition":
            case "FortIngredientItemDefinition":
            case "FortAccountBuffItemDefinition":
            case "FortWeaponMeleeItemDefinition":
            case "FortContextTrapItemDefinition":
            case "FortPlayerPerksItemDefinition":
            case "FortPlaysetPropItemDefinition":
            case "FortHomebaseNodeItemDefinition":
            case "FortWeaponRangedItemDefinition":
            case "FortNeverPersistItemDefinition":
            case "RadioContentSourceItemDefinition":
            case "FortPlaysetGrenadeItemDefinition":
            case "FortPersonalVehicleItemDefinition":
            case "FortGameplayModifierItemDefinition":
            case "FortHardcoreModifierItemDefinition":
            case "FortConsumableAccountItemDefinition":
            case "FortConversionControlItemDefinition":
            case "FortAccountBuffCreditItemDefinition":
            case "FortPersistentResourceItemDefinition":
            case "FortHomebaseBannerIconItemDefinition":
            case "FortCampaignHeroLoadoutItemDefinition":
            case "FortConditionalResourceItemDefinition":
            case "FortChallengeBundleScheduleDefinition":
            case "FortWeaponMeleeDualWieldItemDefinition":
            case "FortDailyRewardScheduleTokenDefinition":
            case "FortCreativeRealEstatePlotItemDefinition":
            {
                BaseIcon icon   = new BaseIcon(exports[index], exportType, ref assetName);
                int      height = icon.Size + icon.AdditionalSize;
                using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            Rarity.DrawRarity(c, icon);
                        }

                        LargeSmallImage.DrawPreviewImage(c, icon);

                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
                            {
                                Text.DrawBackground(c, icon);
                                Text.DrawDisplayName(c, icon);
                                Text.DrawDescription(c, icon);
                                if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini)
                                {
                                    if (!icon.ShortDescription.Equals(icon.DisplayName) &&
                                        !icon.ShortDescription.Equals(icon.Description))
                                    {
                                        Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription);
                                    }
                                    Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource);
                                }
                            }

                            UserFacingFlag.DrawUserFacingFlags(c, icon);

                            // has more things to show
                            if (height > icon.Size)
                            {
                                Statistics.DrawStats(c, icon);
                            }
                        }

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "FortPlaylistAthena":
            {
                BasePlaylist icon = new BasePlaylist(exports[index]);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            Rarity.DrawRarity(c, icon);
                        }

                        LargeSmallImage.DrawNotStretchedPreviewImage(c, icon);

                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
                            {
                                Text.DrawBackground(c, icon);
                                Text.DrawDisplayName(c, icon);
                                Text.DrawDescription(c, icon);
                            }
                        }

                        // Watermark.DrawWatermark(c); // boi why would you watermark something you don't own ¯\_(ツ)_/¯
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "AthenaSeasonItemDefinition":
            {
                BaseSeason icon = new BaseSeason(exports[index], assetFolder);
                using (var ret = new SKBitmap(icon.Width, icon.HeaderHeight + icon.AdditionalSize,
                                              SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        icon.Draw(c);

                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "FortMtxOfferData":
            {
                BaseOffer icon = new BaseOffer(exports[index]);
                using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            icon.DrawBackground(c);
                        }

                        icon.DrawImage(c);

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "MaterialInstanceConstant":
            {
                if (assetFolder.Equals("MI_OfferImages"))
                {
                    BaseOfferMaterial icon = new BaseOfferMaterial(exports[index]);
                    using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul))
                        using (var c = new SKCanvas(ret))
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                            {
                                icon.DrawBackground(c);
                            }

                            icon.DrawImage(c);

                            Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                            ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                        }

                    return(true);
                }

                return(false);
            }

            case "FortItemSeriesDefinition":
            {
                BaseIcon icon = new BaseIcon();
                using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        Serie.GetRarity(icon, exports[index]);
                        Rarity.DrawRarity(c, icon);

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "PlaylistUserOptionEnum":
            case "PlaylistUserOptionBool":
            case "PlaylistUserOptionString":
            case "PlaylistUserOptionIntEnum":
            case "PlaylistUserOptionIntRange":
            case "PlaylistUserOptionColorEnum":
            case "PlaylistUserOptionFloatEnum":
            case "PlaylistUserOptionFloatRange":
            case "PlaylistUserOptionPrimaryAsset":
            case "PlaylistUserOptionCollisionProfileEnum":
            {
                BaseUserOption icon = new BaseUserOption(exports[index]);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        icon.Draw(c);

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "FortChallengeBundleItemDefinition":
            {
                BaseBundle icon = new BaseBundle(exports[index], assetFolder);
                using (var ret = new SKBitmap(icon.Width, icon.HeaderHeight + icon.AdditionalSize,
                                              SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        HeaderStyle.DrawHeaderPaint(c, icon);
                        HeaderStyle.DrawHeaderText(c, icon);
                        QuestStyle.DrawQuests(c, icon);
                        QuestStyle.DrawCompletionRewards(c, icon);

                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "FortItemAccessTokenType":
            {
                BaseItemAccess icon = new BaseItemAccess(exports[index]);
                using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque))
                    using (var c = new SKCanvas(ret))
                    {
                        icon.Draw(c);

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "MapUIData":
            {
                BaseMapUIData icon = new BaseMapUIData(exports[index]);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        icon.Draw(c);
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "ArmorUIData":
            case "SprayUIData":
            case "ThemeUIData":
            case "ContractUIData":
            case "CurrencyUIData":
            case "GameModeUIData":
            case "CharacterUIData":
            case "SprayLevelUIData":
            case "EquippableUIData":
            case "PlayerCardUIData":
            case "Gun_UIData_Base_C":
            case "CharacterRoleUIData":
            case "EquippableSkinUIData":
            case "EquippableCharmUIData":
            case "EquippableSkinLevelUIData":
            case "EquippableSkinChromaUIData":
            case "EquippableCharmLevelUIData":
            {
                BaseUIData icon = new BaseUIData(exports, index);
                using (var ret = new SKBitmap(icon.Width + icon.AdditionalWidth, icon.Height, SKColorType.Rgba8888,
                                              SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        icon.Draw(c);

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            //case "StreamedVideoDataAsset": // must find a way to automatically gets the right version in the url
            //    {
            //        if (Globals.Game.ActualGame == EGame.Valorant && exports[index].GetExport<StructProperty>("Uuid") is StructProperty s && s.Value is FGuid uuid)
            //        {
            //            Process.Start(new ProcessStartInfo
            //            {
            //                FileName = string.Format(
            //                    "http://valorant.dyn.riotcdn.net/x/videos/release-01.05/{0}_default_universal.mp4",
            //                    $"{uuid.A:x8}-{uuid.B >> 16:x4}-{uuid.B & 0xFFFF:x4}-{uuid.C >> 16:x4}-{uuid.C & 0xFFFF:x4}{uuid.D:x8}"),
            //                UseShellExecute = true
            //            });
            //        }
            //        return false;
            //    }
            case "GQuest":
            case "GAccolade":
            case "GCosmeticSkin":
            case "GCharacterPerk":
            case "GCosmeticTitle":
            case "GCosmeticBadge":
            case "GCosmeticEmote":
            case "GCosmeticTriumph":
            case "GCosmeticRunTrail":
            case "GCosmeticArtifact":
            case "GCosmeticDropTrail":
            {
                BaseGCosmetic icon = new BaseGCosmetic(exports[index], exportType);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign == EIconDesign.Flat)
                        {
                            icon.Draw(c);
                        }
                        else if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            Rarity.DrawRarity(c, icon);
                        }

                        LargeSmallImage.DrawPreviewImage(c, icon);

                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground &&
                            (EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
                        {
                            Text.DrawBackground(c, icon);
                            Text.DrawDisplayName(c, icon);
                            Text.DrawDescription(c, icon);
                        }

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            case "GCosmeticCard":
            {
                BaseGCosmetic icon = new BaseGCosmetic(exports[index], exportType);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign == EIconDesign.Flat)
                        {
                            icon.Draw(c);
                        }
                        else
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                            {
                                Rarity.DrawRarity(c, icon);
                            }
                        }

                        LargeSmallImage.DrawPreviewImage(c, icon);

                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
                            {
                                Text.DrawBackground(c, icon);
                                Text.DrawDisplayName(c, icon);
                                Text.DrawDescription(c, icon);
                            }
                        }

                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }

            // Battle Breakers
            case "WExpGenericAccountItemDefinition":
            {
                BaseBBDefinition icon = new BaseBBDefinition(exports[index], exportType);
                using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul))
                    using (var c = new SKCanvas(ret))
                    {
                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            if (icon.RarityBackgroundImage != null)
                            {
                                c.DrawBitmap(icon.RarityBackgroundImage, new SKRect(icon.Margin, icon.Margin, icon.Width - icon.Margin, icon.Height - icon.Margin),
                                             new SKPaint {
                                        FilterQuality = SKFilterQuality.High, IsAntialias = true
                                    });
                            }
                            else
                            {
                                Rarity.DrawRarity(c, icon);
                            }
                        }

                        LargeSmallImage.DrawPreviewImage(c, icon);

                        if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground)
                        {
                            if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText)
                            {
                                Text.DrawBackground(c, icon);
                                Text.DrawDisplayName(c, icon);
                                Text.DrawDescription(c, icon);
                            }
                        }

                        Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512
                        ImageBoxVm.imageBoxViewModel.Set(ret, assetName);
                    }

                return(true);
            }
            }

            return(false);
        }
 internal void Debug_MakeSerieError(Serie a_serie)
 {
     a_serie.State = SerieState.Error;
 }
Ejemplo n.º 40
0
        public override void ApplyFormula()
        {
            this.Series.Clear();

            Serie oversold = new Serie()
            {
                Color = this.Serie_Bounded_Lines_Color, Serie_Type = SerieType.line, Column_Data_Label = "Sobre Venta", Column_Serie_ID = "rsid"
            };
            Serie serie = new Serie()
            {
                Color = this.Serie_Color, Serie_Type = SerieType.line, Column_Data_Label = "RSI " + this.Rounds, Column_Serie_ID = "rsis"
            };
            Serie overbought = new Serie()
            {
                Color = this.Serie_Bounded_Lines_Color, Serie_Type = SerieType.line, Column_Data_Label = "Sobre Compra", Column_Serie_ID = "rsib"
            };

            //Serie originalDataSource = Candel.GetDataSerie(base.Data_Source, DataSourceFieldUsed.PercentVariation);
            Serie originalDataSource = Candel.GetDataSerie(base.Data_Source, DataSourceFieldUsed.Close, false);

            double[] values = new double[this.Rounds];
            double   last_ups_average = 0;
            double   last_downs_average = 0;
            double   value = 0, up = 0, down = 0;

            for (int i = 1; i < originalDataSource.Data.Count; i++)
            {
                values[i % this.Rounds] = originalDataSource.Data[i].Value - originalDataSource.Data[i - 1].Value;

                //last_ups_average = ((values.Where(x => x > 0).Count() > 0) ? values.Where(x => x > 0).Average() : 0);
                //last_downs_average = ((values.Where(x => x < 0).Count() > 0) ? Math.Abs(values.Where(x => x < 0).Average()) : 100);

                if (i < this.Rounds)
                {
                    last_ups_average   = ((values.Where(x => x > 0).Count() > 0) ? values.Where(x => x > 0).Sum() / this.Rounds : 0);
                    last_downs_average = ((values.Where(x => x < 0).Count() > 0) ? Math.Abs(values.Where(x => x < 0).Sum() / this.Rounds) : 0);
                }
                else
                {
                    up   = values[i % this.Rounds] > 0 ? values[i % this.Rounds] : 0;
                    down = values[i % this.Rounds] < 0 ? Math.Abs(values[i % this.Rounds]) : 0;

                    last_ups_average   = (last_ups_average * (this.Rounds - 1) + up) / this.Rounds;
                    last_downs_average = (last_downs_average * (this.Rounds - 1) + down) / this.Rounds;
                }

                value = last_downs_average == 0 ? 100 : 100 - (100 / (1 + (last_ups_average / last_downs_average)));

                if (originalDataSource.Data[i].Visible)
                {
                    serie.Data.Add(new SerieValue()
                    {
                        Date = originalDataSource.Data[i].Date, Value = value
                    });
                }
            }

            foreach (SerieValue item in serie.Data)
            {
                oversold.Data.Add(new SerieValue()
                {
                    Date = item.Date, Value = this.Oversold
                });
                overbought.Data.Add(new SerieValue()
                {
                    Date = item.Date, Value = this.Overbought
                });
            }

            this.Series.Add(serie);
            this.Series.Add(oversold);
            this.Series.Add(overbought);
        }
 public void Atualizar(int id, Serie entidade)
 {
     listaSeries[id] = entidade;
 }
        internal override void DownloadChapters(Serie a_serie, Action <int, IEnumerable <Chapter> > a_progress_callback)
        {
            Limiter.Aquire(a_serie);
            try
            {
                Sleep();
            }
            finally
            {
                Limiter.Release(a_serie);
            }

            a_serie.State = SerieState.Downloading;

            Debug.Assert(a_serie.Server.Name == m_name);

            var serie = m_series.FirstOrDefault(s => s.Title == a_serie.Title);

            if (serie == null)
            {
                throw new Exception();
            }

            if (serie.Title.Contains("error chapters none"))
            {
                throw new Exception();
            }

            bool gen_exc = serie.Title.Contains("error chapters few");

            int count = -1;

            if (gen_exc)
            {
                count = m_items_per_page * 8 + m_items_per_page / 3;
            }

            if (serie.Title.Contains("few chapters"))
            {
                count = 3;
            }

            var toreport = (from chapter in serie.GetChapters(count)
                            select new Chapter(a_serie, chapter.URL, chapter.Title)).ToArray();

            int total = toreport.Length;

            if (m_slow_chapters)
            {
                List <List <Chapter> > listlist = new List <List <Chapter> >();
                while (toreport.Any())
                {
                    var part = toreport.Take(m_items_per_page).ToList();
                    toreport = toreport.Skip(m_items_per_page).ToArray();
                    listlist.Add(part);
                }

                ConcurrentBag <Tuple <int, int, Chapter> > chapters =
                    new ConcurrentBag <Tuple <int, int, Chapter> >();

                bool exc = false;

                Parallel.ForEach(listlist,
                                 new ParallelOptions()
                {
                    MaxDegreeOfParallelism = MaxConnectionsPerServer
                },
                                 (list) =>
                {
                    foreach (var el in list)
                    {
                        chapters.Add(new Tuple <int, int, Chapter>(listlist.IndexOf(list), list.IndexOf(el), el));
                    }

                    Limiter.Aquire(a_serie);
                    try
                    {
                        Sleep();
                    }
                    finally
                    {
                        Limiter.Release(a_serie);
                    }

                    var result = (from s in chapters
                                  orderby s.Item1, s.Item2
                                  select s.Item3).ToList();

                    if (gen_exc)
                    {
                        if (exc)
                        {
                            return;
                        }
                    }

                    a_progress_callback(
                        result.Count * 100 / total,
                        result);

                    if (gen_exc)
                    {
                        if (!exc)
                        {
                            exc = true;
                            throw new Exception();
                        }
                    }
                });
            }
            else
            {
                a_progress_callback(100, toreport);

                if (gen_exc)
                {
                    throw new Exception();
                }
            }
        }
Ejemplo n.º 43
0
        public Chart IOs_Minute(long ThingID, long EndPointTypeID)
        {
            EndPointType endType = repoEndpointTypes.Find(EndPointTypeID);
            Thing        th      = repoThings.Find(ThingID);
            Chart        hc      = new Chart("HC_" + "Thing" + ThingID + "EndPointType" + EndPointTypeID + "Inputs");

            hc.title.Text    = "Last 60 Minutes";
            hc.subTitle.Text = th.Title + " - " + endType.Title;
            hc.xAxis.GenerateMinutesList(true);
            hc.legend.layout = Layout.vertical.ToString();

            List <Rpt_ThingEnd_IOs_Minutes_Result> rpt = db.Rpt_ThingEnd_IOs_Minutes(ThingID, EndPointTypeID).ToList();

            #region GetMin
            Serie s1 = new Serie();
            s1.Name = "Min";
            Rpt_ThingEnd_IOs_Minutes_Result rpt1 = rpt[0];
            List <int> resultMin = new List <int>();
            resultMin.Add(rpt1.C1.GetValueOrDefault());
            resultMin.Add(rpt1.C2.GetValueOrDefault());
            resultMin.Add(rpt1.C3.GetValueOrDefault());
            resultMin.Add(rpt1.C4.GetValueOrDefault());
            resultMin.Add(rpt1.C5.GetValueOrDefault());
            resultMin.Add(rpt1.C6.GetValueOrDefault());
            resultMin.Add(rpt1.C7.GetValueOrDefault());
            resultMin.Add(rpt1.C8.GetValueOrDefault());
            resultMin.Add(rpt1.C9.GetValueOrDefault());
            resultMin.Add(rpt1.C10.GetValueOrDefault());
            resultMin.Add(rpt1.C11.GetValueOrDefault());
            resultMin.Add(rpt1.C12.GetValueOrDefault());
            resultMin.Add(rpt1.C13.GetValueOrDefault());
            resultMin.Add(rpt1.C14.GetValueOrDefault());
            resultMin.Add(rpt1.C15.GetValueOrDefault());
            resultMin.Add(rpt1.C16.GetValueOrDefault());
            resultMin.Add(rpt1.C17.GetValueOrDefault());
            resultMin.Add(rpt1.C18.GetValueOrDefault());
            resultMin.Add(rpt1.C19.GetValueOrDefault());
            resultMin.Add(rpt1.C20.GetValueOrDefault());
            resultMin.Add(rpt1.C21.GetValueOrDefault());
            resultMin.Add(rpt1.C22.GetValueOrDefault());
            resultMin.Add(rpt1.C23.GetValueOrDefault());
            resultMin.Add(rpt1.C24.GetValueOrDefault());
            resultMin.Add(rpt1.C25.GetValueOrDefault());
            resultMin.Add(rpt1.C26.GetValueOrDefault());
            resultMin.Add(rpt1.C27.GetValueOrDefault());
            resultMin.Add(rpt1.C28.GetValueOrDefault());
            resultMin.Add(rpt1.C29.GetValueOrDefault());
            resultMin.Add(rpt1.C30.GetValueOrDefault());
            resultMin.Add(rpt1.C31.GetValueOrDefault());
            resultMin.Add(rpt1.C32.GetValueOrDefault());
            resultMin.Add(rpt1.C32.GetValueOrDefault());
            resultMin.Add(rpt1.C33.GetValueOrDefault());
            resultMin.Add(rpt1.C34.GetValueOrDefault());
            resultMin.Add(rpt1.C35.GetValueOrDefault());
            resultMin.Add(rpt1.C36.GetValueOrDefault());
            resultMin.Add(rpt1.C37.GetValueOrDefault());
            resultMin.Add(rpt1.C38.GetValueOrDefault());
            resultMin.Add(rpt1.C39.GetValueOrDefault());
            resultMin.Add(rpt1.C40.GetValueOrDefault());
            resultMin.Add(rpt1.C41.GetValueOrDefault());
            resultMin.Add(rpt1.C42.GetValueOrDefault());
            resultMin.Add(rpt1.C43.GetValueOrDefault());
            resultMin.Add(rpt1.C44.GetValueOrDefault());
            resultMin.Add(rpt1.C45.GetValueOrDefault());
            resultMin.Add(rpt1.C46.GetValueOrDefault());
            resultMin.Add(rpt1.C47.GetValueOrDefault());
            resultMin.Add(rpt1.C48.GetValueOrDefault());
            resultMin.Add(rpt1.C49.GetValueOrDefault());
            resultMin.Add(rpt1.C50.GetValueOrDefault());
            resultMin.Add(rpt1.C51.GetValueOrDefault());
            resultMin.Add(rpt1.C52.GetValueOrDefault());
            resultMin.Add(rpt1.C53.GetValueOrDefault());
            resultMin.Add(rpt1.C54.GetValueOrDefault());
            resultMin.Add(rpt1.C55.GetValueOrDefault());
            resultMin.Add(rpt1.C56.GetValueOrDefault());
            resultMin.Add(rpt1.C57.GetValueOrDefault());
            resultMin.Add(rpt1.C58.GetValueOrDefault());
            resultMin.Add(rpt1.C59.GetValueOrDefault());
            resultMin.Add(rpt1.C60.GetValueOrDefault());
            resultMin.Reverse();
            s1.Data = resultMin;
            hc.series.Add(s1);
            #endregion

            #region GetMax
            Serie s2 = new Serie();
            s2.Name = "Max";
            Rpt_ThingEnd_IOs_Minutes_Result rpt2 = rpt[1];
            List <int> resultMax = new List <int>();
            resultMax.Add(rpt2.C1.GetValueOrDefault());
            resultMax.Add(rpt2.C2.GetValueOrDefault());
            resultMax.Add(rpt2.C3.GetValueOrDefault());
            resultMax.Add(rpt2.C4.GetValueOrDefault());
            resultMax.Add(rpt2.C5.GetValueOrDefault());
            resultMax.Add(rpt2.C6.GetValueOrDefault());
            resultMax.Add(rpt2.C7.GetValueOrDefault());
            resultMax.Add(rpt2.C8.GetValueOrDefault());
            resultMax.Add(rpt2.C9.GetValueOrDefault());
            resultMax.Add(rpt2.C10.GetValueOrDefault());
            resultMax.Add(rpt2.C11.GetValueOrDefault());
            resultMax.Add(rpt2.C12.GetValueOrDefault());
            resultMax.Add(rpt2.C13.GetValueOrDefault());
            resultMax.Add(rpt2.C14.GetValueOrDefault());
            resultMax.Add(rpt2.C15.GetValueOrDefault());
            resultMax.Add(rpt2.C16.GetValueOrDefault());
            resultMax.Add(rpt2.C17.GetValueOrDefault());
            resultMax.Add(rpt2.C18.GetValueOrDefault());
            resultMax.Add(rpt2.C19.GetValueOrDefault());
            resultMax.Add(rpt2.C20.GetValueOrDefault());
            resultMax.Add(rpt2.C21.GetValueOrDefault());
            resultMax.Add(rpt2.C22.GetValueOrDefault());
            resultMax.Add(rpt2.C23.GetValueOrDefault());
            resultMax.Add(rpt2.C24.GetValueOrDefault());
            resultMax.Add(rpt2.C25.GetValueOrDefault());
            resultMax.Add(rpt2.C26.GetValueOrDefault());
            resultMax.Add(rpt2.C27.GetValueOrDefault());
            resultMax.Add(rpt2.C28.GetValueOrDefault());
            resultMax.Add(rpt2.C29.GetValueOrDefault());
            resultMax.Add(rpt2.C30.GetValueOrDefault());
            resultMax.Add(rpt2.C31.GetValueOrDefault());
            resultMax.Add(rpt2.C32.GetValueOrDefault());
            resultMax.Add(rpt2.C32.GetValueOrDefault());
            resultMax.Add(rpt2.C33.GetValueOrDefault());
            resultMax.Add(rpt2.C34.GetValueOrDefault());
            resultMax.Add(rpt2.C35.GetValueOrDefault());
            resultMax.Add(rpt2.C36.GetValueOrDefault());
            resultMax.Add(rpt2.C37.GetValueOrDefault());
            resultMax.Add(rpt2.C38.GetValueOrDefault());
            resultMax.Add(rpt2.C39.GetValueOrDefault());
            resultMax.Add(rpt2.C40.GetValueOrDefault());
            resultMax.Add(rpt2.C41.GetValueOrDefault());
            resultMax.Add(rpt2.C42.GetValueOrDefault());
            resultMax.Add(rpt2.C43.GetValueOrDefault());
            resultMax.Add(rpt2.C44.GetValueOrDefault());
            resultMax.Add(rpt2.C45.GetValueOrDefault());
            resultMax.Add(rpt2.C46.GetValueOrDefault());
            resultMax.Add(rpt2.C47.GetValueOrDefault());
            resultMax.Add(rpt2.C48.GetValueOrDefault());
            resultMax.Add(rpt2.C49.GetValueOrDefault());
            resultMax.Add(rpt2.C50.GetValueOrDefault());
            resultMax.Add(rpt2.C51.GetValueOrDefault());
            resultMax.Add(rpt2.C52.GetValueOrDefault());
            resultMax.Add(rpt2.C53.GetValueOrDefault());
            resultMax.Add(rpt2.C54.GetValueOrDefault());
            resultMax.Add(rpt2.C55.GetValueOrDefault());
            resultMax.Add(rpt2.C56.GetValueOrDefault());
            resultMax.Add(rpt2.C57.GetValueOrDefault());
            resultMax.Add(rpt2.C58.GetValueOrDefault());
            resultMax.Add(rpt2.C59.GetValueOrDefault());
            resultMax.Add(rpt2.C60.GetValueOrDefault());
            resultMax.Reverse();
            s2.Data = resultMax;
            hc.series.Add(s2);
            #endregion

            #region GetAvg
            Serie s3 = new Serie();
            s3.Name = "Avg";
            Rpt_ThingEnd_IOs_Minutes_Result rpt3 = rpt[2];
            List <int> resultAvg = new List <int>();
            resultAvg.Add(rpt3.C1.GetValueOrDefault());
            resultAvg.Add(rpt3.C2.GetValueOrDefault());
            resultAvg.Add(rpt3.C3.GetValueOrDefault());
            resultAvg.Add(rpt3.C4.GetValueOrDefault());
            resultAvg.Add(rpt3.C5.GetValueOrDefault());
            resultAvg.Add(rpt3.C6.GetValueOrDefault());
            resultAvg.Add(rpt3.C7.GetValueOrDefault());
            resultAvg.Add(rpt3.C8.GetValueOrDefault());
            resultAvg.Add(rpt3.C9.GetValueOrDefault());
            resultAvg.Add(rpt3.C10.GetValueOrDefault());
            resultAvg.Add(rpt3.C11.GetValueOrDefault());
            resultAvg.Add(rpt3.C12.GetValueOrDefault());
            resultAvg.Add(rpt3.C13.GetValueOrDefault());
            resultAvg.Add(rpt3.C14.GetValueOrDefault());
            resultAvg.Add(rpt3.C15.GetValueOrDefault());
            resultAvg.Add(rpt3.C16.GetValueOrDefault());
            resultAvg.Add(rpt3.C17.GetValueOrDefault());
            resultAvg.Add(rpt3.C18.GetValueOrDefault());
            resultAvg.Add(rpt3.C19.GetValueOrDefault());
            resultAvg.Add(rpt3.C20.GetValueOrDefault());
            resultAvg.Add(rpt3.C21.GetValueOrDefault());
            resultAvg.Add(rpt3.C22.GetValueOrDefault());
            resultAvg.Add(rpt3.C23.GetValueOrDefault());
            resultAvg.Add(rpt3.C24.GetValueOrDefault());
            resultAvg.Add(rpt3.C25.GetValueOrDefault());
            resultAvg.Add(rpt3.C26.GetValueOrDefault());
            resultAvg.Add(rpt3.C27.GetValueOrDefault());
            resultAvg.Add(rpt3.C28.GetValueOrDefault());
            resultAvg.Add(rpt3.C29.GetValueOrDefault());
            resultAvg.Add(rpt3.C30.GetValueOrDefault());
            resultAvg.Add(rpt3.C31.GetValueOrDefault());
            resultAvg.Add(rpt3.C32.GetValueOrDefault());
            resultAvg.Add(rpt3.C32.GetValueOrDefault());
            resultAvg.Add(rpt3.C33.GetValueOrDefault());
            resultAvg.Add(rpt3.C34.GetValueOrDefault());
            resultAvg.Add(rpt3.C35.GetValueOrDefault());
            resultAvg.Add(rpt3.C36.GetValueOrDefault());
            resultAvg.Add(rpt3.C37.GetValueOrDefault());
            resultAvg.Add(rpt3.C38.GetValueOrDefault());
            resultAvg.Add(rpt3.C39.GetValueOrDefault());
            resultAvg.Add(rpt3.C40.GetValueOrDefault());
            resultAvg.Add(rpt3.C41.GetValueOrDefault());
            resultAvg.Add(rpt3.C42.GetValueOrDefault());
            resultAvg.Add(rpt3.C43.GetValueOrDefault());
            resultAvg.Add(rpt3.C44.GetValueOrDefault());
            resultAvg.Add(rpt3.C45.GetValueOrDefault());
            resultAvg.Add(rpt3.C46.GetValueOrDefault());
            resultAvg.Add(rpt3.C47.GetValueOrDefault());
            resultAvg.Add(rpt3.C48.GetValueOrDefault());
            resultAvg.Add(rpt3.C49.GetValueOrDefault());
            resultAvg.Add(rpt3.C50.GetValueOrDefault());
            resultAvg.Add(rpt3.C51.GetValueOrDefault());
            resultAvg.Add(rpt3.C52.GetValueOrDefault());
            resultAvg.Add(rpt3.C53.GetValueOrDefault());
            resultAvg.Add(rpt3.C54.GetValueOrDefault());
            resultAvg.Add(rpt3.C55.GetValueOrDefault());
            resultAvg.Add(rpt3.C56.GetValueOrDefault());
            resultAvg.Add(rpt3.C57.GetValueOrDefault());
            resultAvg.Add(rpt3.C58.GetValueOrDefault());
            resultAvg.Add(rpt3.C59.GetValueOrDefault());
            resultAvg.Add(rpt3.C60.GetValueOrDefault());
            resultAvg.Reverse();
            s3.Data = resultAvg;
            hc.series.Add(s3);
            #endregion

            return(hc);
        }
Ejemplo n.º 44
0
 private void SelectSerie(Serie a_serie)
 {
     Form.seriesListBox.SelectedItem =
         Form.seriesListBox.Items.Cast <SerieListItem>().FirstOrDefault(s => s.Serie == a_serie);
 }
Ejemplo n.º 45
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         var   allSeries   = serieRepo.getAll();
         Serie serieToedit = serieRepo.GetById(allSeries, serieSelected).FirstOrDefault();
         //recogemos la serie a modificar y vamos comparando si los datos introducidos son distintos a los que tiene.
         //en ese caso se los asignamos
         if (serieToedit.Title != txtTitle.Text)
         {
             serieToedit.Title = txtTitle.Text;
         }
         if (serieToedit.NumTemp.ToString() != txtTemporadas.Text)
         {
             serieToedit.NumTemp = int.Parse(txtTemporadas.Text);
         }
         if (serieToedit.IdGenre != getGenre(cmbGenreMod.SelectedItem.ToString()))
         {
             serieToedit.IdGenre = getGenre(cmbGenreMod.SelectedItem.ToString());
         }
         if (serieToedit.Year.ToString() != txtYear.Text)
         {
             serieToedit.Year = int.Parse(txtYear.Text);
         }
         if (serieToedit.Description != txtDescription.Text)
         {
             serieToedit.Description = txtDescription.Text;
         }
         if (photo == true)
         {
             serieToedit.PhotoPath = photoPath;
         }
         //comprobamos campos
         if (string.IsNullOrEmpty(txtTitle.Text) || string.IsNullOrEmpty(txtTemporadas.Text) || string.IsNullOrEmpty(txtYear.Text) || string.IsNullOrEmpty(txtRate.Text) || getGenre(cmbGenreMod.SelectedItem.ToString()) == -1 ||
             string.IsNullOrEmpty(txtDescription.Text))
         {
             MessageBox.Show("Faltan campos por rellenar", "Error");
         }
         else
         {
             //si todo ha salido bien llamamos al metodo para modificar
             if (serieCtr.modificarSerie(serieToedit) != true)
             {
                 MessageBox.Show("Ha ocurrido un error al modificar la serie", "Error");
             }
             else
             {
                 //reiniciamos campos y valores.
                 MessageBox.Show("Serie modificada", "Éxito");
                 txtTemporadas.Text  = "";
                 txtTitle.Text       = "";
                 txtRate.Text        = "";
                 cmbGenres.Text      = "Selecciona";
                 txtYear.Text        = "";
                 txtDescription.Text = "";
                 cmbGenreMod.Text    = "Selecciona";
                 imgSerie.Image      = null;
                 listBoxSeries.Items.Clear();
             }
         }
     }
     catch (Exception q)
     {
         MessageBox.Show("Campos Rellenados incorrectamente" + q.Message, "Error");
     }
 }
Ejemplo n.º 46
0
 public SerieRepositorioTeste()
 {
     _repositorio = new SerieRepositorio();
     _serie       = new Serie(0, Genero.Acao, "DIO Bootcamp", "Bootcamp de C# DIO", 2021);
     _repositorio.Insere(_serie);
 }
        /// <summary>
        /// Génère le code HTML de l'arborescence du tournoi passé en paramètre
        /// </summary>
        /// <param name="t">Tournoi dont il faut créer l'arborescence</param>
        /// <param name="actionSerie">Texte a afficher dans les boutons des séries</param>
        /// <returns>Le code HTML de l'arborescence sous forme de string</returns>
        public static string Generate(Tournoi t, string actionSerie)
        {
            int           match_white_span;
            int           match_span;
            int           position_in_match_span;
            int           column_stagger_offset;
            int           effective_row;
            int           col_match_num;
            int           effective_serie_id;
            int           rounds    = t.GetNbTours();
            int           teams     = t.NbEquipesMax;
            int           max_rows  = teams << 1;
            StringBuilder HTMLTable = new StringBuilder();

            HTMLTable.AppendLine("<style type=\"text/css\">");
            HTMLTable.AppendLine("    .thd {background: rgb(220,220,220); font: bold 10pt Arial; text-align: center;}");
            HTMLTable.AppendLine("    .team {color: white; background: rgb(100,100,100); font: bold 10pt Arial; border-right: solid 2px black;}");
            HTMLTable.AppendLine("    .winner {color: white; background: rgb(60,60,60); font: bold 10pt Arial;}");
            HTMLTable.AppendLine("    .vs {font: bold 7pt Arial; border-right: solid 2px black; text-align : center;}");
            HTMLTable.AppendLine("    td, th {padding: 3px 15px; border-right: dotted 2px rgb(200,200,200); text-align: right;}");
            HTMLTable.AppendLine("    h1 {font: bold 14pt Arial; margin-top: 24pt;}");
            HTMLTable.AppendLine("    .vs button {border: 1px solid #e7e7e7; background-color:white; text-align: center; text-decoration: none; display: inline-block; font-size: 9px; border-radius: 8px;}");
            HTMLTable.AppendLine("    .vs button:hover {background-color: #e7e7e7;}");
            HTMLTable.AppendLine("</style>");

            HTMLTable.AppendLine("<h1>Tournoi : " + t.Nom + "</h1>");
            HTMLTable.AppendLine("<table border=\"0\" cellspacing=\"0\">");



            for (int row = 0; row <= max_rows; row++)
            {
                HTMLTable.AppendLine("    <tr>");
                for (int col = 1; col <= rounds + 1; col++)
                {
                    match_span            = 1 << (col + 1);
                    match_white_span      = (1 << col) - 1;
                    column_stagger_offset = match_white_span >> 1;

                    int noTour = (rounds - col + 1);

                    if (row == 0)
                    {
                        if (col <= rounds)
                        {
                            HTMLTable.AppendLine("        <th class=\"thd\">Tour " + noTour + "</th>");
                        }
                        else
                        {
                            HTMLTable.AppendLine("        <th class=\"thd\">Vainqueur</th>");
                        }
                    }
                    else if (row == 1)
                    {
                        HTMLTable.AppendLine("        <td class=\"white_span\" rowspan=\"" + (match_white_span - column_stagger_offset) + "\">&nbsp;</td>");
                    }
                    else
                    {
                        effective_row = row + column_stagger_offset;
                        if (col <= rounds)
                        {
                            position_in_match_span = effective_row % match_span;
                            position_in_match_span = (position_in_match_span == 0) ? match_span : position_in_match_span;
                            col_match_num          = (effective_row / match_span) + ((position_in_match_span < match_span) ? 1 : 0);

                            effective_serie_id = col_match_num;

                            Tour  tour  = t.GetTourByNo(noTour);
                            Serie serie = tour.GetSerieById(effective_serie_id);

                            if ((position_in_match_span == 1) && (effective_row % match_span == position_in_match_span))
                            {
                                HTMLTable.AppendLine("        <td class=\"white_span\" rowspan=\"" + match_white_span + "\">&nbsp;</td>");
                            }
                            else if ((position_in_match_span == ((match_span >> 1) + 1)) && (effective_row % match_span == position_in_match_span))
                            {
                                string disabled = "";
                                if (serie == null || serie.GetEquipes() == null || serie.GetEquipes().Contains(null))
                                {
                                    disabled = "disabled";
                                }
                                HTMLTable.AppendLine("        <td class=\"vs\" rowspan=\"" + match_white_span + "\"> VS <br><button " + disabled + " name=\"" + t.Id + ";" + noTour + ";" + effective_serie_id + "\">" + actionSerie + "</button></td>");
                            }
                            else
                            {
                                if (serie != null)
                                {
                                    List <Equipe> equipes = serie.GetEquipes();

                                    if ((position_in_match_span == (match_span >> 1)) && (effective_row % match_span == position_in_match_span))
                                    {
                                        HTMLTable.AppendLine("        <td class=\"team\">" + (equipes[0] == null ? "N.A" : equipes[0].Acronyme) + "</td>");
                                    }
                                    else if ((position_in_match_span == match_span) && (effective_row % match_span == 0))
                                    {
                                        HTMLTable.AppendLine("        <td class=\"team\">" + (equipes[1] == null ? "N.A" : equipes[1].Acronyme) + "</td>");
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (row == column_stagger_offset + 2)
                            {
                                Equipe gagnant = t.GetGagnant();


                                HTMLTable.AppendLine("        <td class=\"winner\">" + (gagnant == null ? "N.A" : gagnant.Acronyme) + "</td>");
                            }
                            else if (row == column_stagger_offset + 3)
                            {
                                HTMLTable.AppendLine("        <td class=\"white_span\" rowspan=\"" + (match_white_span - column_stagger_offset) + "\">&nbsp;</td>");
                            }
                        }
                    }
                }
                HTMLTable.AppendLine("    </tr>");
            }
            HTMLTable.AppendLine("</table>");


            return(HTMLTable.ToString());
        }
Ejemplo n.º 48
0
 public DetailVeiw(Serie serie)
 {
     BindingContext = new DetailViewModel(serie);
     InitializeComponent();
 }
Ejemplo n.º 49
0
 public void SelectBookmarkedSerie(Serie a_serie)
 {
     Form.bookmarkedSeriesListBox.SelectedItem =
         Form.bookmarkedSeriesListBox.Items.Cast <SerieBookmarkListItem>().FirstOrDefault(
             sbli => sbli.Serie == a_serie);
 }
Ejemplo n.º 50
0
 public BaseIcon(IUExport export, string assetName, bool forceHR) : this()
 {
     if (export.GetExport <ObjectProperty>("Series") is { } series)
     {
         Serie.GetRarity(this, series);
     }
Ejemplo n.º 51
0
    public void RandomSerie()
    {
        int   randomCorrect = Random.Range(0, imagesCompletes.Count);
        int   randomNumber  = Random.Range(0, listaSeries.Count);
        Serie newSerie      = listaSeries[randomNumber];

        Debug.Log(newSerie.name);
        imagesCompletes[randomCorrect].sprite = newSerie.GetSprite(randomCorrect);
        imagesCompletes[randomCorrect].color  = Color.white;

        if (randomCorrect == 0)
        {
            imageAntes.enabled = false;
            go1.GetComponent <CircleCollider2D>().enabled = false;
            imageAhora.sprite   = newSerie.GetSprite(1);
            imageDespues.sprite = newSerie.GetSprite(2);
            RectTransform rect2     = go2.GetComponent <RectTransform>();
            RectTransform rect3     = go3.GetComponent <RectTransform>();
            int           numberPos = Random.Range(0, posiciones.Count);
            if (numberPos == 0)
            {
                rect2.anchoredPosition = posiciones[0].anchoredPosition;
                rect3.anchoredPosition = posiciones[1].anchoredPosition;
            }
            else
            {
                rect2.anchoredPosition = posiciones[1].anchoredPosition;
                rect3.anchoredPosition = posiciones[0].anchoredPosition;
            }
        }
        else if (randomCorrect == 1)
        {
            imageAntes.sprite  = newSerie.GetSprite(0);
            imageAhora.enabled = false;
            go2.GetComponent <CircleCollider2D>().enabled = false;
            imageDespues.sprite = newSerie.GetSprite(2);

            RectTransform rect1     = go1.GetComponent <RectTransform>();
            RectTransform rect3     = go3.GetComponent <RectTransform>();
            int           numberPos = Random.Range(0, posiciones.Count);
            if (numberPos == 0)
            {
                rect1.anchoredPosition = posiciones[0].anchoredPosition;
                rect3.anchoredPosition = posiciones[1].anchoredPosition;
            }
            else
            {
                rect1.anchoredPosition = posiciones[1].anchoredPosition;
                rect3.anchoredPosition = posiciones[0].anchoredPosition;
            }
        }
        else if (randomCorrect == 2)
        {
            imageAntes.sprite    = newSerie.GetSprite(0);
            imageAhora.sprite    = newSerie.GetSprite(1);
            imageDespues.enabled = false;
            go3.GetComponent <CircleCollider2D>().enabled = false;
            RectTransform rect1     = go1.GetComponent <RectTransform>();
            RectTransform rect2     = go2.GetComponent <RectTransform>();
            int           numberPos = Random.Range(0, posiciones.Count);
            if (numberPos == 0)
            {
                rect1.anchoredPosition = posiciones[0].anchoredPosition;
                rect2.anchoredPosition = posiciones[1].anchoredPosition;
            }
            else
            {
                rect1.anchoredPosition = posiciones[1].anchoredPosition;
                rect2.anchoredPosition = posiciones[0].anchoredPosition;
            }
        }
    }
 public void Insere(Serie entidade)
 {
     listaSeries.Add(entidade);
 }
Ejemplo n.º 53
0
        public Chart IOs_Hour(long ThingID, long EndPointTypeID)
        {
            Thing ep = repoThings.Find(ThingID);
            Chart hc = new Chart("HC_" + "Thing" + ThingID + "EndPointType" + EndPointTypeID + "Inputs");

            hc.title.Text    = "Last 24 Hours";
            hc.subTitle.Text = ep.Title;
            hc.xAxis.GenerateHoursList(true);
            hc.legend.layout = Layout.vertical.ToString();

            List <Rpt_ThingEnd_IOs_Hours_Result> rpt = db.Rpt_ThingEnd_IOs_Hours(ThingID, EndPointTypeID).ToList();

            #region GetMin
            Serie s1 = new Serie();
            s1.Name = "Min";
            Rpt_ThingEnd_IOs_Hours_Result rpt1 = rpt[0];
            List <int> resultMin = new List <int>();
            resultMin.Add(rpt1.C1.GetValueOrDefault());
            resultMin.Add(rpt1.C2.GetValueOrDefault());
            resultMin.Add(rpt1.C3.GetValueOrDefault());
            resultMin.Add(rpt1.C4.GetValueOrDefault());
            resultMin.Add(rpt1.C5.GetValueOrDefault());
            resultMin.Add(rpt1.C6.GetValueOrDefault());
            resultMin.Add(rpt1.C7.GetValueOrDefault());
            resultMin.Add(rpt1.C8.GetValueOrDefault());
            resultMin.Add(rpt1.C9.GetValueOrDefault());
            resultMin.Add(rpt1.C10.GetValueOrDefault());
            resultMin.Add(rpt1.C11.GetValueOrDefault());
            resultMin.Add(rpt1.C12.GetValueOrDefault());
            resultMin.Add(rpt1.C13.GetValueOrDefault());
            resultMin.Add(rpt1.C14.GetValueOrDefault());
            resultMin.Add(rpt1.C15.GetValueOrDefault());
            resultMin.Add(rpt1.C16.GetValueOrDefault());
            resultMin.Add(rpt1.C17.GetValueOrDefault());
            resultMin.Add(rpt1.C18.GetValueOrDefault());
            resultMin.Add(rpt1.C19.GetValueOrDefault());
            resultMin.Add(rpt1.C20.GetValueOrDefault());
            resultMin.Add(rpt1.C21.GetValueOrDefault());
            resultMin.Add(rpt1.C22.GetValueOrDefault());
            resultMin.Add(rpt1.C23.GetValueOrDefault());
            resultMin.Add(rpt1.C24.GetValueOrDefault());
            resultMin.Reverse();
            s1.Data = resultMin;
            hc.series.Add(s1);
            #endregion

            #region GetMax
            Serie s2 = new Serie();
            s2.Name = "Max";
            Rpt_ThingEnd_IOs_Hours_Result rpt2 = rpt[1];
            List <int> resultMax = new List <int>();
            resultMax.Add(rpt2.C1.GetValueOrDefault());
            resultMax.Add(rpt2.C2.GetValueOrDefault());
            resultMax.Add(rpt2.C3.GetValueOrDefault());
            resultMax.Add(rpt2.C4.GetValueOrDefault());
            resultMax.Add(rpt2.C5.GetValueOrDefault());
            resultMax.Add(rpt2.C6.GetValueOrDefault());
            resultMax.Add(rpt2.C7.GetValueOrDefault());
            resultMax.Add(rpt2.C8.GetValueOrDefault());
            resultMax.Add(rpt2.C9.GetValueOrDefault());
            resultMax.Add(rpt2.C10.GetValueOrDefault());
            resultMax.Add(rpt2.C11.GetValueOrDefault());
            resultMax.Add(rpt2.C12.GetValueOrDefault());
            resultMax.Add(rpt2.C13.GetValueOrDefault());
            resultMax.Add(rpt2.C14.GetValueOrDefault());
            resultMax.Add(rpt2.C15.GetValueOrDefault());
            resultMax.Add(rpt2.C16.GetValueOrDefault());
            resultMax.Add(rpt2.C17.GetValueOrDefault());
            resultMax.Add(rpt2.C18.GetValueOrDefault());
            resultMax.Add(rpt2.C19.GetValueOrDefault());
            resultMax.Add(rpt2.C20.GetValueOrDefault());
            resultMax.Add(rpt2.C21.GetValueOrDefault());
            resultMax.Add(rpt2.C22.GetValueOrDefault());
            resultMax.Add(rpt2.C23.GetValueOrDefault());
            resultMax.Add(rpt2.C24.GetValueOrDefault());
            resultMax.Reverse();
            s2.Data = resultMax;
            hc.series.Add(s2);
            #endregion

            #region GetAvg
            Serie s3 = new Serie();
            s3.Name = "Avg";
            Rpt_ThingEnd_IOs_Hours_Result rpt3 = rpt[2];
            List <int> resultAvg = new List <int>();
            resultAvg.Add(rpt3.C1.GetValueOrDefault());
            resultAvg.Add(rpt3.C2.GetValueOrDefault());
            resultAvg.Add(rpt3.C3.GetValueOrDefault());
            resultAvg.Add(rpt3.C4.GetValueOrDefault());
            resultAvg.Add(rpt3.C5.GetValueOrDefault());
            resultAvg.Add(rpt3.C6.GetValueOrDefault());
            resultAvg.Add(rpt3.C7.GetValueOrDefault());
            resultAvg.Add(rpt3.C8.GetValueOrDefault());
            resultAvg.Add(rpt3.C9.GetValueOrDefault());
            resultAvg.Add(rpt3.C10.GetValueOrDefault());
            resultAvg.Add(rpt3.C11.GetValueOrDefault());
            resultAvg.Add(rpt3.C12.GetValueOrDefault());
            resultAvg.Add(rpt3.C13.GetValueOrDefault());
            resultAvg.Add(rpt3.C14.GetValueOrDefault());
            resultAvg.Add(rpt3.C15.GetValueOrDefault());
            resultAvg.Add(rpt3.C16.GetValueOrDefault());
            resultAvg.Add(rpt3.C17.GetValueOrDefault());
            resultAvg.Add(rpt3.C18.GetValueOrDefault());
            resultAvg.Add(rpt3.C19.GetValueOrDefault());
            resultAvg.Add(rpt3.C20.GetValueOrDefault());
            resultAvg.Add(rpt3.C21.GetValueOrDefault());
            resultAvg.Add(rpt3.C22.GetValueOrDefault());
            resultAvg.Add(rpt3.C23.GetValueOrDefault());
            resultAvg.Add(rpt3.C24.GetValueOrDefault());
            resultAvg.Reverse();
            s3.Data = resultAvg;
            hc.series.Add(s3);
            #endregion

            return(hc);
        }
Ejemplo n.º 54
0
 Dictionary <string, object> ISerieRepository.RetornaDictionaryDeSerie(Serie serie)
 {
     throw new NotImplementedException();
 }
 public void Debug_RemoveSerie(Serie a_serie)
 {
     m_series.RemoveAll(sd => sd.Title == a_serie.Title);
 }
Ejemplo n.º 56
0
 public void InsertSerie(Serie serie)
 {
     context.Series.Add(serie);
 }
        public void Debug_RenameSerie(Serie a_serie)
        {
            SerieData serie_data = m_series.First(sd => sd.Title == a_serie.Title);

            serie_data.Title += " " + m_random.Next();
        }
        public void Debug_ChangeSerieURL(Serie a_serie)
        {
            SerieData serie_data = m_series.First(sd => sd.Title == a_serie.Title);

            serie_data.URL += " " + m_random.Next();
        }
        public List<Serie> Consultar(Serie serie, TipoPesquisa tipoPesquisa)
        {
            List<Serie> resultado = Consultar();

            switch (tipoPesquisa)
            {
                #region Case E
                case TipoPesquisa.E:
                    {
                        if (serie.ID != 0)
                        {

                            resultado = ((from s in resultado
                                          where
                                          s.ID == serie.ID
                                          select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(serie.Nome))
                        {

                            resultado = ((from s in resultado
                                          where
                                          s.Nome.Contains(serie.Nome)
                                          select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (serie.Status.HasValue)
                        {

                            resultado = ((from s in resultado
                                          where
                                          s.Status.HasValue && s.Status.Value == serie.Status.Value
                                          select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                #region Case Ou
                case TipoPesquisa.Ou:
                    {
                        if (serie.ID != 0)
                        {

                            resultado.AddRange((from s in Consultar()
                                                where
                                                s.ID == serie.ID
                                                select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (!string.IsNullOrEmpty(serie.Nome))
                        {

                            resultado.AddRange((from s in Consultar()
                                                where
                                                s.Nome.Contains(serie.Nome)
                                                select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        if (serie.Status.HasValue)
                        {

                            resultado.AddRange((from s in Consultar()
                                                where
                                                s.Status.HasValue && s.Status.Value == serie.Status.Value
                                                select s).ToList());

                            resultado = resultado.Distinct().ToList();
                        }

                        break;
                    }
                #endregion
                default:
                    break;
            }

            return resultado;
        }
Ejemplo n.º 60
0
        public Chart IOs_Months(long ThingID, long EndPointTypeID, long Year)
        {
            EndPointType endType = repoEndpointTypes.Find(EndPointTypeID);
            Thing        th      = repoThings.Find(ThingID);
            Chart        hc      = new Chart("HC_" + "Thing" + ThingID + "EndPointType" + EndPointTypeID + "Inputs");

            hc.title.Text    = "Last 12 Months";
            hc.subTitle.Text = th.Title + " - " + endType.Title;
            hc.xAxis.GenerateMonthsList();
            hc.legend.layout = Layout.vertical.ToString();

            List <Rpt_ThingEnd_IOs_Months_Result> rpt = db.Rpt_ThingEnd_IOs_Months(ThingID, EndPointTypeID, Year).ToList();

            #region GetMin
            Serie s1 = new Serie();
            s1.Name = "Min";
            Rpt_ThingEnd_IOs_Months_Result rpt1 = rpt[0];
            List <int> resultMin = new List <int>();
            resultMin.Add(rpt1.C1.GetValueOrDefault());
            resultMin.Add(rpt1.C2.GetValueOrDefault());
            resultMin.Add(rpt1.C3.GetValueOrDefault());
            resultMin.Add(rpt1.C4.GetValueOrDefault());
            resultMin.Add(rpt1.C5.GetValueOrDefault());
            resultMin.Add(rpt1.C6.GetValueOrDefault());
            resultMin.Add(rpt1.C7.GetValueOrDefault());
            resultMin.Add(rpt1.C8.GetValueOrDefault());
            resultMin.Add(rpt1.C9.GetValueOrDefault());
            resultMin.Add(rpt1.C10.GetValueOrDefault());
            resultMin.Add(rpt1.C11.GetValueOrDefault());
            resultMin.Add(rpt1.C12.GetValueOrDefault());
            s1.Data = resultMin;
            hc.series.Add(s1);
            #endregion

            #region GetMax
            Serie s2 = new Serie();
            s2.Name = "Max";
            Rpt_ThingEnd_IOs_Months_Result rpt2 = rpt[1];
            List <int> resultMax = new List <int>();
            resultMax.Add(rpt2.C1.GetValueOrDefault());
            resultMax.Add(rpt2.C2.GetValueOrDefault());
            resultMax.Add(rpt2.C3.GetValueOrDefault());
            resultMax.Add(rpt2.C4.GetValueOrDefault());
            resultMax.Add(rpt2.C5.GetValueOrDefault());
            resultMax.Add(rpt2.C6.GetValueOrDefault());
            resultMax.Add(rpt2.C7.GetValueOrDefault());
            resultMax.Add(rpt2.C8.GetValueOrDefault());
            resultMax.Add(rpt2.C9.GetValueOrDefault());
            resultMax.Add(rpt2.C10.GetValueOrDefault());
            resultMax.Add(rpt2.C11.GetValueOrDefault());
            resultMax.Add(rpt2.C12.GetValueOrDefault());
            s2.Data = resultMax;
            hc.series.Add(s2);
            #endregion

            #region GetAvg
            Serie s3 = new Serie();
            s3.Name = "Avg";
            Rpt_ThingEnd_IOs_Months_Result rpt3 = rpt[2];
            List <int> resultAvg = new List <int>();
            resultAvg.Add(rpt3.C1.GetValueOrDefault());
            resultAvg.Add(rpt3.C2.GetValueOrDefault());
            resultAvg.Add(rpt3.C3.GetValueOrDefault());
            resultAvg.Add(rpt3.C4.GetValueOrDefault());
            resultAvg.Add(rpt3.C5.GetValueOrDefault());
            resultAvg.Add(rpt3.C6.GetValueOrDefault());
            resultAvg.Add(rpt3.C7.GetValueOrDefault());
            resultAvg.Add(rpt3.C8.GetValueOrDefault());
            resultAvg.Add(rpt3.C9.GetValueOrDefault());
            resultAvg.Add(rpt3.C10.GetValueOrDefault());
            resultAvg.Add(rpt3.C11.GetValueOrDefault());
            resultAvg.Add(rpt3.C12.GetValueOrDefault());
            s3.Data = resultAvg;
            hc.series.Add(s3);
            #endregion

            return(hc);
        }