Exemple #1
0
        public INomadSerializer GetSerializer()
        {
            if (CustomSerializer != null)
            {
                return(CustomSerializer);
            }

            INomadSerializer serializer = null;

            var filter = GetFilter();

            if (filter != null)
            {
                serializer        = ResourceFactory.GetSerializer(filter);
                serializer.Format = ResourceFactory.GetFormat(filter.Version);
            }

            // need generic serializer?
            if (serializer == null)
            {
                serializer = new NomadResourceSerializer();
            }

            return(serializer);
        }
Exemple #2
0
        protected NomadObject ReadFCBChunk(BinaryStream stream, NomadObject parent)
        {
            var fcbSize = stream.ReadInt32();
            var fcbData = stream.ReadBytes(fcbSize);

            using (var bs = new BinaryStream(fcbData))
            {
                var serializer = new NomadResourceSerializer();
                var root       = serializer.Deserialize(bs);

                if (parent != null)
                {
                    parent.Children.Add(root);
                }

                return(root);
            }
        }
Exemple #3
0
        public static INomadSerializer GetSerializer(NomadFileInfo info)
        {
            var filter = ResourceFactory.GetFilter(info);

            INomadSerializer serializer = new NomadResourceSerializer();

            if (filter != null)
            {
                Debug.WriteLine($"Found filter for binary resource '{info.RootId}'.");

                serializer = ResourceFactory.GetSerializer(filter);
            }
            else
            {
                Debug.WriteLine($"Could not find filter for binary resource '{info.RootId}'.");

                // use a generic serializer
                return(new NomadGenericResourceSerializer(info));
            }

            serializer.Format = ResourceFactory.GetFormat(info.Version);

            return(serializer);
        }