Example #1
0
        private void Decompile(string bsp, string out_path)
        {
            try {
                PrintColor.InfoLine("{f:Black}{b:White}=============Decompiling using BSPsrc============={r}");

                System.Diagnostics.Process BSPsrc = new System.Diagnostics.Process();
                BSPsrc.StartInfo.FileName = "java";
                if (Program.Config.ReadBool("bool_map_analyzer_full_decompile"))
                {
                    BSPsrc.StartInfo.Arguments = "-jar " + jar_path + " \"" + target_path + "\" -o \"" + out_path + "\"";
                }
                else
                {
                    BSPsrc.StartInfo.Arguments = "-jar " + jar_path + " \"" + target_path + "\" -o \"" + out_path + "\" -no_areaportals -no_cubemaps -no_details -no_ladders -no_occluders -no_overlays -no_rotfix -no_sprp -no_brushes -no_disps -no_texfix -no_cams -no_lumpfiles -no_prot -no_visgroups";
                }
                BSPsrc.StartInfo.UseShellExecute        = false;
                BSPsrc.StartInfo.RedirectStandardOutput = false;
                BSPsrc.StartInfo.RedirectStandardError  = false;
                BSPsrc.Start();
                BSPsrc.WaitForExit();

                PrintColor.InfoLine("{f:Black}{b:White}=================BSPsrc Finished=================={r}");
            }
            catch (Exception e) {
                Error.WriteNoIncrement("Failed to decompile VBSP: '{$0}'", -1, 995, e.Message);
            }
        }
Example #2
0
 public static void WriteNoIncrement(string message, int line = -1, uint code = 0300, params string[] args)
 {
     if (line == -1)
     {
         PrintColor.WriteLine("{f:Black}{b:Yellow}[Warning-W" + code.ToString("0000") + "]{r}" + String.Empty.PadRight(7) + message, args);
     }
     else
     {
         PrintColor.WriteLine("{f:Black}{b:Yellow}[Warning-W" + code.ToString("0000") + "]{r}:" + line.ToString().PadRight(6) + message, args);
     }
 }
Example #3
0
 private static void ShowOptions()
 {
     Console.Write("\n");
     PrintColor.WriteLine("{b:White}{f:Black}F1{r} Show Credit Stats".PadRight(33 + 21) + "{b:White}{f:Black}F5{r} Reparse Pop File (Restart)".PadRight(33 + 21) + "{b:White}{f:Black}F9{r}  -Unused-".PadRight(33 + 21));
     PrintColor.WriteLine("{b:White}{f:Black}F2{r} Show WaveSpawn Names".PadRight(33 + 21) + "{b:White}{f:Black}F6{r} Search Items & Attributes".PadRight(33 + 21) + "{b:White}{f:Black}F10{r} Update Database".PadRight(33 + 21));
     PrintColor.WriteLine("{b:White}{f:Black}F3{r} Show All Template Names".PadRight(33 + 21) + "{b:White}{f:Black}F7{r} -Unused-".PadRight(33 + 21) + "{b:White}{f:Black}F11{r} Fullscreen (Windows Default)".PadRight(33 + 21));
     PrintColor.WriteLine("{b:White}{f:Black}F4{r} Show Custom Icons".PadRight(33 + 21) + "{b:White}{f:Black}F8{r} Analyze Map (BSP)".PadRight(33 + 21) + "{b:White}{f:Black}F12{r} Open P3 Code Reference (PDF)".PadRight(33 + 21));
     Console.Write("\n");
     PrintColor.WriteLine("{b:White}{f:Black}Any Key{r} Quit");
     Console.Write("\n");
 }
Example #4
0
        // A terrible solution to a terrible problem that never existed
        public static void DoTheThing(List <string> tokens)
        {
            string target;

            try {
                SaveFileDialog dialog = new SaveFileDialog {
                    Filter = "Efficient Pop File | *.pop"
                };
                dialog.ShowDialog();
                target = dialog.FileName;
                PrintColor.InfoLine("Created efficient pop file at {f:Black}{b:Gray}{$0}{r}", target);
            }
            catch {
                throw new System.Exception("SecretException");
            }

            using (StreamWriter writer = new StreamWriter(new FileStream(target, FileMode.Create))) {
                foreach (string token in tokens)
                {
                    if (token == "{")
                    {
                        writer.Write("{ ");
                    }
                    else if (token == "}")
                    {
                        writer.Write("} ");
                    }
                    else if (token == "<EOF>")
                    {
                        continue;
                    }
                    else
                    {
                        writer.Write(token + " ");
                    }
                }
                writer.Close();
            }
        }
