Exemple #1
0
        public virtual void MakeScript(TextWriter writer, Story story, Tuple tuple, bool printTypes = false)
        {
            var builtinTypeId = story.FindBuiltinTypeId(TypeId);

            switch ((Type)builtinTypeId)
            {
            case Type.None:
                throw new InvalidDataException("Script cannot contain unknown values");

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

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

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

            case Type.String:
                writer.Write("\"{0}\"", StringValue);
                break;

            case Type.GuidString:
                writer.Write(StringValue);
                break;

            default:
                throw new Exception("Unsupported builtin type ID");
            }
        }
Exemple #2
0
        public virtual void DebugDump(TextWriter writer, Story story)
        {
            var builtinTypeId = story.FindBuiltinTypeId(TypeId);

            switch ((Type)builtinTypeId)
            {
            case Type.None:
                writer.Write("<unknown>");
                break;

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

            case Type.Integer64:
                writer.Write(Int64Value);
                break;

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

            case Type.String:
                writer.Write("'{0}'", StringValue);
                break;

            case Type.GuidString:
                writer.Write(StringValue);
                break;

            default:
                throw new Exception("Unsupported builtin type ID");
            }
        }
Exemple #3
0
 private void WriteTypes(IList <OsirisType> types, Story story)
 {
     Writer.Write((UInt32)types.Count);
     foreach (var type in types)
     {
         type.Write(Writer);
         if (type.Alias != 0)
         {
             Writer.TypeAliases.Add(type.Index, story.FindBuiltinTypeId(type.Index));
         }
     }
 }