Obfuscate() public method

public Obfuscate ( float opacity ) : void
opacity float
return void
示例#1
0
    public void ShowWin(string name, string animalName)
    {
        obfuscator.Obfuscate(0.6f);
        SpriteRenderer spriteRenderer = matchimal.GetComponent <SpriteRenderer>();

        spriteRenderer.sprite = Resources.Load <Sprite>("Animals/" + animalName);
        TextMesh textMesh = nameText.GetComponent <TextMesh>();

        textMesh.text = name + " won!";
        Invoke("ShowWinComponents", 1.1f);
    }
示例#2
0
        private static void ObfuscateWhileLocked()
        {
            if (_options == null)
            {
                _options = OptionsManager.LoadOptions();
            }
            Obfuscator.FixHexBug(_options);

            if (ShouldObfuscate() == false)
            {
                return;
            }

            AssemblySelector selector = new AssemblySelector(_options);

            ICollection <string> compiledDlls = selector.GetCompiledAssemblyPaths();

            BackupDlls(compiledDlls);
            ICollection <string> dlls = selector.GetAssemblyPaths();

            if (dlls.Count == 0 && compiledDlls.Count == 0)
            {
                _noCSharpScripts = true;
            }
            else
            {
                HashSet <string> extraAssemblyReferenceDirectories = new HashSet <string>(_options.extraAssemblyDirectories);

#if UNITY_2017_3_OR_NEWER
                extraAssemblyReferenceDirectories.UnionWith(AssemblyReferenceLocator.GetAssemblyReferenceDirectories());
#endif

                Obfuscator.SetExtraAssemblyDirectories(extraAssemblyReferenceDirectories.ToArray());

#if UNITY_2018_2_OR_NEWER
                if (_options.obfuscateMonoBehaviourClassNames)
                {
                    Debug.LogError(
                        "The mechanism to obfuscate MonoBehaviour class names no longer works since Unity " +
                        "2018.2. You must either roll back to 2018.1, or disable this option.\n" +
                        "\nThis build will be obfuscated as instructed, but you are likely to see " +
                        "NullReferenceException runtime errors.\n");
                }
#endif

                Obfuscator.Obfuscate(dlls, compiledDlls, _options, EditorUserBuildSettings.activeBuildTarget);

                if (_options.obfuscateMonoBehaviourClassNames)
                {
                    /*
                     * RestoreAssets must be called via the update delegate because [PostProcessBuild] is not guaranteed to be called
                     */
                    EditorApplication.update         += RestoreAssets;
                    _monoBehaviourAssetsNeedReverting = true;
                }

                _obfuscatedAfterScene = true;
            }
        }
示例#3
0
        public static void Obfuscate()
        {
            if (!EditorApplication.isPlayingOrWillChangePlaymode && !obfuscatedAfterScene)
            {
                try
                {
                    EditorApplication.LockReloadAssemblies();

                    HashSet <string> dlls = new HashSet <string>();

                    foreach (string assemblyName in Config.permanentDLLs)
                    {
                        dlls.Add(FindDllLocation(assemblyName));
                    }
                    backupDlls(dlls);

                    foreach (string assemblyName in Config.temporaryDLLs)
                    {
                        dlls.Add(FindDllLocation(assemblyName));
                    }

                    if (dlls.Count == 0)
                    {
                        noCSharpScripts = true;
                    }
                    else
                    {
                        if (options == null)
                        {
                            options = OptionsManager.LoadOptions();
                        }

                        Obfuscator.FixHexBug(options);

                        if (options.enabled)
                        {
                            Obfuscator.SetExtraAssemblyDirectories(Config.extraAssemblyDirectories);
                            Obfuscator.Obfuscate(dlls, options, EditorUserBuildSettings.activeBuildTarget);

                            if (options.obfuscateMonoBehaviourClassNames)
                            {
                                /*
                                 * RestoreAssets must be called via the update delegate because [PostProcessBuild] is not guaranteed to be called
                                 */
                                EditorApplication.update        += RestoreAssets;
                                monoBehaviourAssetsNeedReverting = true;
                            }
                        }
                        obfuscatedAfterScene = true;
                    }
                }
                finally
                {
                    EditorApplication.UnlockReloadAssemblies();
                }
            }
        }