Example #5
0
File: Program.cs Project: NPsim/P3
        internal static void Main(string[] args)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            // Console Size
            try {
                int Width  = Console.LargestWindowWidth >= 100 ? 100 : Console.LargestWindowWidth;
                int Height = Console.LargestWindowHeight >= 50 ? 50 : Console.LargestWindowHeight;
                Console.SetWindowSize(Width, Height);
            }
            catch { }             // Catch possible SecurityException

            // Build Dialog
            OpenFileDialog Dialog = new OpenFileDialog {
                Filter = "Pop Files|*.pop"
            };

#if DEBUG
            Dialog.InitialDirectory = @"";
#endif

            // Get Execution Safety
            SafetyLevel = Program.Config.ReadBool("bool_unsafe") ? ParserSafetyLevel.UNSAFE : ParserSafetyLevel.SAFE;

            // Launch Flags
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i] == "-pop")
                {
                    Dialog.FileName         = args[i + 1];
                    LaunchArguments["-pop"] = args[i + 1];
                }
                if (args[i] == "-log")
                {
                    PrintColor.InfoLine("=====Log: {f:Cyan}{$0}{r}=====", args[i + 1]);
                    LogWriter = new StreamWriter(new FileStream(args[i + 1], FileMode.Append));
                    LaunchArguments["-log"] = args[i + 1];
                }
                if (args[i] == "--no_menu")
                {
                    NoMenu = true;
                    LaunchArguments["--no_menu"] = "1";
                }
                if (args[i] == "--auto_close")
                {
                    AutoClose = true;
                    LaunchArguments["--auto_close"] = "1";
                }
                if (args[i] == "--AF")
                {
                    Secret = true;
                    LaunchArguments["--AF"] = "1";
                }
                if (args[i] == "--time")
                {
                    ShowStopWatch             = true;
                    LaunchArguments["--time"] = "1";
                }
                if (args[i] == "--unsafe")
                {
                    SafetyLevel = ParserSafetyLevel.UNSAFE;
                    LaunchArguments["--unsafe"] = "1";
                }
                if (args[i] == "--safe")
                {
                    SafetyLevel = ParserSafetyLevel.SAFE;
                    LaunchArguments["--safe"] = "1";
                }
            }

            // Show Dialog
            if (SafetyLevel == ParserSafetyLevel.UNSAFE)
            {
                PrintColor.InfoLine("P3 v2.1.0 {b:White}{f:Black} UNSAFE MODE {r}");
            }
            else
            {
                PrintColor.InfoLine("P3 v2.1.0");
            }


            while (Dialog.FileName == "")
            {
                PrintColor.InfoLine("Select your Pop file");
                Dialog.ShowDialog();
            }
            FullPopFileDirectory    = Path.GetDirectoryName(Dialog.FileName);
            FullPopFilePath         = Dialog.FileName;
            LaunchArguments["-pop"] = Dialog.FileName;
            Console.Title           = "P3 - " + Path.GetFileName(FullPopFilePath);


            var StopWatch = System.Diagnostics.Stopwatch.StartNew();
            LineCount += File.ReadLines(FullPopFilePath).Count();

            //string FileContents = File.ReadAllText(FullPopFilePath); // Legacy input method
            //AntlrInputStream inputstream = new AntlrInputStream(FileContents);
            FileStream       FS          = new FileStream(FullPopFilePath, FileMode.Open);
            AntlrInputStream inputstream = new AntlrInputStream(FS);
            FS.Close();

            PopulationLexer lexer = new PopulationLexer(inputstream);
            lexer.RemoveErrorListeners();
            lexer.AddErrorListener(new PopulationLexerErrorListener <int>());

            CommonTokenStream tokenstream = new CommonTokenStream(lexer);

            PopulationParser parser = new PopulationParser(tokenstream);
            parser.RemoveErrorListeners();
            parser.AddErrorListener(new PopulationErrorListener());
            parser.ErrorHandler = new PopulationErrorStrategy();

            ItemDatabase.Build();
            AttributeDatabase.Build();

            PrintColor.InfoLine("Pop File - {f:Cyan}{$0}{r}", FullPopFilePath);
            PopulationParser.PopfileContext context = parser.popfile();
            PopulationVisitor visitor = new PopulationVisitor();
            visitor.Visit(context, tokenstream);

            Program.PopFile = visitor.GetPopFile();
            PopAnalyzer     = new PopulationAnalyzer(Program.PopFile);
            PrintColor.InfoLine("\tDone Parsing Pop File - {f:Cyan}{$0}{r}", Path.GetFileName(FullPopFilePath));

            StopWatch.Stop();

            // Ending Statement
            Console.Write("\n");
            if (Error.Errors > 0)
            {
                PrintColor.WriteLine("{f:Black}{b:Red}Finished with {$0} errors and {$1} warnings.{r}", Error.Errors.ToString(), Warning.Warnings.ToString());
            }
            else if (Warning.Warnings > 0)
            {
                PrintColor.WriteLine("{f:Black}{b:Yellow}Finished with {$0} warnings.{r}", Warning.Warnings.ToString());
            }
            else
            {
                PrintColor.WriteLine("{f:Black}{b:Green}Finished cleanly.{r}");
            }

            // Execution Time
            if (ShowStopWatch)
            {
                PrintColor.InfoLine("Execution time: {f:Cyan}{$1} lines{r} in {f:Cyan}{$0}ms{r}", StopWatch.ElapsedMilliseconds.ToString(), LineCount.ToString());
            }

            if (Secret)
            {
                List <string> tokens = new List <string>();
                foreach (IToken t in tokenstream.GetTokens())
                {
                    tokens.Add(t.Text);
                }

                try {
                    AprilFools.DoTheThing(tokens);
                }
                catch {
                    PrintColor.InfoLine("Better luck next time! (an error occurred)");
                }
            }

            if (AutoClose)
            {
                // Avoid everything
            }
            else if (!NoMenu)
            {
                Menu.Capture();
            }
            else
            {
                PrintColor.InfoLine("Press any key to continue.");
                Console.ReadKey();
            }

            if (LogWriter != null)
            {
                LogWriter.Write("\n=========================\n\n");
                LogWriter.Close();
            }
        }
