Пример #1
0
        static string buildLogoImage(List <string> logosForBuilding, bool firstOnly, int imgWidth, int imgHeight)
        {
            try
            {
                if (logosForBuilding.Count == 1 || (firstOnly && logosForBuilding.Count > 0))
                {
                    return(logosForBuilding[0]);
                }
                else if (logosForBuilding.Count > 1)
                {
                    tmpFile = string.Empty;
                    foreach (string logo in logosForBuilding)
                    {
                        tmpFile += System.IO.Path.GetFileNameWithoutExtension(logo);
                    }
                    tmpFile = Helper.PathCombine(pathfortmpfile, "TVSeriesDynLogo" + tmpFile + ".png");

                    Bitmap   b   = new Bitmap(imgWidth, imgHeight);
                    Image    img = b;
                    Graphics g   = Graphics.FromImage(img);
                    appendLogos(logosForBuilding, ref g, imgHeight, imgWidth);
                    if (Settings.isConfig)
                    {
                        b.Save(tmpFile);
                        return(tmpFile);
                    }
                    else
                    {
                        return(ImageAllocator.GetOtherImage(b, tmpFile, new Size(), true)); // don't resize in allocator
                    }
                }
                else
                {
                    return(string.Empty);
                }
            }
            catch (Exception ex)
            {
                MPTVSeriesLog.Write("The Logo Building Engine generated an error: " + ex.Message);
                return(string.Empty);
            }
        }
Пример #2
0
        static string getLogos(Level level, int imgHeight, int imgWidth, bool firstOnly, ref List <string> logosForBuilding)
        {
            string res = work(level, imgHeight, imgWidth, firstOnly, ref logosForBuilding);

            if (!Settings.isConfig && res != null && res.Length > 0 && res[0] != '[')
            {
                if (tmpEp != null && tmpEp.Image == res)
                {
                    return(ImageAllocator.GetOtherImage(res, new Size(), false)); // don't resize by allocator
                }
                else
                {
                    return(ImageAllocator.GetOtherImage(res, new Size(), true)); // don't resize by allocator
                }
            }
            else
            {
                return(res); // we build the memimage already
            }
        }