Beispiel #1
0
        public RoomModel(string roomName, DomainModel model)
        {
            FunctionCalls = new FunctionCallsCollection();            //functionCalls;
            FileName      = RoomModel.ConvertRoomNameToFullPath(roomName);
            RawFileName   = roomName;


            //try loading pre-exiting file first. If you can't,
            //then create one from the default text file asset
            string roomPath     = model.DomainRootDir + System.IO.Path.DirectorySeparatorChar.ToString() + model.IncludeFile.StripDeadSoulsPath(DeadSouls.Globals.DomainDirectories.Room);
            string fullFilePath = roomPath + System.IO.Path.DirectorySeparatorChar.ToString() + RawFileName;

            if (System.IO.File.Exists(fullFilePath))
            {
                Code.LoadLPC(fullFilePath);
            }
            else
            {
                //failed to load
                throw new DomainModelException("Could not find file for room: " + roomName);
            }

            this.EditorState.Reset();
            PullDataFromCode();
        }
Beispiel #2
0
        private List <string> BuildListOfAllExternalDomains()
        {
            List <string> files = new List <string>(System.IO.Directory.GetFiles(Globals.Dirs.DomainReferences, "*.xml"));

            for (int index = 0; index < files.Count; index++)
            {
                files[index] = DomainModel.ConvertDomainFileToDomainName(files[index]);
            }

            return(files);
        }
Beispiel #3
0
        static int Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            //create instances
            DomainModel      Domain     = new DomainModel();
            DomainViewForm   Form       = new DomainViewForm();
            DomainController Controller = new DomainController(Domain, Form);

            //a-a-a-a-and begin!
            Application.Run(Form);
            return(1);
        }
Beispiel #4
0
        public RoomModel(FunctionCallsCollection functionCalls, string fileName, DomainModel model, RoomType type)
        {
            FunctionCalls = functionCalls;
            FileName      = fileName;
            RawFileName   = RoomModel.ConvertFullPathToRoomName(fileName);

            //try loading pre-exiting file first. If you can't,
            //then create one from the default text file asset
            string roomPath     = model.DomainRootDir + System.IO.Path.DirectorySeparatorChar.ToString() + model.IncludeFile.StripDeadSoulsPath(DeadSouls.Globals.DomainDirectories.Room);
            string fullFilePath = roomPath + System.IO.Path.DirectorySeparatorChar.ToString() + RawFileName;

            if (System.IO.File.Exists(fullFilePath))
            {
                Code.LoadLPC(fullFilePath);
            }
            else
            {
                switch (type)
                {
                case RoomType.Normal:           { Code.CreateLPCFromScratch(DeadSoulsObjectType.Room); break; }

                case RoomType.Shop:             { Code.CreateLPCFromScratch(DeadSoulsObjectType.Shop); break; }

                case RoomType.Instance:         { Code.CreateLPCFromScratch(DeadSoulsObjectType.InstanceRoom); break; }

                case RoomType.PoliceStation:    { Code.CreateLPCFromScratch(DeadSoulsObjectType.PoliceOffice); break; }

                case RoomType.JailCell:    { Code.CreateLPCFromScratch(DeadSoulsObjectType.JailCell); break; }

                default:                        { Code.CreateLPCFromScratch(DeadSoulsObjectType.Room); break; }
                }
                //Code.CreateLPCFromScratch(DeadSoulsObjectType.Room);
            }

            //PushDataToCode();
        }
Beispiel #5
0
        public void AddDomainReference(string domainFile)
        {
            //make sure the name has no extra directory info, is lowercase and without spaces,
            //and doesn't have an file extension
            domainFile = DomainModel.ConvertDomainFileToDomainName(domainFile);

            this.Include.AddDomainReference(domainFile, domainFile);
            //this.DomainFileReferences.Add(new DomainReference(domainFile));


            //as much as I hate using messageboxes in the model, I really need to display this without
            //making the domain file parser stop it's loop
            try {
                this.DomainFileReferences.Add(this.ParseXmlFileReferences(domainFile));
            }
            catch (DomainModelException exception)
            {
                System.Windows.Forms.MessageBox.Show(exception.Message);
            }

            //gotta open up the xml file and see it's guts. Then import all of those items
            //into this domain's lists.
            return;
        }