Example #6
0
        public static void Build()
        {
            // Database must exist
            if (!File.Exists(Path))
            {
                Error.WriteNoIncrement("Could not find local database.", -1, 997);
                return;
            }

            string[] RawDBLines = File.ReadAllLines(Path);
            PrintColor.InfoLine("ItemDB Version: {f:Cyan}{$0}{r}", RawDBLines[0]);
            Item ItemEntry = new Item();

            for (int i = 1; i < RawDBLines.Count(); i++)
            {
                string Line = RawDBLines[i];
                if (Regex.IsMatch(Line, @"^\S"))
                {
                    if (!string.IsNullOrEmpty(ItemEntry.Name))
                    {
                        Items[ItemEntry.Name] = ItemEntry;
                    }
                    ItemEntry = new Item {
                        Name = Line
                    };
                }
                else
                {
                    MatchCollection Token = Regex.Matches(Line, "\"[^\"]*\"|[^\"\\s]\\S*[^\"\\s]|[^\"\\s]");
                    switch (Token[0].Value.ToUpper().Trim('"'))
                    {
                    case "LOC":
                        ItemEntry.Localization = Token[1].Value;
                        break;

                    case "DFS":
                        ItemEntry.DefaultSlot = Token[1].Value;
                        break;

                    case "SLT": {
                        if (Token[1].Value == "ALLCLASS")
                        {
                            for (int ClassIndex = 0; ClassIndex < 9; ClassIndex++)
                            {
                                ItemEntry.Slot[ClassIndex] = ItemEntry.DefaultSlot;
                            }
                        }
                        else
                        {
                            for (int ClassIndex = 0; ClassIndex < 9; ClassIndex++)
                            {
                                if (Token[ClassIndex + 1].Value.Trim('"') == "1")
                                {
                                    ItemEntry.Slot[ClassIndex] = ItemEntry.DefaultSlot;
                                }
                                else
                                {
                                    ItemEntry.Slot[ClassIndex] = Token[ClassIndex + 1].Value;
                                }
                            }
                        }
                        break;
                    }

                    default:
                        ItemEntry.Attributes[Token[0].Value.Trim('"')] = Token[1].Value.Trim('"');
                        break;
                    }
                }
            }
        }
