Inheritance: OsirisSerializable
Beispiel #1
0
        private Dictionary<uint, Goal> ReadGoals(OsiReader reader)
        {
            var goals = new Dictionary<uint, Goal>();
            var count = reader.ReadUInt32();
            while (count-- > 0)
            {
                var goal = new Goal();
                goal.Read(reader);
                goals.Add(goal.Index, goal);
            }

            return goals;
        }
Beispiel #2
0
        private void decompileStoryBtn_Click(object sender, EventArgs e)
        {
            if (Story == null)
            {
                MessageBox.Show("A story file must be loaded before exporting.", "Story export failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var debugPath = goalPath.Text + "/debug.log";
            using (var debugFile = new FileStream(debugPath, FileMode.Create, FileAccess.Write))
            using (var writer = new StreamWriter(debugFile))
            {
                Story.DebugDump(writer);
            }

            var unassignedPath = goalPath.Text + "/UNASSIGNED_RULES.txt";
            using (var goalFile = new FileStream(unassignedPath, FileMode.Create, FileAccess.Write))
            using (var writer = new StreamWriter(goalFile))
            {
                var dummyGoal = new Goal();
                dummyGoal.ExitCalls = new List<Call>();
                dummyGoal.InitCalls = new List<Call>();
                dummyGoal.ParentGoals = new List<uint>();
                dummyGoal.SubGoals = new List<uint>();
                dummyGoal.Name = "UNASSIGNED_RULES";
                dummyGoal.Index = 0;
                dummyGoal.MakeScript(writer, Story);
            }

            foreach (var goal in Story.Goals)
            {
                var filePath = goalPath.Text + "/" + goal.Value.Name + ".txt";
                using (var goalFile = new FileStream(filePath, FileMode.Create, FileAccess.Write))
                using (var writer = new StreamWriter(goalFile))
                {
                    goal.Value.MakeScript(writer, Story);
                }
            }

            MessageBox.Show("Story unpacked successfully.");
        }