示例#1
0
        public bool InsertRace(string _name, string _author, List <Vector3> pos)
        {
            int id = -1;

            using (var db = raceDbFactory.Open())
            {
                if (!db.Exists <RaceTable>(new { name = _name, author = _author }))
                {
                    RaceTable newRecord = new RaceTable
                    {
                        name   = _name,
                        author = _author
                    };

                    db.Save(newRecord, true);
                    id = newRecord.id;
                }
            }

            if (id != -1)
            {
                using (var db = cpDbFactory.Open())
                {
                    for (int i = 0; i < pos.Count; i++)
                    {
                        CheckpointTable newCp = new CheckpointTable
                        {
                            race_id = id,
                            cp_idx  = i,
                            pos_x   = pos[i].X,
                            pos_y   = pos[i].Y,
                            pos_z   = pos[i].Z
                        };

                        db.Save(newCp);
                    }
                }

                return(true);
            }

            return(false);
        }
示例#2
0
        public static ColiFile Deserialize(FZReader reader)
        {
            var file = new ColiFile();

            file.header               = reader.ReadBytes(8);
            file.checkpointTable      = CheckpointTable.Deserialize(reader);
            file.unknownTable1        = UnknownTable1.Deserialize(reader);
            file.objectCollisionTable = ObjectCollisionTable.Deserialize(reader);
            file.unknown1             = reader.ReadInt32Array(12);
            file.objectTable          = ObjectTable.Deserialize(reader);
            file.unknown2             = reader.ReadInt32();
            file.unknown3             = reader.ReadInt32Array(2);
            file.meshCollisionTable   = MeshCollisionTable.Deserialize(reader);
            file.unknownTable2        = UnknownTable2.Deserialize(reader);
            file.unknown4             = reader.ReadInt32Array(4);
            file.unknownOffset1       = reader.ReadInt32();
            file.unknown5             = reader.ReadInt32Array(2);
            file.unknownOffset2       = reader.ReadInt32();
            file.unknownTable3        = UnknownTable3.Deserialize(reader);
            file.unknownTable4        = UnknownTable4.Deserialize(reader);
            file.unknown6             = reader.ReadInt32Array(23);

            return(file);
        }