Ejemplo n.º 1
0
        string GetNameChangedDesc(Item missing)
        {
            List <Package> packages = CustomDeserializer.instance.GetPackages(missing.packageName);

            Package.Asset asset = packages.Count == 1 ? AssetLoader.FindMainAssetRef(packages[0]) : null;
            string        have  = asset != null?Ref(asset.package.packageName, AssetLoader.ShortName(asset.name)) : Ref(missing.packageName);

            return(string.Concat("You have ", have, " but it does not contain ", Enc(missing.name),
                                 @".<br>Name probably <a target=""_blank"" href=""http://steamcommunity.com/workshop/filedetails/discussion/667342976/141136086940263481/"">changed</a> by the asset author."));
        }
Ejemplo n.º 2
0
        internal void Save(int textures, int materials, int meshes)
        {
            try
            {
                texturesShared = textures; materialsShared = materials; meshesShared = meshes;
                string cityName = AssetLoader.ShortName(LevelLoader.instance.cityName);

                foreach (char c in forbidden)
                {
                    cityName = cityName.Replace(c, 'x');
                }

                filepath = Util.GetFileName(cityName + " - AssetsReport", "htm");
                Util.DebugPrint("Saving report to", filepath);
                int t0 = Profiling.Millis;
                w = new StreamWriter(filepath);
                w.WriteLine(@"<!DOCTYPE html><html lang=""en""><head><meta charset=""UTF-8""><title>Assets Report</title><style>");
                w.WriteLine(@"* {font-family:sans-serif;}");
                w.WriteLine(@"body {background-color:#f9f6ea;}");
                w.WriteLine(@"div {margin:5px 1px 1px 18px;}");
                w.WriteLine(@".my {display:-webkit-flex;display:flex;}");
                w.WriteLine(@".my .mi {margin:10px 0px 0px 0px;min-width:29%;}");
                w.WriteLine(@".my .bx {line-height:125%;padding:8px 12px;background-color:#e8e5d4;border-radius:5px;margin:1px;min-width:56%;}");
                w.WriteLine(@".my .st {font-style:italic;margin:0px;min-width:29%;}");
                w.WriteLine(@"h1 {margin-top:10px;padding:24px 18px;background-color:#e8e5d4;}");
                w.WriteLine(@"h2 {margin-top:40px;border-bottom:1px solid black;}");
                w.WriteLine(@"h3 {margin-top:25px;margin-left:18px;}");
                w.WriteLine(@"a:link {color:#0000e0;text-decoration:inherit;}");
                w.WriteLine(@"a:visited {color:#0000b0;text-decoration:inherit;}");
                w.WriteLine(@"a:hover {text-decoration:underline;}");
                w.WriteLine(@"</style></head><body>");

                H1(Enc(cityName));
                Italics(@"Assets report for Cities: Skylines.");
                Italics(@"To stop saving these files, disable the option ""Save assets report"" in Loading Screen Mod.");
                string[] mainHeadings = allHeadings.Take(6).ToArray();
                CustomAssetMetaData.Type[] mainTypes = allTypes.Take(6).ToArray();

                H2("Assets that failed to load");
                Item[] failed = assets.Values.Which(FAILED).ToArray();

                if (failed.Length > 0)
                {
                    Report(failed, mainHeadings, mainTypes);
                    Array.Clear(failed, 0, failed.Length); failed = null;
                }
                else
                {
                    Italics("No failed assets.");
                }

                H2("Assets that are missing");

                if (Settings.settings.loadUsed)
                {
                    SetIndirectUsages();
                    Item[] missing = assets.Values.Which(MISSING).ToArray();
                    SetNameChanges(missing);

                    if (missing.Length > 0)
                    {
                        Italics("There are two reasons for an asset to appear in this section: (1) The asset is placed in the city but is missing (2) The asset is used by some other asset but is missing.");
                        ReportMissing(missing, GetUsedBy(), allHeadings, allTypes, USEDDIR, USEDDIR, USEDDIR, USEDDIR, USEDDIR, USEDDIR, 0);
                        Array.Clear(missing, 0, missing.Length); missing = null;
                    }
                    else
                    {
                        Italics("No missing assets.");
                    }
                }
                else
                {
                    Italics("To track missing assets" + enableOption);
                }

                H2("Duplicate asset names");
                ReportDuplicates();

                H2("The following custom assets are used in this city");

                if (Settings.settings.loadUsed)
                {
                    Item[] used = assets.Values.Which(USED).ToArray();

                    if (used.Length > 0)
                    {
                        Report(used, allHeadings, allTypes, USEDDIR, USEDDIR, USEDDIR, USEDDIR, USEDDIR, USEDDIR, USEDIND);
                        Array.Clear(used, 0, used.Length); used = null;
                    }
                    else
                    {
                        Italics("No used assets.");
                    }

                    H2("The following enabled assets are currently unnecessary (not used in this city)");
                    Item[] unnecessary = assets.Values.Where(item => item.Enabled && !item.Used && !AssetLoader.instance.IsIntersection(item.FullName)).ToArray();

                    if (unnecessary.Length > 0)
                    {
                        Italics("There are two reasons for an asset to appear in this section: (1) The asset is enabled but unnecessary (2) The asset is included in an enabled district style but is unnecessary.");
                        Report(unnecessary, mainHeadings, mainTypes);
                        Array.Clear(unnecessary, 0, unnecessary.Length); unnecessary = null;
                    }
                    else
                    {
                        Italics("No unnecesary assets.");
                    }
                }
                else
                {
                    Italics("To track used assets" + enableOption);
                }

                Util.DebugPrint("Report created in", Profiling.Millis - t0);
                //PrintAssets();
            }
            catch (Exception e)
            {
                UnityEngine.Debug.LogException(e);
            }
            finally
            {
                w?.Dispose();
                w = null;
                assets.Clear(); duplicates.Clear();
                assets = null; duplicates = null;
            }
        }