Exemplo n.º 1
0
        public void Write(OsiWriter writer)
        {
            writer.Write(Index);
            writer.Write(Name);
            writer.Write(SubGoalCombination);

            writer.Write((UInt32)ParentGoals.Count);
            foreach (var goalIndex in ParentGoals)
            {
                writer.Write(goalIndex);
            }

            writer.Write((UInt32)SubGoals.Count);
            foreach (var goalIndex in SubGoals)
            {
                writer.Write(goalIndex);
            }

            writer.Write(Unknown);

            if (writer.MajorVersion > 1 || (writer.MajorVersion == 1 && writer.MinorVersion >= 1))
            {
                writer.WriteList <Call>(InitCalls);
                writer.WriteList <Call>(ExitCalls);
            }
        }
Exemplo n.º 2
0
 public override void Write(OsiWriter writer)
 {
     base.Write(writer);
     writer.Write(Index);
     writer.Write(Unused);
     writer.Write(Adapted);
 }
Exemplo n.º 3
0
        public virtual void Write(OsiWriter writer)
        {
            writer.Write((byte)48);
            writer.Write(TypeId);
            switch ((Type)TypeId)
            {
            case Type.Unknown:
                break;

            case Type.Integer:
                writer.Write(IntValue);
                break;

            case Type.Float:
                writer.Write(FloatValue);
                break;

            case Type.String:
                writer.Write(StringValue != null);
                if (StringValue != null)
                {
                    writer.Write(StringValue);
                }
                break;

            default:
                writer.Write(StringValue);
                break;
            }
        }
Exemplo n.º 4
0
 public override void Write(OsiWriter writer)
 {
     base.Write(writer);
     writer.Write(IsValid);
     writer.Write(OutParam);
     writer.Write(IsAType);
 }
Exemplo n.º 5
0
 public void Write(OsiWriter writer)
 {
     writer.Write((byte)Types.Count);
     foreach (var type in Types)
     {
         writer.Write(type);
     }
 }
Exemplo n.º 6
0
 public void Write(OsiWriter writer)
 {
     writer.Write((byte)Columns.Count);
     foreach (var column in Columns)
     {
         column.Write(writer);
     }
 }
Exemplo n.º 7
0
 public virtual void Write(OsiWriter writer)
 {
     DatabaseRef.Write(writer);
     writer.Write(Name);
     if (Name.Length > 0)
     {
         writer.Write(NameIndex);
     }
 }
Exemplo n.º 8
0
 public void Write(OsiWriter writer)
 {
     writer.Write(Name);
     writer.Write(Type);
     writer.Write(Key1);
     writer.Write(Key2);
     writer.Write(Key3);
     writer.Write(Key4);
 }
Exemplo n.º 9
0
 public void Write(OsiWriter writer)
 {
     writer.Write((byte)Logical.Count);
     foreach (var logical in Logical)
     {
         writer.Write((byte)logical.Key);
         logical.Value.Write(writer);
     }
 }
Exemplo n.º 10
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            ParentRef.Write(writer);
            AdapterRef.Write(writer);

            RelDatabaseNodeRef.Write(writer);
            RelJoin.Write(writer);
            writer.Write(RelDatabaseIndirection);
        }
Exemplo n.º 11
0
 public void Write(OsiWriter writer)
 {
     writer.Write(Line);
     writer.Write(Unknown1);
     writer.Write(Unknown2);
     NodeRef.Write(writer);
     writer.Write((byte)Type);
     writer.Write(GUID);
     Name.Write(writer);
 }
Exemplo n.º 12
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            writer.Write(Value1Index);
            writer.Write(Value2Index);

            Value1.Write(writer);
            Value2.Write(writer);
            writer.Write((UInt32)RelOp);
        }
Exemplo n.º 13
0
        public void Write(OsiWriter writer)
        {
            writer.Write(Name);
            writer.Write(Index);

            if (writer.Ver >= OsiVersion.VerTypeAliases)
            {
                writer.Write(Alias);
            }
        }
