public Quest ReadQuest(string fileName)
        {
            Quest quest = null;

            using (var stream = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                quest = FileQuest.Load(stream);
                var streamPos = stream.Position;
                AssertEqual(streamPos, stream.Length);
            }
            return(quest);
        }
예제 #2
0
        public void TestPlay()
        {
            var   filePath = RootTestDirectory + @"\s_ranger_q\Fishing3.qm";
            Quest quest    = null;

            using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                quest = FileQuest.Load(stream);
                var streamPos = stream.Position;
                if (streamPos != stream.Length)
                {
                    throw new Exception("Not all Read!");
                }
            }

            var player = new Player();

            player.Play(quest);
        }
        private void OpenCommandExecute()
        {
            var ofd = new OpenFileDialog
            {
                Filter          = "QuestFiles | *.qm",
                Multiselect     = false,
                CheckFileExists = true,
                CheckPathExists = true,
            };

            var dialogResult = ofd.ShowDialog();

            if (!dialogResult.HasValue || !dialogResult.Value)
            {
                return;
            }

            using (var stream = File.OpenRead(ofd.FileName))
            {
                Player.Play(FileQuest.Load(stream));
            }
        }