Esempio n. 1
0
        public override void SyncBack(IProgressMonitor monitor, XcodeSyncBackContext context)
        {
            monitor.Log.WriteLine("Queueing sync-back of changes made to the {0} class from Xcode.", Type.CliName);

            var objcType = context.ProjectInfo.GetType(Type.ObjCName);
            var hFile    = GetObjCHeaderPath(context);

            if (objcType == null)
            {
                context.ReportError("Missing Objective-C type: {0}", Type.ObjCName);
                return;
            }

            if (!objcType.IsUserType)
            {
                context.ReportError("Parsed Objective-C type '{0}' is not a user type", objcType);
                return;
            }

            var parsed = NSObjectInfoService.ParseHeader(hFile);

            if (parsed == null)
            {
                context.ReportError("Error parsing Objective-C type: {0}", Type.ObjCName);
                return;
            }

            if (parsed.ObjCName != objcType.ObjCName)
            {
                context.ReportError("Parsed type name '{0}' does not match original: {1}",
                                    parsed.ObjCName, objcType.ObjCName);
                return;
            }

            parsed.MergeCliInfo(objcType);

            context.TypeSyncJobs.Add(XcodeSyncObjcBackJob.UpdateType(parsed, objcType.GetDesignerFile()));
        }
Esempio n. 2
0
        public override void SyncBack(XcodeSyncBackContext context)
        {
            var hFile    = context.ProjectDir.Combine(Type.ObjCName + ".h");
            var objcType = context.ProjectInfo.GetType(Type.ObjCName);

            if (objcType == null)
            {
                context.ReportError("Missing objc type {0}", Type.ObjCName);
                return;
            }

            if (!objcType.IsUserType)
            {
                context.ReportError("Parsed type {0} is not a user type", objcType);
                return;
            }

            var parsed = NSObjectInfoService.ParseHeader(hFile);

            if (parsed == null)
            {
                context.ReportError("Error parsing objc type {0}", Type.ObjCName);
                return;
            }

            if (parsed.ObjCName != objcType.ObjCName)
            {
                context.ReportError("Parsed type name {0} does not match original {1}",
                                    parsed.ObjCName, objcType.ObjCName);
                return;
            }

            parsed.MergeCliInfo(objcType);

            context.TypeSyncJobs.Add(XcodeSyncObjcBackJob.UpdateType(parsed, objcType.GetDesignerFile()));
        }