aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Main/OS/Win95/Win95Apps/Story/Hack1.cs
blob: faafdea4d7c3421dc442061a96a92fff3535387e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TimeHACK.Engine;

namespace TimeHACK.OS.Win95.Win95Apps.Story
{
    static class Hack1 : Object
    {
        static WinClassicTerminal Console = new WinClassicTerminal();
        static WindowManager wm = new WindowManager();
        static Boolean ended = false;
        static Thread soundThread = new Thread(dialup_sound_play);
        static Boolean devMode = false;

        // This is the very first story script!
        public static void startObjective()
        {
            System.Windows.Forms.Timer tmr = new System.Windows.Forms.Timer();

            wm.startWin95(Console, "MS-DOS Prompt", null, true, true);
            Console.WriteLine("telnet> 104.27.135.159 Connecting...");          

            tmr.Interval = 1;
            tmr.Tick += new EventHandler(CheckIfSoundFinished);

            if (devMode == true)
            {
                continueObjective();
            }
            else
            {
                soundThread.Start();
                tmr.Start();
            }
        }

        public static void continueObjective()
        {
            Console.WriteLine("telnet> 104.27.135.159 Connected.");
            Thread.Sleep(2500);
            Console.WriteLine("telnet> 104.27.135.159 set hostname to 'TheHiddenHacker'.");
        }
        
        public static void CheckIfSoundFinished(Object sender, EventArgs e)
        {
            if (soundThread.IsAlive == false)
            {
                // Continue from where we were
                System.Windows.Forms.Timer trm = sender as System.Windows.Forms.Timer;

                continueObjective();
                trm.Stop();
            }
        }

        public static void dialup_sound_play()
        {
            SoundPlayer dialup_sound;
            // Play Dial-up Sound
            Stream audio = Properties.Resources.modem_dial;
            dialup_sound = new SoundPlayer(audio);
            dialup_sound.PlaySync();
        }
    }
}