/// <summary> /// 运行被克隆的应用,该应用会加载多开应用的so库,检测已经加载的so里是否包含这些应用的包名 /// </summary> /// <returns></returns> public static bool CheckByMultiApkPackageName() { if (mCheckByMultiApkPackageName.HasValue) { return(mCheckByMultiApkPackageName.Value); } try { var reader = new Java.IO.FileReader("/proc/self/maps"); using var bufferedReader = new Java.IO.BufferedReader(reader); string?line; while ((line = bufferedReader.ReadLine()) != null) { var hasContains = virtualPkgs .Any(x => line.Contains(x, StringComparison.OrdinalIgnoreCase)); if (hasContains) { mCheckByMultiApkPackageName = true; return(mCheckByMultiApkPackageName.Value); } } } catch (Java.Lang.Throwable t) { t.PrintStackTraceWhenDebug(); } mCheckByMultiApkPackageName = false; return(mCheckByMultiApkPackageName.Value); }
/// <summary> /// Determines if the app has been rooted, by checking if we can /// locate the specified file. /// </summary> public bool CanLocateFile(string target) { try { using (var process = Java.Lang.Runtime.GetRuntime().Exec(new[] { "which", target })) { try { using (var inputStream = new Java.IO.InputStreamReader(process.InputStream)) { using (var inputReader = new Java.IO.BufferedReader(inputStream)) { // will return the path of the target, if found, // otherwise an empty response. return(!string.IsNullOrWhiteSpace(inputReader.ReadLine())); } } } finally { process.Destroy(); } } } catch (Exception ex) { Env.Reporter.ReportException($"CanLocateFile bombed for {target}", ex); return(false); } }
/// <summary> /// Check that su exists with "which su" command. /// </summary> /// <returns><c>true</c>, if su exists, <c>false</c> otherwise.</returns> private bool CheckSuExists() { Java.Lang.Process process = null; try { process = Runtime.GetRuntime().Exec(new string[] { "/system/xbin/which", "su" }); Java.IO.BufferedReader input = new Java.IO.BufferedReader( new Java.IO.InputStreamReader(process.InputStream)); if (input.ReadLine() != null) { return(true); } return(false); } catch (Throwable) { return(false); } finally { if (process != null) { process.Destroy(); } } }
public string ReadData(string address, EFolders eFolders) { try { address = CombineFolderPath(address, eFolders); JFile file = new JFile(address); if (file.IsFile && file.CanWrite()) { Java.IO.BufferedReader br = new Java.IO.BufferedReader(new Java.IO.FileReader(file)); StringBuilder str = new StringBuilder(); string temp = ""; while ((temp = br.ReadLine()) != null) { str.Append(temp); } br.Dispose(); return(str.ToString()); } } catch (Exception ex) { throw ex; } return(null); //throw new NotImplementedException(); }
private void ReadFileJava(string fileName) { var path = Environment.ExternalStorageDirectory + Java.IO.File.Separator + fileName; var file = new Java.IO.File(path); if (file.Exists()) { var text = ""; var br = new Java.IO.BufferedReader(new Java.IO.FileReader(file)); string line; while ((line = br.ReadLine()) != null) { if (!text.Equals("")) { text += '\n'; } text += line; } br.Close(); Toast.MakeText(this, text, ToastLength.Short).Show(); } else { Toast.MakeText(this, "File does not exist", ToastLength.Short).Show(); } }
public void onREC() { string ip = "0"; timer = true; Java.IO.File sdCard = Android.OS.Environment.ExternalStorageDirectory; Java.IO.File dir = new Java.IO.File(sdCard.AbsolutePath + "/SonryVitaMote"); Java.IO.File file = new Java.IO.File(dir, "ip.scf"); Java.IO.FileReader fread = new Java.IO.FileReader(file); Java.IO.BufferedReader br = new Java.IO.BufferedReader(fread); ip = br.ReadLine(); fread.Close(); try { clientSocket.Connect(ip, 5000); if (clientSocket.Connected) { Toast.MakeText(this, "PS VITA Connected", ToastLength.Long).Show(); RunUpdateLoop(); } else { Toast.MakeText(this, "Couldn't Connect", ToastLength.Long).Show(); } } catch (System.Exception ex) { Toast.MakeText(this, "Network Error, try again", ToastLength.Long).Show(); Log.Info("Exception: ", ex.ToString()); } }
/// <summary> /// Handles OnClick event for list item. /// Reads the raw data from a .csv file and diplays it on a textview. /// </summary> private void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e) { string fileName = e.View.FindViewById <TextView>(Resource.Id.tvListItem).Text; string path = MainActivity.ApplicationFolderPath + Java.IO.File.Separator + mSelectedFile + Java.IO.File.Separator + fileName; var reader = new Java.IO.BufferedReader(new Java.IO.FileReader(path)); string line = ""; List <string> rowDataList = new List <string>(); String title = fileName.Split('.')[0]; String str = ""; if (title.Equals("controls")) { str = "Time Throttle Yaw Pitch Roll"; } else { str = "Time " + title; } while ((line = reader.ReadLine()) != null) { line = line.Replace(',', ' ').Replace(';', ' '); rowDataList.Add(line); } rowDataList.Insert(0, str); mAdapter = new ListAdapter(this, rowDataList); mLvDisplayRawData.Adapter = mAdapter; reader.Close(); }
public static async Task <string> GetPulsePin() { string pin = await Task.Run(async() => { string pulsePin = null; // Create a URL for the desired page URL url = new Java.Net.URL("https://ares-project.uk/showpin.php?action=getbuildpin"); // Read all the text returned by the server using (Java.IO.BufferedReader input = new Java.IO.BufferedReader(new Java.IO.InputStreamReader(url.OpenStream()))) { string s1 = null; while ((s1 = await input.ReadLineAsync()) != null) { if (s1.Contains("Pin = ")) { pulsePin = s1.Substring(s1.IndexOf("Pin = "), 10).Substring(6, 4); break; } } } return(pulsePin); }); return(pin); }
/// <summary> /// Determines if the app has been rooted, by checking if the specified /// OS property has the specified value /// </summary> public bool HasPropValue(string key, string value) { try { using (var process = Java.Lang.Runtime.GetRuntime().Exec("getprop")) { try { if (process.InputStream == null) { return(false); } using (var inputStreamReader = new Java.IO.InputStreamReader(process.InputStream)) { using (var inputReader = new Java.IO.BufferedReader(inputStreamReader)) { for (var i = 0; i < 1000; ++i) { var line = inputReader.ReadLine(); if (line == null) { break; } var k = $"[{key}]"; var v = $"[{value}]"; if (line.Contains(k) && line.Contains(v)) { return(true); } } } } } finally { process.Destroy(); } } return(false); } catch (Exception ex) { this.Env.Reporter.ReportException($"HasPropValue bombed for {this.id} ({key}={value})", ex); return(false); } }
/// <exception cref="System.IO.IOException"></exception> public virtual void Search(string fileName) { Java.IO.BufferedReader @in = new Java.IO.BufferedReader(new Java.IO.FileReader(fileName )); string line = null; do { line = @in.ReadLine(); if (line != null) { ManageOneLine(line); } } while (line != null); }
/// <exception cref="System.IO.IOException"></exception> public virtual void Search(string fileName) { Java.IO.BufferedReader @in = new Java.IO.BufferedReader(new Java.IO.FileReader(fileName )); string line = null; do { line = @in.ReadLine(); if (line != null) { ManageOneLine(line); } }while (line != null); }
/// <summary> /// Handles OnClick event for list item. /// Reads the raw data from a .csv file and diplays it on textview. /// </summary> private void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e) { string fileName = e.View.FindViewById <TextView>(Resource.Id.tvListItem).Text; string path = MainActivity.ApplicationFolderPath + Java.IO.File.Separator + mSelectedFile + Java.IO.File.Separator + fileName; var reader = new Java.IO.BufferedReader(new Java.IO.FileReader(path)); string line = ""; string finalText = ""; while ((line = reader.ReadLine()) != null) { line = line.Replace(',', ' '); finalText += line + "\n"; } mTvDisplayRawData.Text = finalText; reader.Close(); }
private string reFile() { string ip = "0"; Java.IO.File sdCard = Android.OS.Environment.ExternalStorageDirectory; Java.IO.File dir = new Java.IO.File(sdCard.AbsolutePath + "/SonryVitaMote"); Java.IO.File file = new Java.IO.File(dir, "ip.scf"); if (!file.Exists()) { Toast.MakeText(this, "Remember to store an IP", ToastLength.Long).Show(); return("No IP Saved"); } else { Java.IO.FileReader fread = new Java.IO.FileReader(file); Java.IO.BufferedReader br = new Java.IO.BufferedReader(fread); ip = br.ReadLine(); fread.Close(); return(ip); } }
//Adapted from: https://stackoverflow.com/questions/3012287/how-to-read-mms-data-in-android private string GetMmsText(string id) { Android.Net.Uri partURI = Android.Net.Uri.Parse("content://mms/part/" + id); System.IO.Stream inputStream = null; System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); try { ContentResolver contentResolver = AndroidApp.Context.ContentResolver; inputStream = contentResolver.OpenInputStream(partURI); if (inputStream != null) { Java.IO.InputStreamReader inputStreamReader = new Java.IO.InputStreamReader(inputStream, "UTF-8"); Java.IO.BufferedReader reader = new Java.IO.BufferedReader(inputStreamReader); string temp = reader.ReadLine(); while (temp != null) { stringBuilder.Append(temp); temp = reader.ReadLine(); } } } catch (System.IO.IOException error) { Log.Error(TAG, "Error reading MMS text: " + error); } finally { if (inputStream != null) { try { inputStream.Close(); } catch (System.IO.IOException error) { Log.Error(TAG, "Error closing input stream for reading MMS text: " + error); } } } return(stringBuilder.ToString()); }
public static Boolean unRoot() { Java.Lang.Process rootProcess; try { rootProcess = Java.Lang.Runtime.GetRuntime().Exec(new String[] { "su", "-c", "mount -o rw,remount /system && " + "mv /system/xbin/su /system/xbin/subackup && " + "mv /system/bin/su /system/bin/subackup && " + "mount -o ro,remount /system" }); rootProcess.WaitFor(); try { Java.Lang.Process p = Java.Lang.Runtime.GetRuntime().Exec("subackup -c cd /system/bin/.ext && ls -ld .?* && mv /system/bin/.ext/.su /system/bin/.ext/.subackup "); Java.IO.BufferedReader input = new Java.IO.BufferedReader( new Java.IO.InputStreamReader(p.InputStream)); String line = null; while ((line = input.ReadLine()) != null) { Console.WriteLine(line); } } catch (Java.Lang.InterruptedException e) { e.PrintStackTrace(); } return(true); } catch (Java.Lang.InterruptedException e) { e.PrintStackTrace(); return(false); } }
private async Task Connect(string name) { BluetoothDevice device = null; BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter; BluetoothSocket bthSocket = null; _cancellationToken = new CancellationTokenSource(); while (_cancellationToken.IsCancellationRequested == false) { try { Thread.Sleep(250); adapter = BluetoothAdapter.DefaultAdapter; Console.Write("Trying to connect to " + name + ". "); foreach (var bondedDevice in adapter.BondedDevices) { if (bondedDevice.Name.ToUpper().IndexOf(name.ToUpper()) >= 0) { Console.Write("Found " + bondedDevice.Name); device = bondedDevice; break; } } if (device == null) { Console.Write("Not found"); } else { Console.WriteLine(); UUID uuid = UUID.FromString("00001101-0000-1000-8000-00805f9b34fb"); bthSocket = device.CreateInsecureRfcommSocketToServiceRecord(uuid); if (bthSocket != null) { Console.WriteLine("test"); await bthSocket.ConnectAsync(); if (bthSocket.IsConnected) { Console.WriteLine("Connected"); RVCC.MainPage.BluetoothConnect(); var mReader = new Java.IO.InputStreamReader(bthSocket.InputStream); var buffer = new Java.IO.BufferedReader(mReader); while (_cancellationToken.IsCancellationRequested == false) { if (MessageToSend != null) { Console.WriteLine(MessageToSend); var chars = MessageToSend.ToCharArray(); var bytes = new List <byte>(); foreach (var character in chars) { bytes.Add((byte)character); } await bthSocket.OutputStream.WriteAsync(bytes.ToArray(), 0, bytes.Count); MessageToSend = null; } } } } } } catch (Exception ex) { Console.Write(ex); Console.Write(ex.Message); } finally { if (bthSocket != null) { bthSocket.Close(); } device = null; adapter = null; } } }
public void loadCM() { try { int l = 0; string line; Java.IO.File sdCard = Android.OS.Environment.ExternalStorageDirectory; Java.IO.File dir = new Java.IO.File(sdCard.AbsolutePath + "/SonryVitaMote"); Java.IO.File file = new Java.IO.File(dir, "cm.scf"); Java.IO.FileReader fread = new Java.IO.FileReader(file); Java.IO.BufferedReader br = new Java.IO.BufferedReader(fread); while ((line = br.ReadLine()) != null) { switch (l) { case 0: s1.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 1: s2.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 2: s3.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 3: s4.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 4: s5.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 5: s6.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 6: s7.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 7: s8.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 8: s9.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 9: s10.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 10: s11.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 11: s12.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 12: s13.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 13: s14.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 14: s15.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 15: s16.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 16: s17.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 17: s18.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 18: s19.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; case 19: s20.SetSelection(allM.IndexOf((Keycode)Java.Lang.Integer.ParseInt(line))); break; } l++; } fread.Close(); } catch (Exception) { setDefaults(); saveCM(); } }
/// <summary> /// Reads the settings file for a specific peer. /// </summary> /// <returns>Peer with settings</returns> private Dictionary <string, ControllerSettings> ReadPeerSettings() { string fileName = MainActivity.ApplicationFolderPath + Java.IO.File.Separator + "settings" + Java.IO.File.Separator + "settings.csv"; var reader = new Java.IO.BufferedReader(new Java.IO.FileReader(fileName)); Dictionary <string, ControllerSettings> peerSettings = new Dictionary <string, ControllerSettings>(); string line = ""; bool isFirstTouch = true; while ((line = reader.ReadLine()) != null) { isFirstTouch = false; string[] parts = line.Split(','); string[] trimParts = parts[1].Split(';'); try { mLoggingActive = trimParts[3].Equals("true"); mMinYaw = Convert.ToInt32(trimParts[4] == "0" ? "-15" : trimParts[4]); mMaxYaw = Convert.ToInt32(trimParts[5] == "0" ? "15" : trimParts[5]); mMinPitch = Convert.ToInt32(trimParts[6] == "0" ? "-20" : trimParts[6]); mMaxPitch = Convert.ToInt32(trimParts[7] == "0" ? "20" : trimParts[7]); mMinRoll = Convert.ToInt32(trimParts[8] == "0" ? "-20" : trimParts[8]); mMaxRoll = Convert.ToInt32(trimParts[9] == "0" ? "20" : trimParts[9]); } catch (IndexOutOfRangeException ex) { mMinYaw = -15; mMaxYaw = 15; mMinPitch = -20; mMaxPitch = 20; mMinRoll = -20; mMaxRoll = 20; } peerSettings.Add(parts[0], new ControllerSettings { AltitudeControlActivated = false, Inverted = false, TrimYaw = Convert.ToInt16(trimParts[0]), TrimPitch = Convert.ToInt16(trimParts[1]), TrimRoll = Convert.ToInt16(trimParts[2]), LoggingActivated = mLoggingActive, MinYaw = mMinYaw, MaxYaw = mMaxYaw, MinPitch = mMinPitch, MaxPitch = mMaxPitch, MinRoll = mMinRoll, MaxRoll = mMaxRoll }); } if (isFirstTouch == true) { mMinYaw = -15; mMaxYaw = 15; mMinPitch = -20; mMaxPitch = 20; mMinRoll = -20; mMaxRoll = 20; } return(peerSettings); }
//Custom Mapping System public void loadCM() { try { int l = 0; string line; Java.IO.File sdCard = Android.OS.Environment.ExternalStorageDirectory; Java.IO.File dir = new Java.IO.File(sdCard.AbsolutePath + "/SonryVitaMote"); Java.IO.File file = new Java.IO.File(dir, "cm.scf"); Java.IO.FileReader fread = new Java.IO.FileReader(file); Java.IO.BufferedReader br = new Java.IO.BufferedReader(fread); while ((line = br.ReadLine()) != null) { switch (l) { case 0: bUp = (Android.Views.Keycode)Integer.ParseInt(line); break; case 1: bRi = (Android.Views.Keycode)Integer.ParseInt(line); break; case 2: bDo = (Android.Views.Keycode)Integer.ParseInt(line); break; case 3: bLe = (Android.Views.Keycode)Integer.ParseInt(line); break; case 4: bLt = (Android.Views.Keycode)Integer.ParseInt(line); break; case 5: bRt = (Android.Views.Keycode)Integer.ParseInt(line); break; case 6: bX = (Android.Views.Keycode)Integer.ParseInt(line); break; case 7: bC = (Android.Views.Keycode)Integer.ParseInt(line); break; case 8: bT = (Android.Views.Keycode)Integer.ParseInt(line); break; case 9: bS = (Android.Views.Keycode)Integer.ParseInt(line); break; case 10: bSe = (Android.Views.Keycode)Integer.ParseInt(line); break; case 11: bSt = (Android.Views.Keycode)Integer.ParseInt(line); break; case 12: aLu = (Android.Views.Keycode)Integer.ParseInt(line); break; case 13: aLd = (Android.Views.Keycode)Integer.ParseInt(line); break; case 14: aLl = (Android.Views.Keycode)Integer.ParseInt(line); break; case 15: aLr = (Android.Views.Keycode)Integer.ParseInt(line); break; case 16: aRu = (Android.Views.Keycode)Integer.ParseInt(line); break; case 17: aRd = (Android.Views.Keycode)Integer.ParseInt(line); break; case 18: aRl = (Android.Views.Keycode)Integer.ParseInt(line); break; case 19: aRr = (Android.Views.Keycode)Integer.ParseInt(line); break; } l++; } fread.Close(); } catch (System.Exception ex) { Log.Verbose("{1}", ex.ToString()); } }
/// <summary> /// Reads the settings file for a specific peer. /// If there is no settings file, default values are used. /// </summary> /// <returns>Peer with settings</returns> private Dictionary <string, ControllerSettings> ReadPeerSettings() { string fileName = MainActivity.ApplicationFolderPath + Java.IO.File.Separator + "settings" + Java.IO.File.Separator + "settings.csv"; var reader = new Java.IO.BufferedReader(new Java.IO.FileReader(fileName)); Dictionary <string, ControllerSettings> peerSettings = new Dictionary <string, ControllerSettings>(); string line = ""; bool isFirstTouch = true; while ((line = reader.ReadLine()) != null) { isFirstTouch = false; string[] parts = line.Split(','); string[] trimParts = parts[1].Split(';'); try { mLoggingActive = trimParts[3] == "True"; mLogBatteryActive = trimParts[4] == "True"; mLogRadarActive = trimParts[5] == "True"; mLogCollisionStatusActive = trimParts[6] == "True"; mLogControlsMobileActive = trimParts[7] == "True"; mLogControlsDroneActive = trimParts[8] == "True"; mLogDebug1Active = trimParts[9] == "True"; mLogDebug2Active = trimParts[10] == "True"; mLogDebug3Active = trimParts[11] == "True"; mLogDebug4Active = trimParts[12] == "True"; mMinYaw = Convert.ToInt32(trimParts[13] == "0" ? "-15" : trimParts[13]); mMaxYaw = Convert.ToInt32(trimParts[14] == "0" ? "15" : trimParts[14]); mMinPitch = Convert.ToInt32(trimParts[15] == "0" ? "-20" : trimParts[15]); mMaxPitch = Convert.ToInt32(trimParts[16] == "0" ? "20" : trimParts[16]); mMinRoll = Convert.ToInt32(trimParts[17] == "0" ? "-20" : trimParts[17]); mMaxRoll = Convert.ToInt32(trimParts[18] == "0" ? "20" : trimParts[18]); } catch (IndexOutOfRangeException ex) { mMinYaw = -15; mMaxYaw = 15; mMinPitch = -20; mMaxPitch = 20; mMinRoll = -20; mMaxRoll = 20; } if (mLoggingActive == true) { mLlLoggingOptions.Visibility = Android.Views.ViewStates.Visible; mBtLoggingOptions.Text = "Logging turned on"; mCbxBattery.Checked = mLogBatteryActive; mCbxRadarData.Checked = mLogRadarActive; mCbxCollisionStatus.Checked = mLogCollisionStatusActive; mCbxControlsMobile.Checked = mLogControlsMobileActive; mCbxControlsDrone.Checked = mLogControlsDroneActive; mCbxDebug1.Checked = mLogDebug1Active; mCbxDebug2.Checked = mLogDebug2Active; mCbxDebug3.Checked = mLogDebug3Active; mCbxDebug4.Checked = mLogDebug4Active; } peerSettings.Add(parts[0], new ControllerSettings { AltitudeControlActivated = false, Inverted = false, TrimYaw = Convert.ToInt16(trimParts[0]), TrimPitch = Convert.ToInt16(trimParts[1]), TrimRoll = Convert.ToInt16(trimParts[2]), LoggingActivated = mLogControlsMobileActive, MinYaw = mMinYaw, MaxYaw = mMaxYaw, MinPitch = mMinPitch, MaxPitch = mMaxPitch, MinRoll = mMinRoll, MaxRoll = mMaxRoll }); } if (isFirstTouch == true) { mMinYaw = -15; mMaxYaw = 15; mMinPitch = -20; mMaxPitch = 20; mMinRoll = -20; mMaxRoll = 20; } return(peerSettings); }
public static string readLine(this Java.IO.BufferedReader reader) { return(reader.ReadLine()); }
/// <summary> /// Handles OnClick event on a list item. /// Sets the current visualization data. /// </summary> private void OnListViewItemClick(object sender, AdapterView.ItemClickEventArgs e) { string title = mAdapter[e.Position]; string path = MainActivity.ApplicationFolderPath + Java.IO.File.Separator + mFilename + Java.IO.File.Separator + title + ".csv"; var reader = new Java.IO.BufferedReader(new Java.IO.FileReader(path)); string line = ""; if (title.Equals("controls")) { //throttle, yaw, pitch, roll try { mCurVisData.Points.Add("throttle", new List <DataPoint>()); mCurVisData.Points.Add("yaw", new List <DataPoint>()); mCurVisData.Points.Add("pitch", new List <DataPoint>()); mCurVisData.Points.Add("roll", new List <DataPoint>()); }catch (Exception ex) { mCurVisData.Points.Remove("throttle"); mCurVisData.Points.Remove("yaw"); mCurVisData.Points.Remove("pitch"); mCurVisData.Points.Remove("roll"); e.View.SetBackgroundColor(Color.White); return; } } else { try { mCurVisData.Points.Add(title, new List <DataPoint>()); }catch (Exception ex) { mCurVisData.Points.Remove(title); e.View.SetBackgroundColor(Color.White); return; } } while ((line = reader.ReadLine()) != null) { String[] p = line.Split(','); if (title.Equals("controls")) { float x = Convert.ToSingle(p[0]); float t = Convert.ToSingle(p[1]); float y = Convert.ToSingle(p[2]); float p2 = Convert.ToSingle(p[3]); float r = Convert.ToSingle(p[4]); int h = Convert.ToInt32(p[5]); mCurVisData.Points["throttle"].Add(new DataPoint(x, t)); mCurVisData.Points["yaw"].Add(new DataPoint(x, y)); mCurVisData.Points["pitch"].Add(new DataPoint(x, p2)); mCurVisData.Points["roll"].Add(new DataPoint(x, r)); if (h == 1) { mCurVisData.AltControlTime.Add(x); } } else if (!title.Equals("settings")) { float x = Convert.ToSingle(p[0]); float y = Convert.ToSingle(p[1]); int h = Convert.ToInt32(p[2]); mCurVisData.Points[title].Add(new DataPoint(x, y)); if (h == 1) { mCurVisData.AltControlTime.Add(x); } } } reader.Close(); e.View.SetBackgroundColor(Color.ParseColor("#928285")); }