コード例 #1
0
        public virtual bool ConvertHints()
        {
            var result = true;

            try
            {
                var hintDscFile = Globals.Path.Combine(AdventureFolderPath, "HINTS.DSC");

                foreach (var hint in HintList)
                {
                    using (var hintDscStream = Globals.File.OpenRead(hintDscFile))
                    {
                        var hintDscFlr = new FixedLengthReader(hintDscStream, (hint._hptr - 1) * 255, true);

                        for (var i = 0; i < hint._nh; i++)
                        {
                            var answer = new EDXDesc();

                            hintDscFlr.read(answer);

                            hint.AnswerList.Add(answer);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;

                result = false;
            }

            return(result);
        }
コード例 #2
0
        public virtual bool ConvertAdventures()
        {
            var result = true;

            try
            {
                var roomDatFile = Globals.Path.Combine(AdventureFolderPath, "ROOMS.DAT");

                var roomDscFile = Globals.Path.Combine(AdventureFolderPath, "ROOMS.DSC");

                var artifactDatFile = Globals.Path.Combine(AdventureFolderPath, "ARTIFACT.DAT");

                var artifactDscFile = Globals.Path.Combine(AdventureFolderPath, "ARTIFACT.DSC");

                var monsterDatFile = Globals.Path.Combine(AdventureFolderPath, "MONSTERS.DAT");

                var monsterDscFile = Globals.Path.Combine(AdventureFolderPath, "MONSTERS.DSC");

                var effectDscFile = Globals.Path.Combine(AdventureFolderPath, "EFFECT.DSC");

                foreach (var adventure in AdventureList)
                {
                    using (var roomDatStream = Globals.File.OpenRead(roomDatFile))
                    {
                        var roomDatFlr = new FixedLengthReader(roomDatStream, (adventure._rptr - 1) * 101, true);

                        using (var roomDscStream = Globals.File.OpenRead(roomDscFile))
                        {
                            var roomDscFlr = new FixedLengthReader(roomDscStream, (adventure._rptr - 1) * 255, true);

                            for (var i = 0; i < adventure._nr; i++)
                            {
                                var room = new EDXRoom();

                                roomDatFlr.read(room);

                                var desc = new EDXDesc();

                                roomDscFlr.read(desc);

                                room._rdesc = desc._text;

                                adventure.RoomList.Add(room);
                            }
                        }
                    }

                    using (var artifactDatStream = Globals.File.OpenRead(artifactDatFile))
                    {
                        var artifactDatFlr = new FixedLengthReader(artifactDatStream, (adventure._aptr - 1) * 51, true);

                        using (var artifactDscStream = Globals.File.OpenRead(artifactDscFile))
                        {
                            var artifactDscFlr = new FixedLengthReader(artifactDscStream, (adventure._aptr - 1) * 255, true);

                            for (var i = 0; i < adventure._na; i++)
                            {
                                var artifact = new EDXArtifact();

                                artifactDatFlr.read(artifact);

                                var desc = new EDXDesc();

                                artifactDscFlr.read(desc);

                                artifact._artdesc = desc._text;

                                adventure.ArtifactList.Add(artifact);
                            }
                        }
                    }

                    using (var monsterDatStream = Globals.File.OpenRead(monsterDatFile))
                    {
                        var monsterDatFlr = new FixedLengthReader(monsterDatStream, (adventure._mptr - 1) * 61, true);

                        using (var monsterDscStream = Globals.File.OpenRead(monsterDscFile))
                        {
                            var monsterDscFlr = new FixedLengthReader(monsterDscStream, (adventure._mptr - 1) * 255, true);

                            for (var i = 0; i < adventure._nm; i++)
                            {
                                var monster = new EDXMonster();

                                monsterDatFlr.read(monster);

                                var desc = new EDXDesc();

                                monsterDscFlr.read(desc);

                                monster._mdesc = desc._text;

                                adventure.MonsterList.Add(monster);
                            }
                        }
                    }

                    using (var effectDscStream = Globals.File.OpenRead(effectDscFile))
                    {
                        var effectDscFlr = new FixedLengthReader(effectDscStream, (adventure._eptr - 1) * 255, true);

                        for (var i = 0; i < adventure._ne; i++)
                        {
                            var effect = new EDXDesc();

                            effectDscFlr.read(effect);

                            adventure.EffectList.Add(effect);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorMessage = ex.Message;

                result = false;
            }

            return(result);
        }