Example #7
0
        private static void MapAnalyzer()
        {
            PrintColor.InfoLine("{f:Black}{b:Gray}Select a BSP to generate a list of bot spawns, logic relays, nav prefers, and tank nodes{r}");
            string map_path = "";

            try {
                string pop_folder = Regex.Match(Program.FullPopFilePath, @"^.*[\/\\]").ToString();                 // Regex: Match everything up to last / or \
                System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog {
                    Filter = "MvM Map Files|*.bsp"
                };
                dialog.ShowDialog();
                if (dialog.FileName.Length == 0)
                {
                    throw new Exception("NoFile");
                }
                PrintColor.InfoLine("Map: " + dialog.FileName);
                map_path = dialog.FileName;
            }
            catch {
                Error.WriteNoIncrement("Failed to get file by dialog.", -1, 997);
                return;
            }

            try {
                // Analyze Map
                MapAnalyzer map = new MapAnalyzer(map_path);

                // Display Results
                PrintColor.InfoLine("Bot Spawns:");
                foreach (string location in Sort.PadSort(map.Spawns))
                {
                    PrintColor.InfoLine("\t" + location);
                }
                PrintColor.InfoLine("Logic Relays:");
                foreach (string relay in Sort.PadSort(map.Relays))
                {
                    PrintColor.InfoLine("\t" + relay);
                }
                PrintColor.InfoLine("Nav Prefers:");
                foreach (string nav in Sort.PadSort(map.Navs))
                {
                    PrintColor.InfoLine("\t" + nav);
                }
                PrintColor.InfoLine("Tank Nodes:");
                foreach (string track in Sort.PadSort(map.Tracks))
                {
                    PrintColor.InfoLine("\t" + track);
                }
            }
            catch (Exception e) {
                switch (e.Message)
                {
                case "InvalidVBSPException":
                    Error.WriteNoIncrement("Invalid VBSP file.", -1, 996);
                    break;

                default:
                    Error.WriteNoIncrement("Failed to decompile VBSP: '{$0}'", -1, 995, e.Message);
                    break;
                }
            }
        }
Example #8
0
        private static void SearchItemCharacterAttributes()
        {
            PrintColor.InfoLine("{f:Black}{b:Gray}Search for an item or attribute name{r} or {f:Black}{b:Gray}Enter an item's exact name to view its attributes{r}");

            // Get User Input
            PrintColor.Info("Search Term: ");
            string search_phrase = Console.ReadLine();

            // Go Back if User Enters Blank or Spaces
            if (Regex.Replace(search_phrase, @"\s*", "") == "")
            {
                PrintColor.InfoLine("Invalid entry. Canceling Search.");
                return;
            }

            // Blank Separator Line
            PrintColor.InfoLine("");

            /* Item Names */
            // Get Results
            string[] item_results = Search.Simple(ItemDatabase.List, search_phrase);

            // Show Results
            PrintColor.InfoLine("Item results for {b:White}{f:Black} " + search_phrase + " {r}");
            foreach (string item in item_results)
            {
                PrintColor.InfoLine("\t" + item);
                if (search_phrase.ToUpper() == item.ToUpper())
                {
                    Dictionary <string, string> attributes = ItemDatabase.Attributes(item);
                    foreach (string key in attributes.Keys)
                    {
                        PrintColor.InfoLine("\t    \"" + key + "\" " + attributes[key] + "");
                    }

                    if (attributes.Keys.Count == 0)
                    {
                        PrintColor.InfoLine("\t    No Usable Item Attributes Found.");
                    }
                }
            }

            // No Items Found
            if (item_results.Count() == 0)
            {
                PrintColor.InfoLine("\tNo Items Found.");
            }

            // Blank Separator Line
            PrintColor.Info("\n");

            /* Item/Char Attributes */
            // Get Results
            string[] att_results = Search.Simple(AttributeDatabase.Keys, search_phrase);

            // Show Results
            PrintColor.InfoLine("Attribute results for {b:White}{f:Black} " + search_phrase + " {r}");
            foreach (string attribute in att_results)
            {
                PrintColor.InfoLine("\t" + attribute);
            }

            // No Attributes Found
            if (att_results.Count() == 0)
            {
                PrintColor.InfoLine("\tNo Attributes Found.");
            }
        }
