Giter Site home page Giter Site logo

citiesskylinesmods / duplicateassemblyscanner Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 92 KB

Scans for duplicate app domain assemblies and, if found, logs them and also lists in its mod options screen.

Home Page: https://steamcommunity.com/sharedfiles/filedetails/?id=2013398705

License: MIT License

C# 100.00%
cities-skylines cities-skylines-game csharp unity

duplicateassemblyscanner's People

Contributors

originalfoo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

duplicateassemblyscanner's Issues

Scan mod folder if PluginInfo doesn't mention assembly

This is primarily for detection of Harmony assemblies that didn't get loaded (not sure how that works, but guessing it's due to assembly Guid, asembly version and assembly file version all matching).

The PluginInfo.GetAssemblies() only lists assemblies that were loaded in to the app domain.

If the assembly we're looking for isn't listed in there, we should scan the mod folder as a fallback check to see if mod still contains the assembly.

This should only be done for 0Harmony assemblies (at least initially) as that is of key importance to detecting mods that use Harmony.

Update .editorconfig and rulesets based on feedback

Dymanoid mentioned following in PR #16:

  • The .NET naming convention suggests using PascalCase for constants.
  • The .NET naming convention suggests either PascalCase or camelCase for static fields. The underscore should be used as a prefix for _instanceFields.

These things should be configured in the .editorconfig and/or ruleset.

Tidy up logging

There's no need for log level or timings. Log could be much cleaner.

Struct for assembly info

Could do with more structured approach for info relating to an assembly:

Mod details:

  • path
  • name
  • enabled

Assembly details:

  • name
  • loaded
  • version - only if loaded
  • guid - only if loaded
  • md5

Tracking mods with harmony

Subscribe and enable Duplicate Assembly Scanner mod then look in Cities_Data folder for the DuplicateAssemblyScanner.log to get the details. Post details in a comment below and update the list in OP to include your results.

(Note: One of these 1.0.9.1 `0Harmony` is not the same as the other!)
- 1.0.9.1 /1386697922   Garbage Bin Controller
- 1.0.9.1 /1372431101   Painter

- 1.1.0.0 /870291141    Random Train Trailers 2.1.2
- 1.1.0.0 /1412844620   Realistic Walking Speed

- 1.2.0.1 /1567569285   Achieve It!
- 1.2.0.1 /1886877404   Custom Effect Loader
- 1.2.0.1 /1806759255   Customize It! Extended
- 1.2.0.1 /1658679290   Forest Brush
- 1.2.0.1 /1591417160   Hide It!
- 1.2.0.1 /1938493221   Mini FPS Booster 1.0
- 1.2.0.1 /1801953480   Natural Disasters Overhaul
- 1.2.0.1 /552309905    No Abandonment
- 1.2.0.1 /1721492498   Optimised Outside Connections
- 1.2.0.1 /924884948    Plop Growables
- 1.2.0.1 /1869561285   Prop Painter
- 1.2.0.1 /1420955187   Real Time
- 1.2.0.1 /576997275    Remove Need For Pipes
- 1.2.0.1 /1794015399   Render It!
- 1.2.0.1 /1435741602   Snooper
- 1.2.0.1 /1899640536   Theme Mixer 2
- 1.2.0.1 /1764637396   Toggle It!
- 1.2.0.1 /1312767991   Transport Lines Manager 13.1
- 1.2.0.1 /1680642819   Ultimate Level Of Detail
- 1.2.0.1 /877950833    Vanilla Trees Remover

- 1.2.0.2 /1562650024   Rebalanced Industries

- 2.0.0.0 /1758376843   Network Skins 2 Beta
- 2.0.0.0 /1934023593   RM Crossings V2.5

Work out why TM:PE harmony isn't being detected...

I have local build of TM:PE v11 which uses Harmony, but it's not getting logged:

[Info]  DuplicateAssemblyScanner v1.1.0.40729
[Info]  Enabled
[Info]  SettingsUI
[Info]  Scanning app domain assemblies for duplicates... [*] = Mod enabled, [>] = Assembly loaded in RAM
[Info]  0Harmony found in:
[Info]  *   1.0.9.1 812905134bf7bd868428280d601ac573 /1372431101   Painter
[Info]  * > 1.0.9.1 812905134bf7bd868428280d601ac573 /1386697922   Garbage Bin Controller
[Info]    > 1.1.0.0 9b81c76b538fc2217f8df27d4d76685f /1412844620   Realistic Walking Speed
[Info]      1.1.0.0 c0d7618949db5ae9bb0a6dda04b82769 /870291141    Random Train Trailers 2.1.2
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1420955187   Real Time
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1435741602   Snooper
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1567569285   Achieve It!
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1591417160   Hide It!
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1658679290   Forest Brush
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1680642819   Ultimate Level Of Detail
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1721492498   Optimised Outside Connections
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1764637396   Toggle It!
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1794015399   Render It!
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1801953480   Natural Disasters Overhaul
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1806759255   Customize It! Extended
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1869561285   Prop Painter
[Info]  * > 1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1886877404   Custom Effect Loader
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1899640536   Theme Mixer 2
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /1938493221   Mini FPS Booster 1.0
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /552309905    No Abandonment
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /877950833    Vanilla Trees Remover
[Info]  *   1.2.0.1 09cb0a9d9724f2965a4b73bb590e9a57 /924884948    Plop Growables
[Info]  * > 1.2.0.2 67ecabf6c52feeb90f33cf501f723f01 /1562650024   Rebalanced Industries
[Info]  * > 2.0.0.0 616b7f80b28b7e80050998e4473d4c31 /1758376843   Network Skins 2 Beta
[Info]  Disabled

Show detailed results in settings screen

Currently the settings screen just lists versions of assemblies, but it would be better to show the detailed stuff that goes in log file - particularly so mod devs can just do a quick visual check from game settings screen.

screenshot

just using this to host an image for readme

image

Log Guid and/or MD5 hash of assemblies

It's possible that assemblies report the same version but are in fact different (eg. tweaked code) - see: #8 (comment)

In the log file, we should at least log some additional detail that helps track down assemblies with same version but different code.

Split mod scanner (and eventual folder scanner) to separate classes

The following scans will exist:

  • App domain scan for duplicate assemblies #10
  • Plugin manager > Plugin info scan for loaded assemblies per mod #11
    • Folder scan to check for unloaded assemblies (if 0Harmony) #9
    • File scan to get MD5 (and possibly Guid, Version?) #12

Those are distinct and would merit being in 3 classes:

  • Assemblies
  • Mods
  • Folders
  • Files

Log file should state total occurences of assembly

This issue arises when doing hot-reloads:

    Asm Version  MD5 Hash                         /Mod Folder   'DuplicateAssemblyScanner' is in:
---------------------------------------------------------------------------------------------------------
* > 1.2.0.3581   6602b0d531522b210eab605aa4ff275f /DuplicateAssemblyScanner DAS v1.2.0

Above, the log file makes it look like there's only one duplicate.

The settings screen tells more accurate story:

image

Logging will be moved to Settings.cs and will output header or footer listing total number of occurrences.

Cache assembly scan results

The intial dictionary of assembly names -> versions should be cached rather than rebuilt each time the OnSettingsUI() is called.

Readonly checkboxes

Currently they can be unchecked which might give users the impression that they can turn off duplicates.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.