示例#4
0
文件: Client.cs 项目: Ben-Eid/CNS
 //send messages to the server
 public void Send(string data)
 {
     if (!socketReady)
     {
         return;
     }
     writer.WriteLine(Obfuscator.Obfuscate(data));
     writer.Flush();
 }
示例#5
0
 private byte[] GetDecryptedBytes()
 {
     if (settings.encryptionType == ES2Settings.EncryptionType.AES128)        // AES 128-bit encryption
     {
         AESEncryptor aesEncryptor = new AESEncryptor(settings.encryptionPassword, MoodkieSecurity.AESBits.BITS128);
         return(aesEncryptor.Decrypt(reader.ReadBytes(reader.ReadInt32())));
     }
     else         // XOR Obfuscation
     {
         return(Obfuscator.Obfuscate(reader.ReadBytes(reader.ReadInt32()), settings.encryptionPassword));
     }
 }
示例#6
0
 public byte[] GetEncryptedBytes(string password)
 {
     if (settings.encryptionType == ES2Settings.EncryptionType.AES128)        // AES 128-bit encryption
     {
         AESEncryptor aesEncryptor = new AESEncryptor(password, MoodkieSecurity.AESBits.BITS128);
         return(aesEncryptor.Encrypt((writer.BaseStream as MemoryStream).ToArray()));
     }
     else         // XOR Obfuscation
     {
         return(Obfuscator.Obfuscate((writer.BaseStream as MemoryStream).ToArray(), password));
     }
 }
示例#7
0
 //send from server
 private void Broadcast(string data, List <ServerClient> cl)
 {
     foreach (ServerClient sc in cl)
     {
         try{
             StreamWriter writer = new StreamWriter(sc.tcp.GetStream());
             writer.WriteLine(Obfuscator.Obfuscate(data));
             writer.Flush();
         } catch (Exception e) {
             Debug.Log("Write error: " + e.Message);
         }
     }
 }
示例#8
0
 private void Obfuscate()
 {
     if (txtAssembly.Text != string.Empty && File.Exists(txtAssembly.Text))
     {
         var obfuscatorSettings = GenerateObfuscateSettings();
         var obfuscator         = new Obfuscator(obfuscatorSettings);
         MessageBox.Show(obfuscator.Obfuscate() ? "Obfuscate succeded" : "Obfuscate failed", "Obfuscate results");
     }
     else
     {
         rtbResults.Text += "Select an assembly" + Environment.NewLine;
     }
 }
示例#9
0
    public void ConnectButton()
    {
        string testSTR = "cWHOHost";
        string newSTR  = "";

        for (int i = 0; i < 100; i++)
        {
            newSTR = Obfuscator.DeObfuscate(Obfuscator.Obfuscate(testSTR));
            if (newSTR != testSTR)
            {
                Debug.Log(newSTR);
            }
        }
        mainMenu.SetActive(false);
        connectMenu.SetActive(true);
    }
