(Unity) Unity Custom Debug Log file, use vs Generate DLL file and use dotfuscated progress to confuse, avoid being deserialized

Source: Internet
Author: User
Tags reflector

Unity customizes debug log files, uses vs to generate DLL files and uses dotfuscated to confuse and avoid being deserialized.

1. Open VS, the blogger version is Visual Studio 2013.

2, a new VC project, select Class Library, named Jefferychan, specific steps such as:

3. In order to invoke the relevant files in unity, the external files are introduced here. First find UnityEngine.dll in the installation folder of Unity, my path is: D:\Program Files (x86) \unity\editor\data\managed
As shown in the following:

4, the introduction of UnityEngine.dll into the project, such as:
Open the project and open the VS View--Solution Manager

5. Under the project file, click the right mouse button, reference, add reference, introduce an external file, as shown in:

6, edit the C # class files that need to be compiled, the blogger here is a custom log output file, the specific code is as follows:

Using system.collections;using unityengine;/** * * Create a new namespace to hold some common methods of your own definition * * **/namespace jefferychan{/** * * Create a new Jefferylog class for output debug log * **/PublicClassJefferylog {Defines a flag to control whether the log is outputStaticpublic bool Enablelog =True/** * Print the log but not the component that corresponds to the print log * **/StaticPublicvoidLog (object message) {log (message,NULL); }/** * Print the log and display the corresponding component of the print log * **/StaticPublicvoidLog (Object message, object context) {if (Enablelog) {Message for printed information, context for printing information corresponding to the component Debug.Log (message, context); } }/** * Print error log but does not deliver the component corresponding to the print log * **/StaticPublicvoidLogError (Object message) {LogError (message,NULL); }/** * Print error log and display the corresponding component of the print log * **/static public void LogError (Object message, Object context) { if (enablelog) {debug.logerror (message , context); }} /** * Print warning log but do not print out specific warning contents * **/ static public void logwarning (object message) {logwarning (Messa GE, null); /** * Print warning log and print out warning contents * **/ static public  void logwarning (Object message, Object context) {
                                                  
                                                   if (Enablelog) {debug.logwarning (message, context);}} }}
                                                  

7. Compile the project and generate the DLL file as shown in:

8. Locate the generated DLL file, the file path is: "Project path"->bin->debug->jefferychan.dll, as shown in:

9, the DLL file at this time opened with reflector, found that the anti-compiled code and the original code is almost the same as shown in:

10. Use dotfuscated to confuse the generated JefferyChan.dll file, as shown in:

Click the Generate button to confuse.

11. Once again decompile the obfuscated code and find that it is not possible to decompile, as shown in:

Dotfuscated is the VS self-contained, it exists in the VS installation directory: D:\Program Files (x86) \microsoft Visual Studio 12.0\preemptive Solutions\dotfuscator and Analytics Community Edition

As shown in the following:

Note:
Change the project properties, application-and target framework: to. NET Framework 3.5 or below. This step is important because the. Net supported by Unity3d (the current version of Unity3d is 3.5) is version 3.5.

If you select the version 4.0 appears

Internal compiler error. See the console log for more information. Output was:unhandled Exception:System.TypeLoadException:Could not load type ' System.Runtime.Versioning.

As shown in the following:

Reflector DOWNLOAD Link: http://pan.baidu.com/s/1o6KH9xw.

(Unity) Unity Custom Debug Log file, use vs Generate DLL file and use dotfuscated progress to confuse, avoid being deserialized

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.