示例#1
0
        public List <ArkTribeLogEntry> GetTribeLog(OnFindSteamProfile steamCallback)
        {
            //Open tribe log data.
            InlineProperty tribeLogData = GetPropertyByName("TribeLog");

            if (tribeLogData == null)
            {
                return(new List <ArkTribeLogEntry>());
            }
            InlineArrayProperty     arr    = (InlineArrayProperty)tribeLogData;
            List <ArkTribeLogEntry> output = new List <ArkTribeLogEntry>();

            foreach (string s in arr.data)
            {
                ArkTribeLogString str   = ArkTribeLogString.ParseArkML(s);
                ArkTribeLogEntry  entry = ArkTribeLogEntry.ParseEntry(str, linkedWorld.players, linkedWorld.dinos, tribeId, steamCallback);
                if (entry != null)
                {
                    output.Add(entry);
                }
            }

            //Reverse this because Ark saves it backwards
            output.Reverse();
            return(output);
        }
        public static InlineProperty ReadProperty(IOMemoryStream ms)
        {
            //Read type
            long         startPos = ms.position;
            ArkClassName name     = ms.ReadInlineArkClassname();

            if (name.IsNone())
            {
                return(null);
            }

            ArkClassName type = ms.ReadInlineArkClassname();

            //Rewind
            ms.position = startPos;

            //Based on the name of the prop, compare.
            InlineProperty p;

            switch (type.classname)
            {
            case "IntProperty":
                p = new InlineIntProperty(ms);
                break;

            case "StructProperty":
                p = new InlineStructProperty(ms);
                break;

            case "UInt64Property":
                p = new InlineUInt64Property(ms);
                break;

            case "StrProperty":
                p = new InlineStrProperty(ms);
                break;

            case "BoolProperty":
                p = new InlineBoolProperty(ms);
                break;

            case "ArrayProperty":
                p = new InlineArrayProperty(ms);
                break;

            case "ByteProperty":
                p = new InlineByteProperty(ms);
                break;

            case "UInt16Property":
                p = new InlineUInt16Property(ms);
                break;

            case "FloatProperty":
                p = new InlineFloatProperty(ms);
                break;

            case "DoubleProperty":
                p = new InlineDoubleProperty(ms);
                break;

            case "ObjectProperty":
                p = new InlineObjectProperty(ms);
                break;

            case "UInt32Property":
                p = new InlineUInt32Property(ms);
                break;

            default:
                //Default and read a base one, then skip
                p = new InlineProperty(ms);
                Console.WriteLine($"Unknown property {p.name.classname} ({p.type.classname}) at {p.startPos}. Attempting to skip; this will probably cause a crash.");
                ms.position += p.length;
                break;
            }
            return(p);
        }