Example #1
0
        public System.Collections.ICollection Deserialize(object obj)
        {
            // string data = File.ReadAllText("save.txt");
            MemoryStream fs = obj as MemoryStream;

            if (fs != null)
            {
                ComponentSerializationService componentSerializationService = _serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;

                SerializationStore serializationStore = componentSerializationService.LoadStore(fs);
                ICollection        collection         = componentSerializationService.Deserialize(serializationStore);
                fs.Close();
                return(collection);
            }
            else
            {
                SerializationStore serializationStore = obj as SerializationStore;

                if (serializationStore != null)
                {
                    ComponentSerializationService componentSerializationService = _serviceProvider.GetService(typeof(ComponentSerializationService)) as ComponentSerializationService;
                    ICollection collection = componentSerializationService.Deserialize(serializationStore);
                    return(collection);
                }
            }


            return(new object[] { });
        }