Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            OcadCourseSettingProject project = new OcadCourseSettingProject();
            using (var stream = new FileStream(@"D:\temp\testmap.ocd", FileMode.Open))
            {
                var reader = new OcadStreamReader(stream);
                var parser = new BinaryParser<OcadFile>();

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

            foreach (var symbol in project.Symbols)
            {
                Console.WriteLine(symbol.Description);
            }
        }
Ejemplo n.º 3
0
        public OcadBaseProject ReadProject()
        {
            var file = ReadFile();
            OcadBaseProject project;
            if (file.FileHeader.FileType == 0)
            {
                project = new OcadOMap();
            }
            else if (file.FileHeader.FileType == 1)
            {
                project = new OcadCourseSettingProject();
            }
            else
            {
                throw new Exception("Only normal OCAD maps or course setting files are supported.");
            }

            project.Load(file);
            return project;
        }