示例#1
0
        public OcadFile ReadFile()
        {
            using (var stream = new FileStream(_filePath, FileMode.Open))
            {
                var reader = new OcadStreamReader(stream);
                var parser = new BinaryParser<OcadFile>();

                return parser.Read(reader);
            }
        }
示例#2
0
        /*public OcadDiff GetDiff()
        {
            var diff = new OcadDiff();
            var compareLogic = new CompareLogic();
            compareLogic.Config.MaxDifferences = Int32.MaxValue;
            compareLogic.Config.IgnoreCollectionOrder = true;
            compareLogic.Config.CollectionMatchingSpec[typeof(CourseSettingObject)] = new [] { "Code" };
            diff.Report = compareLogic.Compare(GetProject(SourceFile), GetProject(TargetFile));
            return diff;
        }*/
        private OcadCourseSettingProject GetProject(string sourceFile)
        {
            OcadCourseSettingProject project = new OcadCourseSettingProject();
            using (var stream = new FileStream(sourceFile, FileMode.Open))
            {
                var reader = new OcadStreamReader(stream);
                var parser = new BinaryParser<OcadFile>();

                var file = parser.Read(reader);
                project.Load(file);
            }
            return project;
        }