2using System.Collections.Generic;
82 if ( !
reader.IsStartElement(
"State" ) )
throw new ArgumentException(
"File is corrupted or not a save state file." );
87 return (
T)
Load( obj, typeof(
T ), name );
90 public object Load(
object obj, Type type,
string name )
106 if (
reader.NodeType == XmlNodeType.None )
107 throw new IOException(
"Error loading object: reader not initialized" );
109 if (
reader.NodeType == XmlNodeType.Element )
113 if (
reader.Name !=
"Object" )
114 throw new XmlException(
"Unexpected element in save state file: " +
reader.Name );
116 string objName =
reader.GetAttribute(
"Name" );
117 if (
string.IsNullOrEmpty( objName ) )
118 throw new XmlException(
"Unnamed object in save state file" );
120 if ( name == objName )
126 if ( !
reader.IsEmptyElement )
129 else if (
reader.NodeType == XmlNodeType.EndElement )
132 if ( depth < 0 )
throw new InvalidOperationException(
"Error loading object: parse depth < 0" );
136 throw new KeyNotFoundException(
"Object with name " + name +
" could not be found in file " +
File.
Name );
virtual StorageFile Open(string fileName, bool write)
Avaa tiedoston.
object Load(object obj, Type type, string name)
LoadState(StorageFile file, string fileName)
List< String > objectsRead
T Load< T >(T obj, string name)
LoadState(FileManager manager, string fileName)
object LoadData(XmlReader reader, Type type, object obj)