示例#10
0
        static void Main(string[] args)
        {
            //<script>alert(String.fromCharCode('A'.charCodeAt(0) + 'B'.charCodeAt(0) - 'A'.charCodeAt(0)));</script>
            if (true)
            {
                string text = args.Length > 0 ? args[0] : "test";
                Obfuscator o = new Obfuscator();
                string res = o.Obfuscate(text, "7fkc83Rhjas61dfBc0xZgfspPs1nNf2EeЁйжпyyКйзЗХяЯбИпРдээвУЖ");
                Console.WriteLine(res);
            }
            string s = "" + (char)((((33 | 68) + (('W') - 0x59)) < (0x47 + ((0x49 + ((0x66 + (((char)0x5E) - 0x47)) - (35 | 35))) - 0x53)) ? ((32 | 66) + (('_') - 0x4D)) : (0x50 + (((44 | 44) + ((109 + (((char)0x4D) - 0x50)) - 83)) - 0x5C)))) + (char)(((0x59 + (93 + (('S') - 0x45))) < ((0x4D + (((49 | 50) + ((0x45 + ((84 + ((0x63 + ((92 + (('S') - 0x4B)) - 80)) - 0x49)) - (36 | 37))) - 0x59)) - 0x4C)) - 0x5A) ? (0x4A + ((95 + (('T') - 73)) - 84)) : (0x69 + (((char)78) - (27 | 55))))) + (char)((((0x74 + (((char)0x5B) - 72)) - 0x47) > (0x60 + ((0x63 + ((0x51 + (((33 | 66) + (((char)0x4C) - (26 | 52))) - (22 | 46))) - (28 | 58))) - 0x4F)) ? ((111 + ((107 + (('C') - 74)) - (26 | 53))) - (46 | 46)) : (0x5D + ((72 + ((91 + ((83 + ((68 + ((0x57 + ((0x61 + (((char)(25 | 50)) - (34 | 34))) - 0x5C)) - 0x46)) - 0x4D)) - 0x4B)) - (30 | 61))) - 0x4E)))) + (char)((((char)0x5B) < (98 + ((char)0x4D)) ? ((36 | 74) + (((char)0x5F) - 0x59)) : ((char)70)));

            //BinHelper bin = new BinHelper();
            //Console.WriteLine( BinHelper.int2bin(1027));
            //List<int> pos = BinHelper.findPos(3, 1027);
            //string a = BinHelper.MakeXfromY(22, 709);

            Console.ReadLine();
        }
示例#11
0
        static void Main(string[] args)
        {
            try
            {
                Console.Title = "Marwix - Obfuscator";
                // Get or ask for path to assembly.
                string path;
                if (args.Length > 0)
                {
                    path = args[0];
                }
                else
                {
                    Console.Write("Path: ");
                    path = Console.ReadLine();
                }

                using (var inputStream = File.OpenRead(path = path.Replace("\"", "")))
                {
                    // Read assembly.
                    var assembly  = AssemblyDefinition.ReadAssembly(inputStream);
                    var logOutput = new ConsoleLogOutput();

                    // Obfuscate assembly.
                    Obfuscator.Obfuscate(assembly, logOutput);

                    // Write obfuscated assembly to disk.
                    var outputDirectory = Path.Combine(Path.GetDirectoryName(path), "Obfuscated");
                    if (!Directory.Exists(outputDirectory))
                    {
                        Directory.CreateDirectory(outputDirectory);
                    }

                    using (var outputStream = File.Create(Path.Combine(outputDirectory, Path.GetFileName(path))))
                        assembly.Write(outputStream);
                    Console.WriteLine("Obfuscated.");
                }

                Console.ReadKey();
            }
            catch (Exception er) { MessageBox.Show(er.ToString()); }
        }
        static void Main(string[] args)
        {
            //<script>alert(String.fromCharCode('A'.charCodeAt(0) + 'B'.charCodeAt(0) - 'A'.charCodeAt(0)));</script>
            if (true)
            {
                string     text = args.Length > 0 ? args[0] : "test";
                Obfuscator o    = new Obfuscator();
                string     res  = o.Obfuscate(text, "7fkc83Rhjas61dfBc0xZgfspPs1nNf2EeЁйжпyyКйзЗХяЯбИпРдээвУЖ");
                Console.WriteLine(res);
            }
            string s = "" + (char)((((33 | 68) + (('W') - 0x59)) < (0x47 + ((0x49 + ((0x66 + (((char)0x5E) - 0x47)) - (35 | 35))) - 0x53)) ? ((32 | 66) + (('_') - 0x4D)) : (0x50 + (((44 | 44) + ((109 + (((char)0x4D) - 0x50)) - 83)) - 0x5C)))) + (char)(((0x59 + (93 + (('S') - 0x45))) < ((0x4D + (((49 | 50) + ((0x45 + ((84 + ((0x63 + ((92 + (('S') - 0x4B)) - 80)) - 0x49)) - (36 | 37))) - 0x59)) - 0x4C)) - 0x5A) ? (0x4A + ((95 + (('T') - 73)) - 84)) : (0x69 + (((char)78) - (27 | 55))))) + (char)((((0x74 + (((char)0x5B) - 72)) - 0x47) > (0x60 + ((0x63 + ((0x51 + (((33 | 66) + (((char)0x4C) - (26 | 52))) - (22 | 46))) - (28 | 58))) - 0x4F)) ? ((111 + ((107 + (('C') - 74)) - (26 | 53))) - (46 | 46)) : (0x5D + ((72 + ((91 + ((83 + ((68 + ((0x57 + ((0x61 + (((char)(25 | 50)) - (34 | 34))) - 0x5C)) - 0x46)) - 0x4D)) - 0x4B)) - (30 | 61))) - 0x4E)))) + (char)((((char)0x5B) < (98 + ((char)0x4D)) ? ((36 | 74) + (((char)0x5F) - 0x59)) : ((char)70)));


            //BinHelper bin = new BinHelper();
            //Console.WriteLine( BinHelper.int2bin(1027));
            //List<int> pos = BinHelper.findPos(3, 1027);
            //string a = BinHelper.MakeXfromY(22, 709);

            Console.ReadLine();
        }
 public string Obfuscate(int value)
 {
     return(_obfuscator.Obfuscate(value)); // e.g. xVrAndNb
 }
