Exemple #1
0
 public static bool ReadFile(string location, CVSReader reader)
 {
     CVSReader.Init();
     XBinaryReader.Init();
     XInterfaceMgr.singleton.AttachInterface <IResourceHelp>(XCommon.singleton.XHash("XResourceHelper"), XResources.singleton);
     return(XResourceLoaderMgr.singleton.ReadFile(location, reader));
 }
        public void Load(String source, IProgressReport progress)
        {
            Debug.Assert(File.Exists(source));
            using (FileStream stream = File.OpenRead(source))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    String tag = reader.ReadString();
                    if (tag != StringRes.USER_PROFILE_TAG)
                    {
                        throw new FileFormatException(source, StringRes.NOT_USER_STATISTICS_FILE);
                    }

                    String version = reader.ReadString();
                    if (version != StringRes.USER_PROFILE_VERSION)
                    {
                        throw new FileFormatException(source, String.Format(StringRes.VERSION_NOT_SUPPORTED, version));
                    }

                    using (XBinaryReader xreader = new XBinaryReader(stream))
                    {
                        Load(xreader, progress);
                    }
                }
            }
        }
        public void Load(String source, IProgressReport progress)
        {
            Debug.Assert(File.Exists(source));
            using (FileStream stream = File.OpenRead(source))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    String tag = reader.ReadString();
                    if (tag != StringRes.VOCABULARY_TAG)
                    {
                        throw new FileFormatException(source, StringRes.NOT_VOCABULARY_FILE);
                    }

                    String version = reader.ReadString();
                    if (version != StringRes.VOCABULARY_VERSION)
                    {
                        throw new FileFormatException(source, String.Format(StringRes.VERSION_NOT_SUPPORTED, version));
                    }

                    using (XBinaryReader xreader = new XBinaryReader(stream))
                    {
                        PrepareLoad();
                        Load(xreader, progress);
                        FinalizeLoad();
                    }
                }
            }
            Modify(false);
        }