Giter Club home page Giter Club logo

mobiledevices's Introduction

MobileDevices

使用本机协议与 iOS 设备上的服务进行通信的库。

Build NuGet

Features

MobileDevices 是一个 .NET 库,它允许您使用 .NET 语言(例如 C# 或 Visual Basic)与 Windows、macOS 和 Linux 上的 iOS 设备进行交互。它借鉴于 libimobiledevice 库。

有许多基于设备服务协议实现的客户端:

  • 访问设备的文件系统
  • 检索有关设备的信息并修改各种设置
  • 安装、删除、列出和基本管理应用程序
  • 使用官方服务器激活设备
  • 检索崩溃报告
  • 检索各种诊断信息
  • 转发设备通知

Installing

你可以将 MobileDevices 安装为NuGet package

PM> Install-Package MobileDevices 

Getting Started

MobileDevices 不直接与您的 iOS 设备通信,而是通过Apple Mobile Device Service服务进程作为中间件。在连接到 iOS 设备之前,您必须先启动Apple Mobile Device Service服务。 如果您想要在Linux中运行使用MobileDevices构建的程序请先在其中运行一个套接字守护进程,用于在iOS设备之间多路传输连接。关于如何构建套接字守护程序请参考 usbmuxd 进行构建。 当然在Windows下您亦可不使用Apple Mobile Device Service服务,而参考于 usbmuxd 构建Windows下与iOS 设备通信通信的套接字守护进程。进而使用MobileDevices操作设备。

Using the library

在使用这个库前你需要

using MobileDevices.iOS.DependencyInjection;

public void ConfigureServices(IServiceCollection services)
 {
        services.AddAppleServices();
 }

Listing all iOS devices

以下代码段列出了当前连接到您 PC 的所有iOS设备:

public async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            var devices = await _muxerClient.ListDevicesAsync(cancellationToken).ConfigureAwait(false);
            foreach (var device in devices)
            {
                var pairingRecord = await _pairingRecordProvisioner
                    .ProvisionPairingRecordAsync(device.Udid, cancellationToken)
                    .ConfigureAwait(false);
            }
        }

Start device listen

开启设备的监听,这些 DeviceAttachedAsync、DeviceDetachedAsync、DevicePairedAsync 为监听到设备的处理方法,具体细节与实现可根据实际构建 。 以下代码开启了设备监听:

        public async Task ExecuteAsync(CancellationToken stoppingToken)
        {
             //Listening for new device events.
            var result = await _muxerClient.ListenAsync(
                DeviceAttachedAsync,
                DeviceDetachedAsync,
                DevicePairedAsync,
                stoppingToken).ConfigureAwait(false);
             //Stopped listening. The client/server closed the connection.
        }
        

Contributing

期待您完善这个库,并感谢每个拉取请求! 如果您有想法修改完善,请在 master 上创建一个分支,更改、提交并发送拉取请求以供审核。之后它就可以合并到主代码库中。

请确保您的提交符合:

  • 提交消息应该很好地描述更改而不是跟简短的概括
  • 使用您有效的电子邮件地址进行提交

非常欢迎您的指导与参与!

Links

Credits

Apple、iPhone、iPad、iPod、iPod Touch、Apple TV、Apple Watch、Mac、iOS、iPadOS、tvOS、watchOS 和 macOS 是 Apple Inc. 的商标。

本项目为独立软件,未经 Apple Inc. 授权、赞助或以其他方式批准。

mobiledevices's People

Contributors

rearguard-hu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.