Example #9
0
        public static void Capture()
        {
            ConsoleKey KeyPressed;

            while (!Exit)
            {
                ShowOptions();
                KeyPressed = Console.ReadKey().Key;
                Console.Write("\n");

                switch (KeyPressed)
                {
                case ConsoleKey.F1: {                         // Credit Stats
                    PrintColor.InfoLine("===Credit Statistics===");
                    uint StartingCurrency     = Program.PopFile.Population.StartingCurrency;
                    List <List <uint> > Stats = Program.PopAnalyzer.CreditStatistics();
                    List <string>       ExplicitWaveCredits = new List <string>();

                    // Analyze
                    uint TotalDropped = 0;
                    uint TotalBonus   = 0;
                    for (int i = 0; i < Stats.Count; i++)
                    {
                        List <uint> WaveCredits = Stats[i];

                        uint   WaveMax = 0;
                        string Out     = "";
                        foreach (uint Credit in WaveCredits)
                        {
                            WaveMax += Credit;
                            Out     += " + " + Credit.ToString().PadLeft(3);
                        }
                        TotalDropped += WaveMax;

                        // Format Zero Max
                        if (Out.Length == 0)
                        {
                            ExplicitWaveCredits.Add("{f:Cyan}W" + (i + 1).ToString() + "{r}:    {f:Cyan}0{r}");
                        }
                        else
                        {
                            ExplicitWaveCredits.Add("{f:Cyan}W" + (i + 1).ToString() + "{r}: {f:Cyan}" + WaveMax.ToString().PadLeft(4) + "{r} = " + Out.Substring(3));
                            if (i != Stats.Count - 1)
                            {
                                TotalBonus += 100;                                         // Wave must drop at least 1 credit and not be last wave to receive bonus.
                            }
                        }
                    }

                    // Write
                    PrintColor.InfoLine("Starting Credits         : {f:Cyan}{$0}{r}", StartingCurrency.ToString());
                    PrintColor.InfoLine("Total Dropped Credits    : {f:Cyan}{$0}{r}", TotalDropped.ToString());
                    PrintColor.InfoLine("Total Bonus Credits      : {f:Cyan}{$0}{r}", TotalBonus.ToString());
                    PrintColor.InfoLine("Maximum Possible Credits : {f:Cyan}{$0}{r}", (StartingCurrency + TotalDropped + TotalBonus).ToString());
                    foreach (string StatLine in ExplicitWaveCredits)
                    {
                        PrintColor.InfoLine(StatLine);
                    }
                    break;
                }

                case ConsoleKey.F2: {                         // WaveSpawn Names
                    PrintColor.InfoLine("===WaveSpawn Names===");
                    List <List <string> > Roster = Program.PopAnalyzer.WaveSpawnNames();

                    for (int i = 0; i < Roster.Count; i++)
                    {
                        List <string> Names = Roster[i];
                        PrintColor.InfoLine("Wave {$0}:", (i + 1).ToString());
                        foreach (string WaveSpawnName in Names)
                        {
                            PrintColor.InfoLine("\t{$0}", WaveSpawnName);
                        }
                    }
                    break;
                }

                case ConsoleKey.F3:                         // Templates
                    PrintColor.InfoLine("===All Template Names===");
                    var           Types          = Program.PopAnalyzer.TemplateTypeNames();
                    List <string> TFBotNames     = Sort.PadSort(Types.Item1);
                    List <string> WaveSpawnNames = Sort.PadSort(Types.Item2);
                    List <string> GenericNames   = Sort.PadSort(Types.Item3);
                    PrintColor.InfoLine("TFBot Templates:");
                    foreach (string Name in TFBotNames)
                    {
                        PrintColor.InfoLine("\t" + Name);
                    }
                    PrintColor.InfoLine("WaveSpawn Templates:");
                    foreach (string Name in WaveSpawnNames)
                    {
                        PrintColor.InfoLine("\t" + Name);
                    }
                    PrintColor.InfoLine("Generic Templates:");
                    foreach (string Name in GenericNames)
                    {
                        PrintColor.InfoLine("\t" + Name);
                    }
                    break;

                case ConsoleKey.F4:                         // Custom Icons
                    PrintColor.InfoLine("===Custom Icons===");
                    List <string> Icons      = Program.PopAnalyzer.CustomIcons();
                    bool          IconExists = false;
                    foreach (string Icon in Sort.PadSort(Icons))
                    {
                        IconExists = true;
                        if (Icon == "scout_sunstick")
                        {
                            PrintColor.InfoLine("\t{$0} {f:DarkGray}(used in robot_standard.pop but has no default icon){r}", Icon);
                        }
                        else
                        {
                            PrintColor.InfoLine("\t{$0}", Icon);
                        }
                    }
                    if (!IconExists)
                    {
                        PrintColor.InfoLine("{f:DarkGray}No custom icons used.{r}");
                    }
                    break;

                case ConsoleKey.F5:                         // Reparse
                    Exit = true;
                    string Arguments = "";
                    foreach (string Key in Program.LaunchArguments.Keys)
                    {
                        if (Key.StartsWith("--"))
                        {
                            Arguments += '"' + Key + "\" ";
                        }
                        else
                        {
                            Arguments += '"' + Key + "\" \"" + Program.LaunchArguments[Key] + "\" ";
                        }
                    }
                    System.Diagnostics.Process Restart = new System.Diagnostics.Process();
                    Restart.StartInfo.FileName  = AppDomain.CurrentDomain.BaseDirectory + "P3.exe";
                    Restart.StartInfo.Arguments = Arguments;
                    Restart.Start();
                    break;

                case ConsoleKey.F6:                         // Search Items and Character Attributes
                    PrintColor.InfoLine("===Search Items & Item/Char Attributes===");
                    SearchItemCharacterAttributes();
                    break;

                case ConsoleKey.F7:                         // Unused
                    break;

                case ConsoleKey.F8:                         // Map Analyzer
                    PrintColor.InfoLine("===Analyze Map (.bsp)===");
                    MapAnalyzer();
                    break;

                case ConsoleKey.F9:                         // Unused
                    break;

                case ConsoleKey.F10:                         // Retarget items_game.txt
                    PrintColor.InfoLine("===Update Database===");
                    PrintColor.InfoLine(@"Please open your items_game.txt at");
                    PrintColor.InfoLine(@".\steamapps\Team Fortress 2\tf\scripts\items\items_game.txt");

                    // File Dialog
                    OpenFileDialog Dialog = new OpenFileDialog {
                        Filter = "|items_game.txt"
                    };
                    try {
                        Dialog.ShowDialog();
                        if (Dialog.FileName.Length == 0)
                        {
                            throw new System.IO.FileNotFoundException();
                        }
                    }
                    catch {
                        Error.WriteNoIncrement("Failed to get file by dialog.", -1, 997);
                        break;
                    }

                    // Attributes
                    using (AttributeScraper s = new AttributeScraper()) {
                        PrintColor.InfoLine("> Attributes Database");
                        PrintColor.InfoLine("Old version: {f:Yellow}{$0}{r}", s.Version);
                        s.Scrape(Dialog.FileName);
                        PrintColor.InfoLine("New version: {f:Green}{$0}{r}", s.Version);
                    }

                    // Items
                    using (ItemScraper s = new ItemScraper(Dialog.FileName)) {
                        PrintColor.InfoLine("> Items Database");
                        PrintColor.InfoLine("Old version: {f:Yellow}{$0}{r}", s.CurrentVersion);
                        s.Scrape(Dialog.FileName);
                        PrintColor.InfoLine("New version: {f:Green}{$0}{r}", s.CurrentVersion);
                    }
                    break;

                case ConsoleKey.F11:                         // Fullscreen
                    // Windows Default Key
                    // This cannot be easily changed
                    break;

                case ConsoleKey.F12:
                    PrintColor.InfoLine("Opening P3 Reference PDF");
                    System.Diagnostics.Process Process = new System.Diagnostics.Process();
                    Process.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "P3_Reference.pdf";
                    Process.Start();
                    break;

                default:
                    Exit = true;
                    break;
                }
            }
        }