Example #1
0
        public static void LoadAllResources(string resourceFolder)
        {
            if (Directory.Exists(resourceFolder))
            {
                Program.LogLoading("resources");
                string[] files = Directory.GetFiles(resourceFolder);
                items = new List <string>(); // Reinisialize the items

                for (int i = 0; i < files.Length; i++)
                {
                    if (StringInterpreter.GetFileExtension(files[i]) == "pack")
                    {
                        LoadScope(items, resourceFolder, StringInterpreter.GetFileName(files[i]), new int[] { i });
                    }
                }

                Program.LogFinish();

                return;
            }

            // If there are no resource files, call out an error message and then quit
            // Create an error message
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("FATAL ERROR: There are no resource files in " + resourceFolder);
            Console.ReadKey();
            throw new Exception("No resource files");
        }
Example #2
0
        static void LoadSubScopes(List <string> itemPack, string path)
        {
            // See if the path exists
            if (Directory.Exists(path))
            {
                // Load all the files in the directory
                string[] files = Directory.GetFiles(path);

                // Search through all the files to find all the pack files
                for (int i = 0; i < files.Length; i++)
                {
                    if (StringInterpreter.GetFileExtension(files[i]) == "pack")
                    {
                        LoadScope(itemPack, path, StringInterpreter.GetFileName(files[i]), new int[] { i });
                    }
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ERROR: A subscope folder that doesn't exist was trying to be loaded");
                Console.WriteLine("Subscope folder: " + path);
                Console.ReadKey();
                throw new Exception("Subscope folder does not exist");
            }
        }
Example #3
0
 static void LoadItems(List <string> itemPack, string[] lines, int beginLine, int endLine)
 {
     Console.ForegroundColor = ConsoleColor.White;
     for (int i = beginLine; i < endLine; i++)
     {
         if (lines[i].Length > 0 && lines[i][0] != '#' && lines[i][0] != '-')
         {
             // Find the name
             int    index    = 0;
             string itemName = StringInterpreter.GetName(lines[i], ref index);
             Program.LogLoading("item " + itemName);
             itemPack.Add(itemName);
             Program.LogFinish();
         }
     }
 }