Exemplo n.º 14
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            writer.Write(LeftValueIndex);
            writer.Write(RightValueIndex);

            LeftValue.Write(writer);
            RightValue.Write(writer);
            writer.Write((UInt32)RelOp);
        }
Exemplo n.º 15
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            ParentRef.Write(writer);
            AdapterRef.Write(writer);

            RelDatabaseRef.Write(writer);
            RelDatabase.Write(writer);
            writer.Write(RelDatabaseFlag);
        }
Exemplo n.º 16
0
        public void Write(OsiWriter writer)
        {
            writer.Write(Name);

            writer.Write((UInt32)OutParamMask.Count);
            foreach (var b in OutParamMask)
            {
                writer.Write(b);
            }

            Parameters.Write(writer);
        }
Exemplo n.º 17
0
 public void Write(OsiWriter writer)
 {
     writer.Write(Line);
     writer.Write(ConditionReferences);
     writer.Write(ActionReferences);
     NodeRef.Write(writer);
     writer.Write((byte)Type);
     writer.Write(Meta1);
     writer.Write(Meta2);
     writer.Write(Meta3);
     writer.Write(Meta4);
     Name.Write(writer);
 }
Exemplo n.º 18
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            LeftParentRef.Write(writer);
            RightParentRef.Write(writer);
            Adapter1Ref.Write(writer);
            Adapter2Ref.Write(writer);

            Database1Ref.Write(writer);
            Database1.Write(writer);
            writer.Write(Database1Flag);

            Database2Ref.Write(writer);
            Database2.Write(writer);
            writer.Write(Database2Flag);
        }
Exemplo n.º 19
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            LeftParentRef.Write(writer);
            RightParentRef.Write(writer);
            LeftAdapterRef.Write(writer);
            RightAdapterRef.Write(writer);

            LeftDatabaseRef.Write(writer);
            LeftDatabase.Write(writer);
            writer.Write(LeftDatabaseFlag);

            RightDatabaseRef.Write(writer);
            RightDatabase.Write(writer);
            writer.Write(RightDatabaseFlag);
        }
Exemplo n.º 20
0
Arquivo: Join.cs Projeto: Urdale/lslib
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            LeftParentRef.Write(writer);
            RightParentRef.Write(writer);
            LeftAdapterRef.Write(writer);
            RightAdapterRef.Write(writer);

            LeftDatabaseNodeRef.Write(writer);
            LeftDatabaseJoin.Write(writer);
            writer.Write(LeftDatabaseIndirection);

            RightDatabaseNodeRef.Write(writer);
            RightDatabaseJoin.Write(writer);
            writer.Write(RightDatabaseIndirection);
        }
Exemplo n.º 21
0
        public void Write(Stream stream, Story story)
        {
            using (Writer = new OsiWriter(stream))
            {
                Writer.MajorVersion = story.MajorVersion;
                Writer.MinorVersion = story.MinorVersion;

                var header = new OsirisHeader();
                header.Version      = "Osiris save file dd. 02/10/15 12:44:13. Version 1.5.";
                header.MajorVersion = story.MajorVersion;
                header.MinorVersion = story.MinorVersion;
                header.BigEndian    = false;
                header.Unused       = 0;
                // Debug flags used in D:OS EE
                header.DebugFlags = 0x000CA010;
                header.Write(Writer);

                if (Writer.MajorVersion > 1 || (Writer.MajorVersion == 1 && Writer.MinorVersion > 7))
                {
                    var msg = String.Format(
                        "Osiris version v{0}.{1} unsupported; this tool supports versions up to v1.7.",
                        Writer.MajorVersion, Writer.MinorVersion
                        );
                    throw new InvalidDataException(msg);
                }

                if (Writer.MajorVersion > 1 || (Writer.MajorVersion == 1 && Writer.MinorVersion >= 4))
                {
                    Writer.Scramble = 0xAD;
                }


                if (Writer.MajorVersion > 1 || (Writer.MajorVersion == 1 && Writer.MinorVersion >= 5))
                {
                    WriteTypes(story.Types);
                }

                Writer.WriteList(story.DivObjects);
                Writer.WriteList(story.Functions);
                WriteNodes(story.Nodes);
                WriteAdapters(story.Adapters);
                WriteDatabases(story.Databases);
                WriteGoals(story.Goals);
                Writer.WriteList(story.GlobalActions);
            }
        }
