Exemple #1
0
        public override string GetExpr(ImageItem item)
        {
            var opts = base.GetExpr(item);

            //////////////////////////////////
            // Background Stripe (goes at the very front because sometimes the foreground spreads on to it)
            if (item.SizeType != SizeType.Small)
            {
                opts += ";" + CompositedLayer.MakeString(
                    pathToStripe,
                    item.FinalDimensions.Width - 3,
                    0,
                    null,
                    Size.Empty
                    );
            }

            return(opts);
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            // Res2.csv contains all the information required:
            // PE filename
            // Foreground image: point and filesystem location
            // Dimensions of the completed image

            //RunOnceProgram.RunOnceMain(args);
            //OneOffGen.OneOffMain(args);
            //return;

            var items = new List <ImageItem>();

            using (var rdr = new StreamReader(_generatorMetaRoot + "Res2.csv"))
            {
                string line;
                while ((line = rdr.ReadLine()) != null)
                {
                    var fields = line.Split(',');

                    var item = new ImageItem();
                    item.PEPath              = fields[0];
                    item.ResName             = fields[1];
                    item.SizeType            = GetSize(fields[2]);
                    item.FinalDimensions     = new Size(int.Parse(fields[3]), int.Parse(fields[4]));
                    item.ForegroundImagePath = "Generator\\" + fields[5];
                    item.ForegroundCoords    = new Point(int.Parse(fields[6]), int.Parse(fields[7]));

                    items.Add(item);
                }
            }
            //////////////////////////////////////////////////

            ColorGenerator[] gens =
            {
                new MceColorGenerator(),  new MceBlackColorGenerator(), new ElementColorGenerator(),
                new BlueColorGenerator(), new EnergyColorGenerator()
            };

            foreach (var gen in gens)
            {
                using (var wtr = new StreamWriter(_generatorMetaRoot + gen.GetType().Name + ".txt", false))
                {
                    string lastPE = null;

                    foreach (var item in items)
                    {
                        if (item.PEPath != lastPE)
                        {
                            wtr.WriteLine("\t\t\t</patch>");
                            wtr.WriteLine("\t\t\t<patch path=\"" + item.PEPath + "\">");
                        }

                        wtr.WriteLine(
                            "\t\t\t\t<res type=\"bitmap\" name=\"" + item.ResName + "\" src=\"" + gen.GetExpr(item)
                            + "\" />"
                            );

                        lastPE = item.PEPath;
                    }
                }
            }
        }
Exemple #3
0
        public static void RunOnceMain(String[] args)
        {
            // This program generates a new Res.csv based on the old Res.csv and bitmap info

            DirectoryInfo preGenPath = new DirectoryInfo(@"D:\Users\David\My Documents\Visual Studio Projects\Anolis\_resources\xpize\_source\Pre-Generator Bitmaps\MCE\");

            List <ImageItem> images = new List <ImageItem>();

            using (StreamReader rdr = new StreamReader(@"D:\Users\David\My Documents\Visual Studio Projects\Anolis\_resources\xpize\_source\Generator\Res.csv")) {
                String line;
                while ((line = rdr.ReadLine()) != null)
                {
                    if (line.StartsWith("#"))
                    {
                        continue;
                    }

                    String[] fields = line.Split(',');

                    ImageItem img = new ImageItem();
                    img.PEPath   = fields[0];
                    img.ResName  = fields[1];
                    img.SizeType = Program.GetSize(fields[2]);

                    if (fields[3].Length > 0)
                    {
                        img.ForegroundImagePath = fields[3] + ".png";
                    }
                    else
                    {
                        img.ForegroundImagePath = Path.Combine(img.PEPath, img.ResName) + ".png";
                    }

                    img.ForegroundCoords = new Point(Int32.Parse(fields[4]), Int32.Parse(fields[5]));

                    // now load the actual Bitmap from the pre-Generator directory

                    String pathToOriginalBmp = Path.Combine(Path.Combine(preGenPath.FullName, img.PEPath), img.ResName) + ".bmp";
                    using (Bitmap orig = Bitmap.FromFile(pathToOriginalBmp) as Bitmap) {
                        img.FinalDimensions = orig.Size;
                    }

                    images.Add(img);
                }
            }

            /////////////////////////////////////////////////////////////////////////

            using (StreamWriter wtr = new StreamWriter(@"D:\Users\David\My Documents\Visual Studio Projects\Anolis\_resources\xpize\_source\Generator\Res2.csv", false)) {
                foreach (ImageItem item in images)
                {
                    String line =
                        item.PEPath + "," +
                        item.ResName + "," +
                        item.SizeType.ToString() + "," +
                        item.FinalDimensions.Width + "," +
                        item.FinalDimensions.Height + "," +
                        item.ForegroundImagePath + "," +
                        item.ForegroundCoords.X + "," +
                        item.ForegroundCoords.Y;

                    wtr.WriteLine(line);

                    Console.WriteLine(line);
                }
            }
        }