Esempio n. 1
0
        //==========================================================================
        //Gets project files
        //==========================================================================
        public bool GetProjectFiles(ref List <Classes.MapClass> MapHandler, ref List <CodeFileClass> CodeHandler, CodeCompiler Compiler, ref List <SpriteSheet> SpriteHandler)
        {
            try
            {
                //CODE FILES
                int      i          = 0;
                string[] fileArray2 = Directory.GetFiles(ACFFilePath, "*.acf");
                foreach (string x in fileArray2)
                {
                    Loger.write(x, 0);

                    if (x == (ACFFilePath + "code_variables.acf"))
                    {
                        CodeHandler.Add(new CodeFileClass(ReadACFV("code_variables.acf"), "variables", "code_variables.acf"));
                        DataHandlerForProgram.variableFileID = i;
                        Loger.write("Loading of code variables complete!", 0);
                    }
                    else
                    {
                        if (ReadNCompileACF(Compiler, x))
                        {
                            Loger.write("Loading of code file complete!", 0);
                        }
                        else
                        {
                            Loger.write("Loading of code file failed!", 0);
                        }
                    }

                    i++;
                }

                //MAPS
                MapHandler.Clear();

                string[] fileArray = Directory.GetFiles(MapsFilePath, "*.mxt");

                foreach (string x in fileArray)
                {
                    Loger.write(x, 0);

                    Classes.MapClass MapHandlerFiller = new Classes.MapClass()
                    {
                        Loger = Loger,
                    };
                    LoadMap(x, ref MapHandlerFiller);
                    MapHandler.Add(MapHandlerFiller);
                }

                //Sprites
                SpriteHandler.Clear();

                string[] fileArray3 = Directory.GetFiles(SpriteFilePath, "*.csf");

                foreach (string x in fileArray3)
                {
                    Loger.write(x, 0);
                    Classes.SpriteSheet SpriteSheetFiller = new Classes.SpriteSheet();
                    LoadSpriteSheet(x, ref SpriteSheetFiller);
                    SpriteHandler.Add(SpriteSheetFiller);
                }

                return(true);
            }
            catch (DirectoryNotFoundException)
            {
                if (!Directory.Exists(SpriteFilePath))
                {
                    Directory.CreateDirectory(SpriteFilePath);
                }
                if (!Directory.Exists(MapsFilePath))
                {
                    Directory.CreateDirectory(MapsFilePath);
                }
                if (!Directory.Exists(ACFFilePath))
                {
                    Directory.CreateDirectory(ACFFilePath);
                }
                return(false);
            }
            catch (Exception e)
            {
                Loger.write(e.ToString(), 2);
                return(false);
            }
        }
Esempio n. 2
0
 //==========================================================================
 //Resets after saving
 //==========================================================================
 private void Reset()
 {
     FillerSprite          = new Classes.SpriteSheet();
     SpriteViewer.Compiled = false;
 }