Exemplo n.º 22
0
        public void Write(OsiWriter writer)
        {
            writer.Write(Index);
            writer.Write(Name);
            writer.Write(SubGoalCombination);

            writer.WriteList <GoalReference>(ParentGoals);
            writer.WriteList <GoalReference>(SubGoals);

            writer.Write(Flags);

            if (writer.Ver >= OsiVersion.VerAddInitExitCalls)
            {
                writer.WriteList <Call>(InitCalls);
                writer.WriteList <Call>(ExitCalls);
            }
        }
Exemplo n.º 23
0
        public void Write(OsiWriter writer)
        {
            Constants.Write(writer);

            writer.Write((byte)LogicalIndices.Count);
            foreach (var index in LogicalIndices)
            {
                writer.Write(index);
            }

            writer.Write((byte)LogicalToPhysicalMap.Count);
            foreach (var pair in LogicalToPhysicalMap)
            {
                writer.Write(pair.Key);
                writer.Write(pair.Value);
            }
        }
Exemplo n.º 24
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            writer.WriteList <Call>(Calls);

            writer.Write((byte)Variables.Count);
            foreach (var variable in Variables)
            {
                writer.Write((byte)1);
                variable.Write(writer);
            }

            writer.Write(Line);
            if (writer.MajorVersion > 1 || (writer.MajorVersion == 1 && writer.MinorVersion >= 6))
            {
                writer.Write(IsQuery);
            }
        }
Exemplo n.º 25
0
        public override void Write(OsiWriter writer)
        {
            base.Write(writer);
            writer.WriteList <Call>(Calls);

            writer.Write((byte)Variables.Count);
            foreach (var variable in Variables)
            {
                writer.Write((byte)1);
                variable.Write(writer);
            }

            writer.Write(Line);
            if (writer.Ver >= OsiVersion.VerAddQuery)
            {
                writer.Write(IsQuery);
            }
        }
Exemplo n.º 26
0
        public void Write(OsiWriter writer)
        {
            writer.Write(Name);
            if (Name.Length > 0)
            {
                writer.Write(Parameters != null);
                if (Parameters != null)
                {
                    writer.Write((byte)Parameters.Count);
                    foreach (var param in Parameters)
                    {
                        writer.Write(param is Variable);
                        param.Write(writer);
                    }
                }

                writer.Write(Negate);
            }

            writer.Write(GoalIdOrDebugHook);
        }
Exemplo n.º 27
0
        public void Write(OsiWriter writer)
        {
            writer.Write((byte)0);
            writer.Write(Version);
            writer.Write(MajorVersion);
            writer.Write(MinorVersion);
            writer.Write(BigEndian);
            writer.Write(Unused);

            if (Ver >= OsiVersion.VerAddVersionString)
            {
                var    versionString = String.Format("{0}.{1}", MajorVersion, MinorVersion);
                var    versionBytes  = Encoding.UTF8.GetBytes(versionString);
                byte[] version       = new byte[0x80];
                versionBytes.CopyTo(version, 0);
                writer.Write(version, 0, version.Length);
            }

            if (Ver >= OsiVersion.VerAddDebugFlags)
            {
                writer.Write(DebugFlags);
            }
        }
