Beispiel #1
0
        void AddLot(string outPath, string hood, string hoodName, StreamWriter w, Ltxt ltxt)
        {
            if (dt.Equals(new DateTime(0)) || wasUnk || dt.AddMilliseconds(200).CompareTo(DateTime.UtcNow) < 0)
            {
                dt     = new DateTime(DateTime.UtcNow.Ticks);
                wasUnk = false;
                splash("Saving " + ltxt.LotName.Trim());
            }
            w.WriteLine(hood +
                        "," + q(hoodName) +
                        "," + ltxt.FileDescriptor.Instance +
                        "," + (ltxt.LotDescription == null ? "," : ltxt.LotDescription.Instance + "," + q(ltxt.LotDescription.LotName)) +
                        ""
                        );

            if (ltxt.LotDescription != null)
            {
                AddImage(ltxt.LotDescription.Image, Path.Combine(Path.Combine(outPath, "LotImage"), hood + "_" + ltxt.FileDescriptor.Instance + ".png"));
            }
        }
Beispiel #2
0
        void AddHood(string outPath, string dir, StreamWriter w1, StreamWriter w2)
        {
            string hood     = Path.GetFileName(dir);
            string hoodFile = Path.Combine(dir, hood + "_Neighborhood.package");

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

            SimPe.Packages.File pkg = SimPe.Packages.File.LoadFromFile(hoodFile);
            if (pkg == null)
            {
                return;
            }

            string hoodName = Localization.GetString("Unknown");

            IPackedFileDescriptor[] pfds = pkg.FindFiles(SimPe.Data.MetaData.CTSS_FILE);
            StrWrapper ctss = null;

            if (pfds.Length == 1)
            {
                ctss = new StrWrapper();
                ctss.ProcessData(pfds[0], pkg);
                hoodName = ctss[1, 0];
            }


            if (!Directory.Exists(Path.Combine(outPath, "SimImage")))
            {
                Directory.CreateDirectory(Path.Combine(outPath, "SimImage"));
            }

            System.Windows.Forms.Application.DoEvents();
            splash("Loading Neighborhood " + hood + ": " + hoodName);
            SetProvider(pkg);

            dt     = new DateTime(0);
            wasUnk = true;
            pfds   = pkg.FindFiles(SimPe.Data.MetaData.SIM_DESCRIPTION_FILE);
            foreach (IPackedFileDescriptor spfd in pfds)
            {
                ExtSDesc sdsc = new ExtSDesc();
                sdsc.ProcessData(spfd, pkg);

                AddSim(outPath, hood, hoodName, w1, sdsc);
            }


            if (!Directory.Exists(Path.Combine(outPath, "LotImage")))
            {
                Directory.CreateDirectory(Path.Combine(outPath, "LotImage"));
            }

            System.Windows.Forms.Application.DoEvents();
            splash("Loading Neighborhood " + hood + ": " + hoodName);
            SetProvider(pkg);

            dt     = new DateTime(0);
            wasUnk = true;
            pfds   = pkg.FindFiles(SimPe.Plugin.Ltxt.Ltxttype);
            foreach (IPackedFileDescriptor spfd in pfds)
            {
                Ltxt ltxt = new Ltxt();
                ltxt.ProcessData(spfd, pkg);

                AddLot(outPath, hood, hoodName, w2, ltxt);
            }
        }