/// <summary> /// Initializes a new instance of the <see cref="App" /> class using an optional /// <see cref="AppLoop" />, <see cref="Backend " /> and <see cref="GraphicsDescriptor " />. /// </summary> /// <param name="backend">The graphics backend.</param> /// <param name="loop">The app loop.</param> /// <param name="descriptor">The `sokol_gfx` initialize descriptor.</param> protected App( GraphicsBackend?backend = null, AppLoop?loop = null, GraphicsDescriptor?descriptor = null) { if (Interlocked.CompareExchange(ref _isInitialized, 1, 0) == 1) { throw new InvalidOperationException("Another application has already been initialized."); } Instance = this; var(platform, backendUsed) = NativeLibraries.Load(backend); Platform = platform; Backend = backendUsed; SDL_Init(SDL_INIT_VIDEO); Window = new AppWindow(string.Empty, 800, 600); var desc = descriptor ?? default; _renderer = CreateRenderer(Backend, ref desc, Window.Handle); GraphicsDevice.Setup(ref desc); _loop = loop ?? new FixedTimeStepLoop(); }
public bool Equals(LockFileTargetLibrary other) { if (other == null) { return(false); } if (Object.ReferenceEquals(this, other)) { return(true); } return(string.Equals(Name, other.Name) && VersionComparer.Default.Equals(Version, other.Version) && string.Equals(Type, other.Type, StringComparison.Ordinal) && string.Equals(Framework, other.Framework, StringComparison.Ordinal) && Dependencies.OrderedEquals(other.Dependencies, dependency => dependency.Id, StringComparer.OrdinalIgnoreCase) && FrameworkAssemblies.OrderedEquals(other.FrameworkAssemblies, s => s, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase) && FrameworkReferences.OrderedEquals(other.FrameworkReferences, s => s, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase) && RuntimeAssemblies.OrderedEquals(other.RuntimeAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) && ResourceAssemblies.OrderedEquals(other.ResourceAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) && CompileTimeAssemblies.OrderedEquals(other.CompileTimeAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) && NativeLibraries.OrderedEquals(other.NativeLibraries, item => item.Path, StringComparer.OrdinalIgnoreCase) && ContentFiles.OrderedEquals(other.ContentFiles, item => item.Path, StringComparer.OrdinalIgnoreCase) && RuntimeTargets.OrderedEquals(other.RuntimeTargets, item => item.Path, StringComparer.OrdinalIgnoreCase) && Build.OrderedEquals(other.Build, item => item.Path, StringComparer.OrdinalIgnoreCase) && BuildMultiTargeting.OrderedEquals(other.BuildMultiTargeting, item => item.Path, StringComparer.OrdinalIgnoreCase) && ToolsAssemblies.OrderedEquals(other.ToolsAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase) && EmbedAssemblies.OrderedEquals(other.EmbedAssemblies, item => item.Path, StringComparer.OrdinalIgnoreCase)); }
private bool iDeviceCheck() { circularProgressBar1.Value = 0; circularProgressBar1.ProgressColor1 = System.Drawing.Color.AliceBlue; circularProgressBar1.ProgressColor2 = System.Drawing.Color.Blue; circularProgressBar1.Update(); for (int i = 0; i < 100; i++) { circularProgressBar1.Value += 1; circularProgressBar1.Update(); ShowOFF(); } NativeLibraries.Load(); //ReadOnlyCollection<string> udids; int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var ret = idevice.idevice_get_device_list(out ReadOnlyCollection <string> udids, ref count); // iDevice Count == 0 if (count == 0) { Failed(); return(false); } else { return(true); } }
private void frmMain_Load(object sender, EventArgs e) { NativeLibraries.Load(); service = LocationService.GetInstance(); service.PrintMessageEvent = PrintMessage; service.ListeningDevice(); }
public override bool Execute() { Log.LogDebugMessage("GetImportedLibraries Task"); Log.LogDebugMessage(" TargetDirectory: {0}", TargetDirectory); if (!Directory.Exists(TargetDirectory)) { Log.LogDebugMessage("Target directory was not found"); return(true); } // there could be ./AndroidManifest.xml and bin/AndroidManifest.xml, which will be the same. So, ignore "bin" ones. ManifestDocuments = Directory.GetFiles(TargetDirectory, "AndroidManifest.xml", SearchOption.AllDirectories).Where(f => !Path.GetDirectoryName(f).EndsWith("bin")).Select(p => new TaskItem(p)).ToArray(); NativeLibraries = Directory.GetFiles(TargetDirectory, "*.so", SearchOption.AllDirectories) .Where(p => MonoAndroidHelper.GetNativeLibraryAbi(p) != null) .Select(p => new TaskItem(p)).ToArray(); Jars = Directory.GetFiles(TargetDirectory, "*.jar", SearchOption.AllDirectories).Select(p => new TaskItem(p)).ToArray(); Log.LogDebugTaskItems(" NativeLibraries: ", NativeLibraries); Log.LogDebugTaskItems(" Jars: ", Jars); Log.LogDebugTaskItems(" ManifestDocuments: ", ManifestDocuments); if (!string.IsNullOrEmpty(CacheFile)) { var document = new XDocument( new XDeclaration("1.0", "UTF-8", null), new XElement("Paths", new XElement("ManifestDocuments", ManifestDocuments.Select(e => new XElement("ManifestDocument", e.ItemSpec))), new XElement("NativeLibraries", NativeLibraries.Select(e => new XElement("NativeLibrary", e.ItemSpec))), new XElement("Jars", Jars.Select(e => new XElement("Jar", e.ItemSpec))) )); document.SaveIfChanged(CacheFile); } return(true); }
private void AddNativeLibraries(ArchiveFileList files, string supportedAbis) { var libs = NativeLibraries.Concat(BundleNativeLibraries ?? Enumerable.Empty <ITaskItem> ()) .Select(v => new LibInfo { Path = v.ItemSpec, Abi = GetNativeLibraryAbi(v) }); AddNativeLibraries(files, supportedAbis, libs); }
public FrmMain() { InitializeComponent(); if (!Directory.Exists(AUDIOFOLDER)) { Directory.CreateDirectory(AUDIOFOLDER); } NativeLibraries.Load(); }
public void TestRoundTrip() { NativeLibraries.Load(); // Create a string array worth +/- 10 MB of memory var values = new List <string>(); values.Add(new string('0', 1024 * 1024)); values.Add(new string('1', 1024 * 1024)); values.Add(new string('2', 1024 * 1024)); values.Add(new string('3', 1024 * 1024)); values.Add(new string('4', 1024 * 1024)); values.Add(new string('5', 1024 * 1024)); values.Add(new string('6', 1024 * 1024)); values.Add(new string('7', 1024 * 1024)); values.Add(new string('8', 1024 * 1024)); values.Add(new string('9', 1024 * 1024)); // And, as the icing on the cake, an UTF-8 string. values.Add("Bart’s iPhone"); var readonlyValues = new ReadOnlyCollection <string>(values); GC.Collect(); var p = Process.GetCurrentProcess(); var initialMemory = p.PrivateMemorySize64; for (int i = 0; i < 75; i++) { NativeStringArrayMarshaler marshaler = new NativeStringArrayMarshaler(); var pointer = marshaler.MarshalManagedToNative(readonlyValues); marshaler = null; GC.Collect(); marshaler = new NativeStringArrayMarshaler(); var roundTrip = (ReadOnlyCollection <string>)marshaler.MarshalNativeToManaged(pointer); CollectionAssert.AreEqual(readonlyValues, roundTrip); marshaler.CleanUpNativeData(pointer); } GC.Collect(); p.Refresh(); var currentMemory = p.PrivateMemorySize64; var delta = currentMemory - initialMemory; // If more than 10 MB was leaked, set off the alarm bells // You can verify this works by commenting out NativeStringMarshaler.CleanUpNativeData if (delta > 10 * 1024 * 1024 * 8 /* 10 MB */) { Assert.Fail("Memory was leaked"); } }
private static void GenerateUDIDs() { NativeLibraries.Load(); ReadOnlyCollection <string> udids; int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var ret = idevice.idevice_get_device_list(out udids, ref count); if (ret == iDeviceError.NoDevice) { // Not actually an error in our case Console.WriteLine("No devices found"); return; } ret.ThrowOnError(); int NumberOfDeviceConnected = udids.Count; Console.WriteLine($"\n Number of Devices Connected: {NumberOfDeviceConnected}"); int ctr = 0; // Get the device name foreach (var udid in udids) { ctr++; iDeviceHandle deviceHandle; idevice.idevice_new(out deviceHandle, udid).ThrowOnError(); LockdownClientHandle lockdownHandle; lockdown.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError(); string deviceName; lockdown.lockdownd_get_device_name(lockdownHandle, out deviceName).ThrowOnError(); string sn; iMobileDevice.Plist.PlistHandle tested1; lockdown.lockdownd_get_value(lockdownHandle, null, "SerialNumber", out tested1).ThrowOnError(); //Get string values from plist tested1.Api.Plist.plist_get_string_val(tested1, out sn); Console.WriteLine($"\n device: {ctr} Name: {deviceName} UDID: {udid} Serial Number: {sn}"); deviceHandle.Dispose(); lockdownHandle.Dispose(); } }
protected void ClearDll() { if (hLib == null) { return; } if (!NativeLibraries.FreeLibrary(hLib.Value)) { } hLib = null; }
/// <summary> /// main window initialization /// </summary> public MainWindow() { InitializeComponent(); // default is walking walking_speed.IsChecked = true; running_speed.IsChecked = false; driving_speed.IsChecked = false; // default is reverse walking stop_at_end.IsChecked = false; loop_to_start.IsChecked = false; loop_reverse.IsChecked = true; gpx_save_button.IsEnabled = false; stop_spoofing_button.IsEnabled = false; // load native libraries for iDevice NativeLibraries.Load(); // init walking timer. walking_timer = new DispatcherTimer(); walking_timer.Interval = TimeSpan.FromMilliseconds(500); // 0.5 sec timer_callback = new walking_timer_callback(g_polyline, myMap, this); timer_callback.walking_speed = c_fast_walking_speed; walking_timer.Tick += timer_callback.one_step; walking_timer.IsEnabled = true; walking_timer.Stop(); loc_service = location_service.GetInstance(this); loc_service.ListeningDevice(); if (loc_service.Devices.Count < 1) { device_prov.IsEnabled = false; } string ddi_path = AppDomain.CurrentDomain.BaseDirectory + "DDILocalRepo\\"; if (!System.IO.Directory.Exists(ddi_path)) { System.IO.Directory.CreateDirectory(ddi_path); } // set map center. Location map_center = new Location(); map_center.Latitude = Properties.Settings.Default.home_lat; map_center.Longitude = Properties.Settings.Default.home_lon; myMap.Center = map_center; }
public override int GetHashCode() { var combiner = new HashCodeCombiner(); combiner.AddObject(Name); combiner.AddObject(Version); combiner.AddObject(Type); combiner.AddObject(Framework); foreach (var dependency in Dependencies.OrderBy(dependency => dependency.Id, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(dependency); } foreach (var reference in FrameworkAssemblies.OrderBy(s => s, StringComparer.OrdinalIgnoreCase)) { combiner.AddStringIgnoreCase(reference); } foreach (var item in RuntimeAssemblies.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } foreach (var item in ResourceAssemblies.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } foreach (var item in CompileTimeAssemblies.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } foreach (var item in NativeLibraries.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } foreach (var item in ContentFiles.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } foreach (var item in RuntimeTargets.OrderBy(item => item.Path, StringComparer.OrdinalIgnoreCase)) { combiner.AddObject(item); } return(combiner.CombinedHash); }
private bool IsDeviceConnected() { // Don't do anything if a device already connected. //if (DeviceConnected) return; // Load native imobiledevice shit.. NativeLibraries.Load(); bool result = false; ReadOnlyCollection <string> _pluggedDevices; int pluggedDevicesCount = 0; try { DeviceState = (iDeviceApi)LibiMobileDevice.Instance.iDevice; LockDownState = (LockdownApi)LibiMobileDevice.Instance.Lockdown; // Try to connect to any connected iDevice... DeviceState.idevice_get_device_list(out _pluggedDevices, ref pluggedDevicesCount); // Populate the list with found iDevices and then put // the said devices to our global list. pluggedDevices = _pluggedDevices; // Etasblish connection to found device. if (pluggedDevices.Count > 0) { // Connect to the first found device... var thisDevice = pluggedDevices[0]; DeviceState.idevice_new(out deviceHandle, thisDevice).ThrowOnError(); LockDownState.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError(); DeviceConnected = (LockDownState != null ? true : false); if (DeviceConnected) { //ParseDevice(); result = true; } } } catch (LockdownException) { ReleaseDevice(); //throw new LockdownException("Couldn't connect to iDevice. Please make sure your device has trusted this pc."); } return(result); }
protected Delegate LoadFunction <T>(IntPtr?hModule, string name) where T : class { if (hModule == null) { return(null); } IntPtr pAddressOfFunctionToCall = NativeLibraries.GetProcAddress(hModule.Value, name); if (pAddressOfFunctionToCall == IntPtr.Zero) { ClearDll(); return(null); } return(Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, typeof(T))); }
private void frmMain_Load(object sender, EventArgs e) { this.Text = "VirtualLocation For iOS v" + Program.ver; file = new IniFile(@System.Windows.Forms.Application.StartupPath + "\\Config.ini"); nudLon.Value = decimal.Parse(file.IniReadValue("Location", "Longitude")); nudLat.Value = decimal.Parse(file.IniReadValue("Location", "Latitude")); txtLocation.Text = "Hi," + Program.User + ".\r\n请选择坐标。"; NativeLibraries.Load(); service = LocationService.GetInstance(); service.PrintMessageEvent = PrintMessage; service.ListeningDevice(); this.webBrowser.ObjectForScripting = this; this.webBrowser.ScriptErrorsSuppressed = true; webBrowser.Navigate(@System.IO.Directory.GetCurrentDirectory() + "\\radar\\index.html"); }
private void AddNativeLibraries(ArchiveFileList files, string [] supportedAbis) { var frameworkLibs = FrameworkNativeLibraries.Select(v => new LibInfo { Path = v.ItemSpec, Abi = GetNativeLibraryAbi(v), ArchiveFileName = v.GetMetadata("ArchiveFileName") }); AddNativeLibraries(files, supportedAbis, frameworkLibs); var libs = NativeLibraries.Concat(BundleNativeLibraries ?? Enumerable.Empty <ITaskItem> ()) .Select(v => new LibInfo { Path = v.ItemSpec, Abi = GetNativeLibraryAbi(v) }); AddNativeLibraries(files, supportedAbis, libs); }
protected void TryLoadDll(string name) { hLib = NativeLibraries.LoadLibrary(name); if (hLib.Value == IntPtr.Zero) { foreach (string additionalPath in additionalPaths) { string fullPath = additionalPath + name; hLib = NativeLibraries.LoadLibrary(fullPath); if (hLib.Value != IntPtr.Zero) { return; } } hLib = null; } }
static void Main(string[] args) { Console.WriteLine("Starting the imobiledevice-net demo"); // This demo application will use the libimobiledevice API to list all iOS devices currently // connected to this PC. // First, we need to make sure the unmanaged (native) libimobiledevice libraries are loaded correctly NativeLibraries.Load(); ReadOnlyCollection <string> udids; int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var ret = idevice.idevice_get_device_list(out udids, ref count); if (ret == iDeviceError.NoDevice) { // Not actually an error in our case Console.WriteLine("No devices found"); return; } ret.ThrowOnError(); // Get the device name foreach (var udid in udids) { iDeviceHandle deviceHandle; idevice.idevice_new(out deviceHandle, udid).ThrowOnError(); LockdownClientHandle lockdownHandle; lockdown.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError(); string deviceName; lockdown.lockdownd_get_device_name(lockdownHandle, out deviceName).ThrowOnError(); Console.WriteLine($"{deviceName} ({udid})"); deviceHandle.Dispose(); lockdownHandle.Dispose(); } }
// Token: 0x06000002 RID: 2 private void frmMain_Load(object sender, EventArgs e) { NativeLibraries.Load(); this.service = LocationService.GetInstance(); this.service.PrintMessageEvent = new Action <string>(this.PrintMessage); this.service.ListeningDevice(); Cef.Initialize(new CefSettings { PersistSessionCookies = true, CachePath = "cache" }); // string address = ConfigurationManager.AppSettings["url"]; this.m_chromeBrowser = new ChromiumWebBrowser(address); this.panel1.Controls.Add(this.m_chromeBrowser); this.m_chromeBrowser.RegisterJsObject("ckPos", this, true); }
static void Main(string[] args) { Console.WriteLine("Starting the imobiledevice-net demo"); // This demo application will use the libimobiledevice API to list all iOS devices currently // connected to this PC. // First, we need to make sure the unmanaged (native) libimobiledevice libraries are loaded correctly NativeLibraries.Load(); ReadOnlyCollection <string> devices; int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var screenshotr = LibiMobileDevice.Instance.Screenshotr; var service = LibiMobileDevice.Instance.Service; var ret = idevice.idevice_get_device_list(out devices, ref count); if (ret == iDeviceError.NoDevice) { // Not actually an error in our case Console.WriteLine("No devices found"); return; } ret.ThrowOnError(); // Get the device name foreach (var device in devices) { Console.Write(device); string lat = "113.970076"; string lon = "22.533695"; double fLat = Convert.ToDouble(lat); double fLon = Convert.ToDouble(lon); DoProcess(device, fLat.ToString(), fLon.ToString()); } }
public void NativeToManagedTest() { NativeLibraries.Load(); // An easy way to invoke the marshaler is through the use of // plist_new_string, which creates a new object with a string value, // and plist_get_string_val, which gets that object's value. var plist = new PlistApi(); /* Allocate a value worth 10 MB */ string input = new string('x', 10 * 1024 * 1024); var handle = plist.plist_new_string(input); GC.Collect(); var p = Process.GetCurrentProcess(); var initialMemory = p.PrivateMemorySize64; for (int i = 0; i < 75; i++) { string output; // Every call will allocate a new string. If it's not properly cleaned up // by our marshaler, we will leak 10 MB in each call, or 750 MB in total. plist.plist_get_string_val(handle, out output); Assert.AreEqual(input, output); } handle.Dispose(); GC.Collect(); p.Refresh(); var currentMemory = p.PrivateMemorySize64; var delta = currentMemory - initialMemory; // If more than 10 MB was leaked, set off the alarm bells // You can verify this works by commenting out NativeStringMarshaler.CleanUpNativeData if (delta > 10 * 1024 * 1024 * 8 /* 10 MB */) { Assert.Fail("Memory was leaked"); } }
/// <summary> /// main window initialization /// </summary> public MainWindow() { InitializeComponent(); // default is walking //walking_speed.IsChecked = true; //running_speed.IsChecked = false; //driving_speed.IsChecked = false; // load native libraries for iDevice NativeLibraries.Load(); // init walking timer. walkingTimer = new DispatcherTimer(); walkingTimer.Interval = TimeSpan.FromMilliseconds(500); // 0.5 sec walkingTimer.Tick += DoOneStep; walkingTimer.IsEnabled = true; navigator = new Navigator(); navigator.walkingSpeed = WalkingSpeedSlider.Value; navigator.WalkingState = WalkingState.Stopped; uiMgr = new MapUIManager(myMap, this); webServices = new WebServices(BingMapKey); route = new LocationCollection(); uiMgr.SetRoute(route); navigator.SetRoute(route); locService = LocationService.GetInstance(this); locService.ListeningDevice(); if (locService.Devices.Count < 1) { device_prov.IsEnabled = false; } walkingTimer.Start(); }
public override bool RunTask() { if (!Directory.Exists(TargetDirectory)) { Log.LogDebugMessage("Target directory was not found"); return(true); } var manifestDocuments = new List <ITaskItem> (); var nativeLibraries = new List <ITaskItem> (); var jarFiles = new List <ITaskItem> (); foreach (var file in Directory.EnumerateFiles(TargetDirectory, "*", SearchOption.AllDirectories)) { if (file.EndsWith(".so", StringComparison.OrdinalIgnoreCase)) { if (MonoAndroidHelper.GetNativeLibraryAbi(file) != null) { nativeLibraries.Add(new TaskItem(file)); } } else if (file.EndsWith(".jar", StringComparison.OrdinalIgnoreCase)) { jarFiles.Add(new TaskItem(file)); } else if (file.EndsWith(".xml", StringComparison.OrdinalIgnoreCase)) { if (Path.GetFileName(file) == "AndroidManifest.xml") { // there could be ./AndroidManifest.xml and bin/AndroidManifest.xml, which will be the same. So, ignore "bin" ones. var directory = Path.GetFileName(Path.GetDirectoryName(file)); if (IgnoredManifestDirectories.Contains(directory)) { continue; } manifestDocuments.Add(new TaskItem(file)); } } } ManifestDocuments = manifestDocuments.ToArray(); NativeLibraries = nativeLibraries.ToArray(); Jars = jarFiles.ToArray(); if (!string.IsNullOrEmpty(CacheFile)) { var document = new XDocument( new XDeclaration("1.0", "UTF-8", null), new XElement("Paths", new XElement("ManifestDocuments", ManifestDocuments.Select(e => new XElement("ManifestDocument", e.ItemSpec))), new XElement("NativeLibraries", NativeLibraries.Select(e => new XElement("NativeLibrary", e.ItemSpec))), new XElement("Jars", Jars.Select(e => new XElement("Jar", e.ItemSpec))) )); document.SaveIfChanged(CacheFile); } Log.LogDebugTaskItems(" NativeLibraries: ", NativeLibraries); Log.LogDebugTaskItems(" Jars: ", Jars); Log.LogDebugTaskItems(" ManifestDocuments: ", ManifestDocuments); return(true); }
static void Main(string[] args) { // Configure paths string basePath = Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); Environment.CurrentDirectory = basePath; foreach (SecurityProtocolType protocol in Enum.GetValues(typeof(SecurityProtocolType))) { try { ServicePointManager.SecurityProtocol |= protocol; } catch { } } try { NativeLibraries.Load(); } catch { Console.WriteLine("Failed to load necessary files to run iFakeLocation."); return; } // Retrieve all web endpoint methods var methods = typeof(Program).GetMethods(BindingFlags.Static | BindingFlags.NonPublic) .Select(mi => new Tuple <MethodInfo, object>(mi, mi.GetCustomAttributes(true).FirstOrDefault(ci => ci is EndpointMethod))) .Where(kvp => kvp.Item2 != null) .ToDictionary(kvp => ((EndpointMethod)kvp.Item2).Name, kvp => kvp.Item1); // Find a free port to run our local server on HttpListener listener; int port; if (!TryBindListenerOnFreePort(out listener, out port)) { Console.WriteLine("Failed to initialise iFakeLocation (no free ports on local system)."); return; } // Start window try { OpenBrowser($"http://localhost:{port}/"); Console.WriteLine("iFakeLocation is now running at: " + $"http://localhost:{port}/"); Console.WriteLine("\nPress Ctrl-C to quit (or click the close button)."); } catch { Console.WriteLine("Unable to start iFakeLocation using default web browser."); return; } // Main processing loop while (true) { var ctx = listener.GetContext(); ThreadPool.QueueUserWorkItem(_ => { // Extract the method name from the URL var methodName = ctx.Request.Url.Segments.Length > 1 ? string.Join("", ctx.Request.Url.Segments.Skip(1)) : ""; if (string.IsNullOrEmpty(methodName)) { methodName = "main.html"; } // Respond with static resource if specified string path; if (File.Exists(path = Path.Combine("Resources", methodName.Replace('/', Path.DirectorySeparatorChar)))) { ctx.Response.Headers["Content-Type"] = MimeTypes.GetMimeType(methodName); using (var s = File.OpenRead(path)) s.CopyTo(ctx.Response.OutputStream); ctx.Response.Close(); return; } // Response with response from web method else if (methods.TryGetValue(methodName, out MethodInfo method)) { try { method.Invoke(null, new object[] { ctx }); } catch (Exception e) { Console.WriteLine("\n" + e); } try { if (ctx.Response.OutputStream.CanWrite) { ctx.Response.OutputStream.Close(); } } catch (ObjectDisposedException) { } } else { // Response with nothing ctx.Response.Close(); return; } }); } }
private void AddNativeLibraries(ArchiveFileList files, string [] supportedAbis) { var frameworkLibs = FrameworkNativeLibraries.Select(v => new LibInfo { Path = v.ItemSpec, Link = v.GetMetadata("Link"), Abi = GetNativeLibraryAbi(v), ArchiveFileName = GetArchiveFileName(v) }); AddNativeLibraries(files, supportedAbis, frameworkLibs); var libs = NativeLibraries.Concat(BundleNativeLibraries ?? Enumerable.Empty <ITaskItem> ()) .Where(v => IncludeNativeLibrary(v)) .Select(v => new LibInfo { Path = v.ItemSpec, Link = v.GetMetadata("Link"), Abi = GetNativeLibraryAbi(v), ArchiveFileName = GetArchiveFileName(v) } ); AddNativeLibraries(files, supportedAbis, libs); if (String.IsNullOrWhiteSpace(CheckedBuild)) { return; } string mode = CheckedBuild; string sanitizerName; if (String.Compare("asan", mode, StringComparison.Ordinal) == 0) { sanitizerName = "asan"; } else if (String.Compare("ubsan", mode, StringComparison.Ordinal) == 0) { sanitizerName = "ubsan_standalone"; } else { LogSanitizerWarning($"Unknown checked build mode '{CheckedBuild}'"); return; } if (!IncludeWrapSh) { LogSanitizerError("Checked builds require the wrapper script to be packaged. Please set the `$(AndroidIncludeWrapSh)` MSBuild property to `true` in your project."); return; } if (!libs.Any(info => IsWrapperScript(info.Path, info.Link))) { LogSanitizerError($"Checked builds require the wrapper script to be packaged. Please add `wrap.sh` appropriate for the {CheckedBuild} checker to your project."); return; } NdkUtil.Init(AndroidNdkDirectory); string clangDir = NdkUtil.GetClangDeviceLibraryPath(AndroidNdkDirectory); if (String.IsNullOrEmpty(clangDir)) { LogSanitizerError($"Unable to find the clang compiler directory. Is NDK installed?"); return; } foreach (string abi in supportedAbis) { string clangAbi = MonoAndroidHelper.MapAndroidAbiToClang(abi); if (String.IsNullOrEmpty(clangAbi)) { LogSanitizerError($"Unable to map Android ABI {abi} to clang ABI"); return; } string sanitizerLib = $"libclang_rt.{sanitizerName}-{clangAbi}-android.so"; string sanitizerLibPath = Path.Combine(clangDir, sanitizerLib); if (!File.Exists(sanitizerLibPath)) { LogSanitizerError($"Unable to find sanitizer runtime for the {CheckedBuild} checker at {sanitizerLibPath}"); return; } AddNativeLibrary(files, sanitizerLibPath, abi, sanitizerLib); } }
private void Button1_Click(object sender, EventArgs e) { //bool DeviceFound = false; //int counter = 0; if (System.IO.File.Exists(@"Tools\adb.exe")) { if (ADBCheck() == true) { textBoxDeviceIMEI.Clear(); textBoxDeviceBrand.Clear(); textBoxDeviceModel.Clear(); var device = AdbClient.Instance.GetDevices().FirstOrDefault(); var receiver = new ConsoleOutputReceiver(); //ADB IMEI Methods Dictionary <int, string> imei = new Dictionary <int, string>() { { 1, "content query --uri content://settings/system --where " + '"' + "name='" + "bd_setting_i'" + '"' + " | sed '" + "s/[^=0-9]*//g' | sed 's/[0-9]*=//g'" }, { 2, "service call iphonesubinfo 1" }, { 3, "getprop persist.radio.device.imei" } }; string manufacturer = @"getprop ro.product.manufacturer"; string model = @"getprop ro.product.model"; //Instance.ExecuteRemoteCommand is adb shell -> AdbClient.Instance.ExecuteRemoteCommand(manufacturer, device, receiver); AdbClient.Instance.ExecuteRemoteCommand(model, device, receiver); AdbClient.Instance.ExecuteRemoteCommand(imei[1], device, receiver); var received = receiver.ToString().ToUpper(); List <string> s = new List <string>(received.Split(new string[] { "\n" }, StringSplitOptions.None)); textBoxDeviceBrand.Text = s[0].Trim(); textBoxDeviceModel.Text = s[1].Trim(); try { // OLD Android var intIMEI = Int32.Parse(s[2].Trim()); textBoxDeviceIMEI.Text = s[2].Trim(); } catch (Exception) { // New Version Android AdbClient.Instance.ExecuteRemoteCommand(imei[2], device, receiver); received = receiver.ToString().ToUpper(); s = new List <string>(received.Split(new string[] { "\n" }, StringSplitOptions.None)); string method1IMEI = ExtractIMEIfromMethod2(s); if (method1IMEI != "-1") { textBoxDeviceIMEI.Text = method1IMEI.Trim(); } else { //ASUS ZENFONE } } LuhnUI(); } else { if (iDeviceCheck()) { Dictionary <string, string> data = new Dictionary <string, string>() { { "x86_64", "Simulator" }, { "i386", "Simulator" }, { "iPod1,1", "iPod Touch 1st Gen" }, { "iPod2,1", "iPod Touch 2nd Gen" }, { "iPod3,1", "iPod Touch 3rd Gen" }, { "iPod4,1", "iPod Touch 4th Gen" }, { "iPod5,1", "iPod Touch 5th Gen" }, { "iPod7,1", "iPod Touch 6th Gen" }, { "iPod9,1", "iPod Touch 7th Gen" }, { "iPhone1,1", "iPhone" }, { "iPhone1,2", "iPhone 3G" }, { "iPhone2,1", "iPhone 3GS" }, { "iPhone3,1", "iPhone 4" }, { "iPhone3,2", "iPhone 4" }, { "iPhone3,3", "iPhone 4" }, { "iPhone4,1", "iPhone 4S" }, { "iPhone5,1", "iPhone 5 model A1428" }, { "iPhone5,2", "iPhone 5 model A1429" }, { "iPhone5,3", "iPhone 5C" }, { "iPhone5,4", "iPhone 5C" }, { "iPhone6,1", "iPhone 5S" }, { "iPhone6,2", "iPhone 5S" }, { "iPhone7,2", "iPhone 6" }, { "iPhone7,1", "iPhone 6 Plus" }, { "iPhone8,1", "iPhone 6S" }, { "iPhone8,2", "iPhone 6S Plus" }, { "iPhone8,4", "iPhone SE" }, { "iPhone9,1", "iPhone 7" }, { "iPhone9,2", "iPhone 7 Plus" }, { "iPhone9,3", "iPhone 7" }, { "iPhone9,4", "iPhone 7 Plus" }, { "iPhone10,1", "iPhone 8" }, { "iPhone10,4", "iPhone 8" }, { "iPhone10,2", "iPhone 8 Plus" }, { "iPhone10,5", "iPhone 8 Plus" }, { "iPhone10,3", "iPhone X" }, { "iPhone10,6", "iPhone X" }, { "iPhone11,2", "iPhone XS" }, { "iPhone11,4", "iPhone XS Max" }, { "iPhone11,6", "iPhone XS Max" }, { "iPhone11,8", "iPhone XR" }, { "iPhone12,1", "iPhone 11" }, { "iPhone12,3", "iPhone 11 Pro" }, { "iPhone12,5", "iPhone 11 Pro Max" }, { "iPad1,1", "iPad" }, { "iPad2,1", "iPad 2" }, { "iPad2,2", "iPad 2" }, { "iPad2,3", "iPad 2" }, { "iPad2,4", "iPad 2" }, { "iPad3,1", "iPad 3rd Gen" }, { "iPad3,2", "iPad 3rd Gen" }, { "iPad3,3", "iPad 3rd Gen" }, { "iPad3,4", "iPad 4th Gen" }, { "iPad3,5", "iPad 4th Gen" }, { "iPad3,6", "iPad 4th Gen" }, { "iPad4,1", "iPad Air" }, { "iPad4,2", "iPad Air" }, { "iPad4,3", "iPad Air" }, { "iPad2,5", "iPad Mini 1st Gen" }, { "iPad2,6", "iPad Mini 1st Gen" }, { "iPad2,7", "iPad Mini 1st Gen" }, { "iPad4,4", "iPad Mini 2nd Gen" }, { "iPad4,5", "iPad Mini 2nd Gen" }, { "iPad4,6", "iPad Mini 2nd Gen" }, { "iPad4,7", "iPad Mini 3rd Gen" }, { "iPad4,8", "iPad Mini 3rd Gen" }, { "iPad4,9", "iPad Mini 3rd Gen" }, { "iPad5,1", "iPad Mini 4" }, { "iPad5,2", "iPad Mini 4" }, { "iPad5,3", "iPad Air 2" }, { "iPad5,4", "iPad Air 2" }, { "iPad6,3", "iPad Pro 9.7 inch" }, { "iPad6,4", "iPad Pro 9.7 inch" }, { "iPad6,7", "iPad Pro 12.9 inch" }, { "iPad6,8", "iPad Pro 12.9 inch" }, { "iPad7,1", "iPad Pro 12.9 inch 2nd Gen" }, { "iPad7,2", "iPad Pro 12.9 inch 2nd Gen" }, { "iPad7,3", "iPad Pro 10.5 inch" }, { "iPad7,4", "iPad Pro 10.5 inch" }, { "iPad8,1", "iPad Pro 11 inch" }, { "iPad8,2", "iPad Pro 11 inch" }, { "iPad8,3", "iPad Pro 11 inch" }, { "iPad8,4", "iPad Pro 11 inch" }, { "iPad8,5", "iPad Pro 12.9 inch 3rd Gen" }, { "iPad8,6", "iPad Pro 12.9 inch 3rd Gen" }, { "iPad8,7", "iPad Pro 12.9 inch 3rd Gen" }, { "iPad8,8", "iPad Pro 12.9 inch 3rd Gen" }, { "iPad11,1", "iPad mini 5th Gen(WiFi)" }, { "iPad11,2", "iPad mini 5th Gen" }, { "iPad11,3", "iPad Air 3rd Gen(WiFi)" }, { "iPad11,4", "iPad Air 3rd Gen" } }; textBoxDeviceIMEI.Clear(); textBoxDeviceBrand.Clear(); textBoxDeviceModel.Clear(); NativeLibraries.Load(); int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var ret = idevice.idevice_get_device_list(out ReadOnlyCollection <string> udids, ref count); if (ret == iDeviceError.NoDevice) { // Not actually an error in our case return; } ret.ThrowOnError(); // Get the device name foreach (var udid in udids) { idevice.idevice_new(out iDeviceHandle deviceHandle, udid).ThrowOnError(); lockdown.lockdownd_client_new_with_handshake(deviceHandle, out LockdownClientHandle lockdownHandle, "Quamotion").ThrowOnError(); lockdown.lockdownd_get_device_name(lockdownHandle, out string deviceName).ThrowOnError(); //Find serial number in plist lockdown.lockdownd_get_value(lockdownHandle, null, "InternationalMobileEquipmentIdentity", out PlistHandle PlistIMEI); //Find Product Type version in plist lockdown.lockdownd_get_value(lockdownHandle, null, "ProductType", out PlistHandle PlistProductType); //Get string values from plist PlistIMEI.Api.Plist.plist_get_string_val(PlistIMEI, out string IMEI); PlistProductType.Api.Plist.plist_get_string_val(PlistProductType, out string ProductType); //Place data in textboxes textBoxDeviceIMEI.Text = IMEI.Trim(); if (data.TryGetValue(ProductType.Trim(), out string FProductType)) { textBoxDeviceBrand.Text = "APPLE"; textBoxDeviceModel.Text = FProductType; } deviceHandle.Dispose(); lockdownHandle.Dispose(); } } } } }
public MainWindow() { InitializeComponent(); NativeLibraries.Load(); }
public Form1() { InitializeComponent(); NativeLibraries.Load(); }
private bool HookDevice() { // Don't do anything if a device already connected. //if (DeviceConnected) return; // Load native imobiledevice shit.. NativeLibraries.Load(); bool result = false; ReadOnlyCollection <string> _pluggedDevices; int pluggedDevicesCount = 0; try { DeviceState = (iDeviceApi)LibiMobileDevice.Instance.iDevice; LockDownState = (LockdownApi)LibiMobileDevice.Instance.Lockdown; // Try to connect to any connected iDevice... DeviceState.idevice_get_device_list(out _pluggedDevices, ref pluggedDevicesCount); // Populate the list with found iDevices and then put // the said devices to our global list. pluggedDevices = _pluggedDevices; // Check if any device is present, if no do nothing but display message. if (pluggedDevices.Count <= 0) { // Not actually an error in our case. MessageBox.Show("No iDevice found!", "No iDevice connected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ReleaseDevice(); result = false; } // Since we only plan (and only supports) 1 device at a time, check. else if (pluggedDevices.Count > 1) { MessageBox.Show("Please only connect one iDevice at a time!", "Multiple iDevices detected", MessageBoxButtons.OK, MessageBoxIcon.Error); result = false; } // Etasblish connection to found device. if (pluggedDevices.Count > 0) { // Connect to the first found device... var thisDevice = pluggedDevices[0]; DeviceState.idevice_new(out deviceHandle, thisDevice).ThrowOnError(); LockDownState.lockdownd_client_new_with_handshake(deviceHandle, out lockdownHandle, "Quamotion").ThrowOnError(); PlistReader = new PlistApi(LibiMobileDevice.Instance); DeviceConnected = (LockDownState != null ? true : false); if (DeviceConnected) { ParseDevice(); result = true; } } } catch (LockdownException) { ReleaseDevice(); throw new LockdownException("Couldn't connect to iDevice. Please make sure your device has trusted this pc."); } return(result); }
static void Main(string[] args) { //ConnectedDevices connectedDevices = new ConnectedDevices(); //connectedDevices.LoadDevices(); Console.WriteLine("Starting the imobiledevice-net demo"); // This demo application will use the libimobiledevice API to list all iOS devices currently // connected to this PC. // First, we need to make sure the unmanaged (native) libimobiledevice libraries are loaded correctly NativeLibraries.Load(); ReadOnlyCollection <string> udids; int count = 0; var idevice = LibiMobileDevice.Instance.iDevice; var lockdown = LibiMobileDevice.Instance.Lockdown; var lockdown1 = LibiMobileDevice.Instance.Lockdown; var house_arrest = LibiMobileDevice.Instance.HouseArrest; //var lockdown = LibiMobileDevice.Instance.Lockdown; var ret = idevice.idevice_get_device_list(out udids, ref count); if (ret == iDeviceError.NoDevice) { // Not actually an error in our case Console.WriteLine("No devices found"); return; } ret.ThrowOnError(); // Get the device name foreach (var udid in udids) { iDeviceHandle deviceHandle; idevice.idevice_new(out deviceHandle, udid).ThrowOnError(); lockdown.lockdownd_client_new_with_handshake(deviceHandle, out LockdownClientHandle lockdownHandle_IP, "installation_proxy").ThrowOnError(); lockdown.lockdownd_start_service(lockdownHandle_IP, "com.apple.mobile.installation_proxy", out LockdownServiceDescriptorHandle lockdownServiceHandle_ip).ThrowOnError(); lockdown1.lockdownd_start_service(lockdownHandle_IP, "com.apple.mobile.house_arrest", out LockdownServiceDescriptorHandle lockdownServiceHandle).ThrowOnError(); house_arrest.house_arrest_client_start_service(deviceHandle, out HouseArrestClientHandle houseArrest, "houseArrest"); house_arrest.house_arrest_client_new(deviceHandle, lockdownServiceHandle, out houseArrest); string command = "VendContainer"; //"VendDocuments"; //""; //instproxy_lookup(); string appid = "com.cinamaker.directorPad"; house_arrest.house_arrest_send_command(houseArrest, command, appid); //house_arrest.afc_client_new_from_house_arrest_client(houseArrest, out afcHandle); //afc.afc_read_directory(afcHandle, "", out ReadOnlyCollection<string> directoryInformation).ThrowOnError(); //afc.afc_client_free(); //house_arrest.house_arrest_client_free(); deviceHandle.Dispose(); //lockdownHandle.Dispose(); } }