Beispiel #1
0
        public EntityMobileSync Insert(EntityMobileSync data)
        {
            try
            {
                MobileSync dataNew = new MobileSync()
                {
                    PK_MobileSyncID = data.PK_MobileSyncID,
                    FK_UserID       = data.FK_UserID,
                    UserName        = data.UserName,
                    Name            = data.Name,
                    ODS             = data.ODS,
                    Type            = data.Type,
                    SyncDate        = data.SyncDate,
                    Status          = data.Status,
                    CreateDate      = data.CreateDate,
                    ModifyDate      = data.ModifyDate
                };
                base.DataContext.MobileSync.Add(dataNew);
                base.DataContext.SaveChanges();

                data.PK_MobileSyncID = dataNew.PK_MobileSyncID;

                return(data);
            }
            catch (DbException dbex)
            {
                throw dbex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            DeviceMonitor.Connected    += DeviceMonitor_Connected;
            DeviceMonitor.Disconnected += DeviceMonitor_Disconnected;

            Console.WriteLine("等待设备连接。。。");
            Console.ReadLine();

            Debug.Assert(dev != IntPtr.Zero);

            Lockdown lockdown = new Lockdown(dev);

            var name = lockdown.GetValue("DeviceName");

            Console.WriteLine(name);

            var sd_sync = lockdown.StartService("com.apple.mobilesync");

            //var dl = new DeviceLinkService(sd_sync);
            //dl.device_link_service_version_exchange(300, 100);

            MobileSync sync = new MobileSync(sd_sync);

            msyncclient.mobilesync_get_all_contacts(sync);
        }
Beispiel #3
0
 public eti_sync(IntPtr sd)
 {
     sync = new MobileSync(sd);
 }
Beispiel #4
0
        public static void mobilesync_get_all_contacts(MobileSync client)
        {
            PListArray array = new PListArray();

            array.Add(new PListString("SDMessageSyncDataClassWithDevice"));
            array.Add(new PListString("com.apple.Contacts"));
            array.Add(new PListString("---"));
            array.Add(new PListString("2009-01-09 18:03:58 +0100"));
            array.Add(new PListInteger(106));
            array.Add(new PListString("___EmptyParameterString___"));

            client.mobilesync_send(array);

            array = client.mobilesync_receive() as PListArray;

            array = new PListArray();
            array.Add(new PListString("SDMessageGetAllRecordsFromDevice"));
            array.Add(new PListString("com.apple.Contacts"));

            client.mobilesync_send(array);

            array = client.mobilesync_receive() as PListArray;

            PListString contact_node = array[1] as PListString;
            PListString switch_node  = array[0] as PListString;

            while (contact_node.Value == "com.apple.Contacts" &&
                   switch_node.Value != "SDMessageDeviceReadyToReceiveChanges")
            {
                array = new PListArray();
                array.Add(new PListString("SDMessageAcknowledgeChangesFromDevice"));
                array.Add(new PListString("com.apple.Contacts"));

                client.mobilesync_send(array);

                array = client.mobilesync_receive() as PListArray;

                contact_node = array[1] as PListString;
                switch_node  = array[0] as PListString;
            }

            array = new PListArray();
            array.Add(new PListString("DLMessagePing"));
            array.Add(new PListString("Preparing to get changes for device"));

            client.mobilesync_send(array);

            array = new PListArray();
            array.Add(new PListString("SDMessageProcessChanges"));
            array.Add(new PListString("com.apple.Contacts"));
            array.Add(create_new_contact());
            array.Add(new PListBool(false));

            PListDict dict = new PListDict();

            array.Add(dict);
            PListArray array2 = new PListArray();

            dict.Add("SyncDeviceLinkEntityNamesKey", array2);
            array2.Add(new PListString("com.apple.contacts.Contact"));
            array2.Add(new PListString("com.apple.contacts.Group"));

            dict.Add("SyncDeviceLinkAllRecordsOfPulledEntityTypeSentKey", new PListBool(true));

            ShowIPListElement(array);

            client.mobilesync_send(array);

            array = client.mobilesync_receive() as PListArray;


            PListArray finish = new PListArray();

            finish.Add(new PListString("SDMessageFinishSessionOnDevice"));
            finish.Add(new PListString("com.apple.Contacts"));

            client.mobilesync_send(finish);

            finish = client.mobilesync_receive() as PListArray;
        }