示例#14
0
        public static int Main(string[] args)
        {
            var app = new CommandLineApplication
            {
                Name        = "ConsoleApp",
                Description = "An required assignment",
            };

            app.HelpOption(inherited: true);

            //Number 1
            /*------------------------------------------------------------------------*/
            app.Command("uppercase", setCmd =>
            {
                var word = setCmd.Argument("key", "Name of the config").IsRequired();
                setCmd.OnExecute(() =>
                {
                    Console.WriteLine(StringTransform.Uppercase(word.Value));
                });
            });

            app.Command("lowercase", setCmd =>
            {
                setCmd.Description = "Set config value";
                var word           = setCmd.Argument("key", "Name of the config").IsRequired();
                setCmd.OnExecute(() =>
                {
                    Console.WriteLine(StringTransform.Lowercase(word.Value));
                });
            });

            app.Command("capitalize", setCmd =>
            {
                setCmd.Description = "Set config value";
                var word           = setCmd.Argument("key", "Name of the config").IsRequired();
                setCmd.OnExecute(() =>
                {
                    Console.WriteLine(StringTransform.Capitalize(word.Value));
                });
            });

            //Number 2
            /*------------------------------------------------------------------------*/


            app.Command("add", cmd =>
            {
                var files = cmd.Argument("numbers", "numbers to count", multipleValues: true);
                cmd.OnExecute(() =>
                {
                    var result = Arithmetic.DoArithmetic(files.Values, "add");

                    Console.WriteLine(result);
                });
            });

            app.Command("substract", cmd =>
            {
                var files = cmd.Argument("numbers", "numbers to count", multipleValues: true);
                cmd.OnExecute(() =>
                {
                    var result = Arithmetic.DoArithmetic(files.Values, "substract");

                    Console.WriteLine(result);
                });
            });

            app.Command("multiply", cmd =>
            {
                var files = cmd.Argument("numbers", "numbers to count", multipleValues: true);
                cmd.OnExecute(() =>
                {
                    var result = Arithmetic.DoArithmetic(files.Values, "multiply");

                    Console.WriteLine(result);
                });
            });

            app.Command("divide", cmd =>
            {
                var files = cmd.Argument("numbers", "numbers to count", multipleValues: true);
                cmd.OnExecute(() =>
                {
                    var result = Arithmetic.DoArithmetic(files.Values, "divide");

                    Console.WriteLine(result);
                });
            });

            //Number 3
            /*------------------------------------------------------------------------*/

            app.Command("palindrome", setCmd =>
            {
                setCmd.Description = "Set c onfig value";
                var word           = setCmd.Argument("key", "Name of the config").IsRequired();
                setCmd.OnExecute(() =>
                {
                    var result = Palindrome.IsPalindrome(word.Value);
                    if (result == true)
                    {
                        Console.WriteLine("Is Palindrome? Yes");
                    }
                    else
                    {
                        Console.WriteLine("Is Palindrome? No");
                    }
                });
            });

            //Number 4
            /*------------------------------------------------------------------------*/

            app.Command("obfuscator", setCmd =>
            {
                setCmd.Description = "Set c onfig value";
                var word           = setCmd.Argument("key", "Name of the config").IsRequired();
                setCmd.OnExecute(() =>
                {
                    Console.WriteLine(Obfuscator.Obfuscate(word.Value));
                });
            });

            app.OnExecute(() =>
            {
                Console.WriteLine("Specify a subcommand");
                app.ShowHelp();
                return(1);
            });

            //Number 5
            /*------------------------------------------------------------------------*/


            app.Command("random", cmd =>
            {
                var length                = cmd.Option("--length", "setting random length", CommandOptionType.SingleOrNoValue);
                var letters               = cmd.Option("--letters", "setting letters availability", CommandOptionType.SingleOrNoValue);
                var numbers               = cmd.Option("--numbers", "setting numbers availability", CommandOptionType.SingleOrNoValue);
                var lowercase             = cmd.Option("--lowercase", "setting lowercase", CommandOptionType.NoValue);
                RandomGenerator generator = new RandomGenerator();
                cmd.OnExecute(() =>
                {
                    int num = Convert.ToInt32(length.Value());
                    string result;
                    if (!length.HasValue())
                    {
                        num = 32;
                    }

                    if (!letters.HasValue() || numbers.HasValue())
                    {
                        result = generator.GenerateNum(num);
                    }
                    else if (letters.HasValue() || !numbers.HasValue())
                    {
                        result = generator.GenerateLet(num);
                    }
                    else
                    {
                        result = generator.GenerateAll(num);
                    }

                    if (lowercase.HasValue())
                    {
                        result = result.ToLower();
                    }

                    Console.WriteLine(result);
                });
            });

            //Number 6
            /*------------------------------------------------------------------------*/

            app.Command("ip", cmd =>
            {
                cmd.OnExecute(() =>
                {
                    Console.WriteLine(GetIp.GetLocalIPAddress());
                });
            });

            //Number 7
            /*------------------------------------------------------------------------*/

            app.Command("ip-external", cmd =>
            {
                cmd.OnExecute(() =>
                {
                    Console.WriteLine(GetIp.GetPublicIp());
                });
            });

            //Number 8
            /*------------------------------------------------------------------------*/

            app.Command("screenshot", cmd =>
            {
                var link   = cmd.Argument("link", "link to be screenshot").IsRequired();
                var format = cmd.Option("--format", "the format", CommandOptionType.SingleOrNoValue);
                var output = cmd.Option("--output", "the output", CommandOptionType.SingleOrNoValue);
                cmd.OnExecute(() =>
                {
                    if (format.HasValue() && output.HasValue())
                    {
                        Screenshot.GetScreenshot(link.Value, format.Value(), output.Value());
                    }
                    else if (format.HasValue())
                    {
                        Screenshot.GetScreenshot(link.Value, format.Value());
                    }
                    else if (output.HasValue())
                    {
                        Screenshot.GetScreenshot(link.Value, default, output.Value());
示例#15
0
        public static void Obfuscate()
        {
            string targetDLL     = "Assembly-CSharp.dll";
            string targetDLLPath = FindDllLocation(targetDLL);

            startObfuscating = false;

            if (targetDLLPath == null)
            {
                Debug.LogError(String.Format("Can't found {0} in this project", targetDLL));
                return;
            }
            else if (Application.isPlaying)
            {
                string[] NOTICE_LOG =
                {
                    @"플레이모드에서는 난독화 서비스를 지원하지 않습니다.",
                    "Obfuscator is only supported when build project not playmode."
                };

                Debug.Log(NOTICE_LOG [LanguageManager.currentLanguage]);
                return;
            }

            var option = SEOption.LoadOption();

            SESetting.SetBuildTarget();
            if (SESetting.IsIL2CPP)
            {
                option.SupportIL2CPP = true;
            }
            else
            {
                option.SupportIL2CPP = false;
            }

            EditorApplication.LockReloadAssemblies();
            if (!restart)
            {
                restart = true;

                if (option.EnableObfuscation)
                {
                    startObfuscating = true;

                    var getFiles = GetFiles(EditorApplication.applicationContentsPath, "UnityEngine.dll");
                    var library  = new List <String> ();
                    foreach (var file in getFiles)
                    {
                        if (!library.Contains(file))
                        {
                            library.Add(Path.GetDirectoryName(file));
                        }
                    }

                    getFiles = GetFiles(Path.GetDirectoryName(Application.dataPath), "Assembly-CSharp.dll");
                    foreach (var file in getFiles)
                    {
                        if (!library.Contains(file))
                        {
                            library.Add(Path.GetDirectoryName(file));
                        }
                    }

                    option.LibraryDirs = library;
                    SEOption.SaveOption(option);

                    Obfuscator.SetPluginOption(option);
                    try{
                        string result = Obfuscator.Obfuscate(targetDLLPath);
                        if (result != null)
                        {
                            if (result.StartsWith("== Obfuscated Result =="))
                            {
                                foreach (string log in result.Split('\n'))
                                {
                                    Debug.Log(log);
                                }
                                success = true;
                            }
                            else
                            {
                                Debug.LogError(String.Format("Obfuscation Fail : '{0}'", result));
                            }
                        }
                    } catch (AssemblyResolutionException E) {
                        buildCount++;

                        if (buildCount > 2)
                        {
                            Debug.LogError(String.Format("Build Fail : '{0}'", E));
                            Debug.LogError("Please report via email with logs.");
                        }

                        string[] BUILD_ERROR =
                        {
                            @"원본빌드가 정상적으로 완료된 후 다시 시도해주세요.",
                            "Please try again after your program building successful."
                        };

                        Debug.Log(BUILD_ERROR [LanguageManager.currentLanguage]);
                    }
                }
            }

            EditorApplication.UnlockReloadAssemblies();
        }
示例#16
0
        private void button1_Click(object sender, EventArgs e)
        {
            Obfuscator o = new Obfuscator();

            textBox2.Text = o.Obfuscate(textBox1.Text, textBox3.Text);
        }
示例#17
0
 private void button1_Click(object sender, EventArgs e)
 {
     Obfuscator o = new Obfuscator();
     textBox2.Text = o.Obfuscate(textBox1.Text, textBox3.Text);
 }
        /// <summary>
        /// Generates specified obfuscated class files.
        /// </summary>
        public static void ObfuscateSecrets(bool includeGoogle, ref string appleError,
                                            ref string googleError, string googlePlayPublicKey)
        {
            try
            {
                // First things first! Obfuscate! XHTLOA!
                {
                    appleError = null;
                    int    key     = 0;
                    int[]  order   = new int[0];
                    byte[] tangled = new byte[0];
                    try
                    {
                        byte[] bytes = System.IO.File.ReadAllBytes(kAppleCertPath);
                        order = new int[bytes.Length / 20 + 1];

                        // TODO: Integrate with upgraded Tangle!

                        tangled = Obfuscator.Obfuscate(bytes, order, out key);
                    }
                    catch (Exception e)
                    {
                        Debug.LogWarning("Invalid Apple Root Certificate. Generating incomplete credentials file. " + e);
                        appleError = "  Invalid Apple Root Certificate";
                    }
                    BuildObfuscatedClass("Apple", key, order, tangled, tangled.Length != 0);
                }

                if (includeGoogle)
                {
                    googleError = null;
                    int    key     = 0;
                    int[]  order   = new int[0];
                    byte[] tangled = new byte[0];
                    try
                    {
                        var bytes = Convert.FromBase64String(googlePlayPublicKey);
                        order = new int[bytes.Length / 20 + 1];

                        tangled = Obfuscator.Obfuscate(bytes, order, out key);
                    }
                    catch (Exception e)
                    {
                        Debug.LogWarning("Invalid Google Play Public Key. Generating incomplete credentials file. " + e);
                        googleError =
                            "  The Google Play License Key is invalid. GooglePlayTangle was generated with incomplete credentials.";
                    }
                    BuildObfuscatedClass("GooglePlay", key, order, tangled, tangled.Length != 0);
                }
            }
            catch (Exception e)
            {
                Debug.Log(e.StackTrace);
            }

            // Ensure all the Tangle classes exist, even if they were not generated at this time. Apple will always
            // be generated.
            if (!ObfuscatedClassExists("GooglePlay"))
            {
                try
                {
                    BuildObfuscatedClass("GooglePlay", 0, new int[0], new byte[0], false);
                }
                catch (Exception e)
                {
                    Debug.Log(e.StackTrace);
                }
            }

            AssetDatabase.Refresh();
        }
示例#19
0
        private void ObfuscateWhileLocked()
        {
            if (_options == null)
            {
                _options = OptionsManager.LoadOptions();
            }

            if (ShouldObfuscate() == false)
            {
                return;
            }

            AssemblySelector selector = new AssemblySelector(_options);

            ICollection <string> compiledDlls = selector.GetCompiledAssemblyPaths();

            if (compiledDlls.Count > 0)
            {
                EditorApplication.update += RestoreUtils.RestoreOriginalDlls;
            }

            IDictionary <string, string> backupMap = FileBackup.GetBackupMap(compiledDlls);

            FileBackup.Backup(backupMap);

            ICollection <string> dlls = selector.GetAssemblyPaths();

            if (dlls.Count == 0 && compiledDlls.Count == 0)
            {
                _noCSharpScripts = true;
                return;
            }

            HashSet <string> extraAssemblyReferenceDirectories = new HashSet <string>(_options.extraAssemblyDirectories);

#if UNITY_2017_3_OR_NEWER
            extraAssemblyReferenceDirectories.UnionWith(AssemblyReferenceLocator.GetAssemblyReferenceDirectories());
#endif

            Obfuscator.SetExtraAssemblyDirectories(extraAssemblyReferenceDirectories.ToArray());

#if UNITY_2018_2_OR_NEWER
            Obfuscator.ObfuscateMonoBehavioursByAssetDatabase(false);
            var obfuscateMonoBehaviourNames = _options.obfuscateMonoBehaviourClassNames;
            try
            {
                if (IsXCodeProject() && _options.obfuscateMonoBehaviourClassNames)
                {
                    Debug.LogWarning("MonoBehaviour class names will not be obfuscated when creating Xcode projects");
                    _options.obfuscateMonoBehaviourClassNames = false;
                }
#endif

            Obfuscator.Obfuscate(dlls, compiledDlls, _options, EditorUserBuildSettings.activeBuildTarget);

#if !UNITY_2018_2_OR_NEWER
            if (_options.obfuscateMonoBehaviourClassNames)
            {
                /*
                 * RestoreAssets must be registered via the update delegate because [PostProcessBuild] is not guaranteed to be called
                 */
                EditorApplication.update         += RestoreUtils.RestoreMonobehaviourSourceFiles;
                _monoBehaviourAssetsNeedReverting = true;
            }
#else
        }

        finally
        {
            _options.obfuscateMonoBehaviourClassNames = obfuscateMonoBehaviourNames;
        }
#endif
            _hasObfuscated = true;
        }
示例#20
0
        public string Obfuscate(int value)
        {
            var result = _obfuscator.Obfuscate(value);

            return(result);
        }