Exemplo n.º 28
0
        public void Write(Stream stream, Story story)
        {
            using (Writer = new OsiWriter(stream))
            {
                foreach (var node in story.Nodes)
                {
                    node.Value.PreSave(story);
                }

                Writer.MajorVersion = story.MajorVersion;
                Writer.MinorVersion = story.MinorVersion;

                var header = new SaveFileHeader();
                if (Writer.Ver >= OsiVersion.VerExternalStringTable)
                {
                    header.Version = "Osiris save file dd. 03/30/17 07:28:20. Version 1.8.";
                }
                else
                {
                    header.Version = "Osiris save file dd. 02/10/15 12:44:13. Version 1.5.";
                }
                header.MajorVersion = story.MajorVersion;
                header.MinorVersion = story.MinorVersion;
                header.BigEndian    = false;
                header.Unused       = 0;
                // Debug flags used in D:OS EE and D:OS 2
                header.DebugFlags = 0x000C10A0;
                header.Write(Writer);

                if (Writer.Ver > OsiVersion.VerLastSupported)
                {
                    var msg = String.Format(
                        "Osiris version v{0}.{1} unsupported; this tool supports saving up to version 1.11.",
                        Writer.MajorVersion, Writer.MinorVersion
                        );
                    throw new InvalidDataException(msg);
                }

                if (Writer.Ver >= OsiVersion.VerScramble)
                {
                    Writer.Scramble = 0xAD;
                }

                if (Writer.Ver >= OsiVersion.VerAddTypeMap)
                {
                    // Don't export builtin types, only externally declared ones
                    var types = story.Types.Values.Where(t => !t.IsBuiltin).ToList();
                    WriteTypes(types);
                }

                // TODO: regenerate string table?
                if (Writer.Ver >= OsiVersion.VerExternalStringTable && Writer.Ver < OsiVersion.VerRemoveExternalStringTable)
                {
                    WriteStrings(story.ExternalStringTable);
                }

                Writer.WriteList(story.DivObjects);
                Writer.WriteList(story.Functions);
                WriteNodes(story.Nodes);
                WriteAdapters(story.Adapters);
                WriteDatabases(story.Databases);
                WriteGoals(story.Goals);
                Writer.WriteList(story.GlobalActions);

                foreach (var node in story.Nodes)
                {
                    node.Value.PostSave(story);
                }
            }
        }
Exemplo n.º 29
0
        public virtual void Write(OsiWriter writer)
        {
            // TODO: Is the == 0x31 case ever used when reading?
            writer.Write((byte)'0');

            uint writtenTypeId = TypeId;
            bool aliased       = false;
            uint alias;

            if (writer.TypeAliases.TryGetValue(TypeId, out alias))
            {
                aliased       = true;
                writtenTypeId = alias;
            }

            writer.Write(TypeId);
            if (writer.Ver < OsiVersion.VerEnhancedTypes)
            {
                // Make sure that we're serializing using the D:OS2 type ID
                // (The alias map contains the D:OS 1 ID)
                writtenTypeId = ConvertOS1ToOS2Type(writtenTypeId);
            }

            switch ((Type)writtenTypeId)
            {
            case Type.Unknown:
                break;

            case Type.Integer:
                writer.Write(IntValue);
                break;

            case Type.Integer64:
                // D:OS 1 aliased strings didn't have a flag byte
                if (writer.Ver >= OsiVersion.VerEnhancedTypes)
                {
                    writer.Write(Int64Value);
                }
                else
                {
                    writer.Write((int)Int64Value);
                }

                break;

            case Type.Float:
                writer.Write(FloatValue);
                break;

            case Type.String:
            case Type.GuidString:
                if (!aliased || (writer.Ver >= OsiVersion.VerEnhancedTypes))
                {
                    writer.Write(StringValue != null);
                }

                if (StringValue != null)
                {
                    writer.Write(StringValue);
                }
                break;

            default:
                writer.Write(StringValue);
                break;
            }
        }
Exemplo n.º 30
0
 public override void Write(OsiWriter writer)
 {
     base.Write(writer);
     NextNode.Write(writer);
 }