public virtual bool Update(CDriver.Progress progress) { if (!progress(0)) { return(false); } base.Clear(); Hashtable hashtable = new Hashtable(); int portCount = this.MedSettings.PortCount; for (int i = 1; i <= portCount; i++) { if (hashtable.ContainsKey(this.MedSettings.GetPort(i))) { Console.WriteLine("Error: port already enabled"); } else { hashtable.Add(this.MedSettings.GetPort(i), null); } } portCount = this.MedApplication.PortCount; for (int j = 1; j <= portCount; j++) { int num; string portName; this.MedApplication.GetPort(j, out num, out portName); int portType; int portNumber; this.MedApplication.GetPortCharacteristics(num, out portType, out portNumber); base.AddLast(new CPort(this, num, portName, portType, portNumber, hashtable.ContainsKey(num))); } return(progress(1000)); }
public virtual bool Update(CDriver.Progress progress) { this.InvalidateChildren(); this.MedSmsFolder.CacheControl(2); if (this.MedSmsFolder != null) { IOperation operation = this.MedSmsFolder.Cache() as IOperation; if (!CDriver.OperationToProgress(operation, progress, 0, 500)) { return(false); } int streamCount = this.MedSmsFolder.StreamCount; for (int i = 1; i <= streamCount; i++) { ISMS iSMS = this.MedSmsFolder.GetStream(i) as ISMS; if (iSMS.Empty == 0 && iSMS.Type != 5) { base.AddLast(new CSmsItem(this, iSMS)); } if (!progress(1000 * i / streamCount / 2 + 500)) { return(false); } } } return(progress(1000)); }
internal static bool OperationToProgress(IOperation operation, CDriver.Progress progress, int min, int max) { while (operation.Status == 0) { int num; if (operation.Max > operation.Min) { num = (max - min) * (operation.Current - operation.Min) / (operation.Max - operation.Min); } else { num = (min + max) / 2; } if (num == 0) { num = 1; } if (!progress(num)) { operation.Cancel(); operation.Wait(); return(false); } Thread.Sleep(100); } if (operation.Status == 1) { return(true); } throw new Exception("Item number : " + ((operation.Result != null) ? operation.Result.ToString() : "0") + " HRESULT : " + operation.Error.ToString()); }
public virtual bool Update(CDriver.Progress progress) { if (!progress(0)) { return(false); } base.Clear(); Hashtable hashtable = new Hashtable(); int phoneCount = this.MedSettings.PhoneCount; for (int i = 1; i <= phoneCount; i++) { hashtable.Add(this.MedSettings.GetPhone(i), null); } phoneCount = this.MedApplication.PhoneCount; for (int j = 1; j <= phoneCount; j++) { int num; string manufacturer; string model; this.MedApplication.GetPhone(j, out num, out manufacturer, out model); base.AddLast(new CModel(this, num, manufacturer, model, hashtable.ContainsKey(num))); } return(progress(1000)); }
public virtual bool Update(CDriver.Progress progress) { if (!progress(0)) { return(false); } base.Clear(); foreach (CSource cSource in this) { cSource._Online = false; } int sourceCount = this.MedApplication.SourceCount; for (int i = 1; i <= sourceCount; i++) { IMedDataSource medDataSource = (IMedDataSource)this.MedApplication.GetSource(i); bool flag = true; foreach (CSource cSource2 in this) { if (cSource2.UniqueIdentifier == medDataSource.UniqueId) { cSource2._Online = true; flag = false; } } if (flag) { switch (medDataSource.Type) { case 0: case 3: case 4: case 5: case 6: IL_FD: base.AddLast(new CSource(this, medDataSource)); goto IL_128; case 1: base.AddLast(new CSource.CMobilePhone(this, medDataSource)); goto IL_128; case 2: base.AddLast(new CSource.CSIMCard(this, medDataSource)); goto IL_128; } //goto IL_FD; } IL_128: if (!progress(i * 999 / sourceCount)) { return(false); } } return(progress(1000)); }
public virtual bool Push(CDriver.Progress progress) { if (!progress(0)) { return(false); } this.Commit(); this.MedSettings.Save(); return(progress(1000)); }
public virtual bool Push(CDriver.Progress progress) { if (!progress(0)) { return(false); } IOperation operation = this.MedFolder.Flush() as IOperation; operation.Wait(); return(progress(1000)); }
public void InstallConnector(CDriver.Progress progress) { if (this.IsConnectorRequired) { IOperation operation = this.MobilePhone.InstallConnector() as IOperation; if (operation != null && !CDriver.OperationToProgress(operation, progress, 0, 500)) { throw new Exception("Installation of the connector failed"); } } }
public virtual bool Push(CDriver.Progress progress) { for (int i = 0; i < this.EmptyListsToPush.Length; i++) { for (int j = 0; j < this.MedOrganizers[i].StreamCount; j++) { IOrganizerItem organizerItem = this.MedOrganizers[i].GetStream(j + 1) as IOrganizerItem; organizerItem.GetType(); } foreach (IOrganizerItem current in this.EmptyListsToPush[i]) { current.Commit(); } } if (this.Events != null) { foreach (COrganizerEntry cOrganizerEntry in this.Events) { cOrganizerEntry.Commit(); } } if (this.Notes != null) { foreach (COrganizerEntry cOrganizerEntry2 in this.Notes) { cOrganizerEntry2.Commit(); } } if (this.Tasks != null) { foreach (COrganizerEntry cOrganizerEntry3 in this.Tasks) { cOrganizerEntry3.Commit(); } } int min = 0; int max = 1000 / ((this.MedOrganizers.Length > 0) ? this.MedOrganizers.Length : 1); for (int k = 0; k < this.MedOrganizers.Length; k++) { IOrganizer organizer = this.MedOrganizers[k]; for (int l = 0; l < organizer.StreamCount; l++) { IOrganizerItem organizerItem2 = organizer.GetStream(l + 1) as IOrganizerItem; organizerItem2.GetType(); } IOperation operation = organizer.Flush() as IOperation; if (!CDriver.OperationToProgress(operation, progress, min, max)) { return(false); } } return(progress(1000)); }
public virtual bool Push(CDriver.Progress progress) { foreach (IPhonebookItem current in this.EmptyListToPush) { current.Save(); } foreach (CPhonebookEntry cPhonebookEntry in this) { cPhonebookEntry.Commit(); } IOperation operation = this.MedPhonebook.Flush() as IOperation; return(CDriver.OperationToProgress(operation, progress, 0, 1000)); }
public virtual bool Update(CDriver.Progress progress) { this.InvalidateChildren(); int subfolderCount = this.MedFolder.SubfolderCount; for (int i = 1; i <= subfolderCount; i++) { IFolder medFolder = (IFolder)this.MedFolder.GetSubfolder(i); base.AddLast(new CFolder(this, medFolder)); if (!progress(i * 1000 / subfolderCount)) { return(false); } } return(progress(1000)); }
public virtual bool Update(CDriver.Progress progress) { this.InvalidateChildren(); int fileCount = this.MedFolder.FileCount; for (int i = 1; i <= fileCount; i++) { IFolderFile medFolderFile = (IFolderFile)this.MedFolder.GetFile(i); base.AddLast(new CFile(this, medFolderFile)); if (!progress(i * 1000 / fileCount + 1000)) { return(false); } } return(progress(1000)); }
public virtual bool Update(CDriver.Progress progress) { this.InvalidateChildren(); IOperation operation = this.MedPhonebook.Cache() as IOperation; if (!CDriver.OperationToProgress(operation, progress, 0, 500)) { return(false); } int num = 0; try { num = this.MedPhonebook.StreamCount; } catch (Exception ex) { Console.WriteLine(this.ToString() + "Unable to query StreamCount property [ " + ex.Message + " ]"); return(true); } for (int i = 1; i <= num; i++) { IPhonebookItem phonebookItem = (IPhonebookItem)this.MedPhonebook.GetStream(i); if (phonebookItem.Empty == 0) { base.AddLast(new CPhonebookEntry(this, phonebookItem)); } else { this.EmptyList.AddFirst(phonebookItem); } if (!progress(1000 * i / num / 2 + 500)) { return(false); } } return(progress(1000)); }
public bool Send(CDriver.Progress progress) { if (!progress(0)) { return(false); } byte[] validity = new byte[] { (byte)this.Validity }; bool flag = false; int num = 160; if (this.Text.Length > 160) { num = 152; flag = true; } int i = 0; int num2 = 0; int num3 = (this.Text.Length + num - 1) / num; int num4 = new Random().Next(65535); while (i < this.Text.Length) { string strText; if (this.Text.Length - i + 1 < num) { strText = this.Text.Substring(i); } else { strText = this.Text.Substring(i, num); } bool flag2 = this.RequestReport && (!flag || num2 == num3 - 1); byte[] header; if (flag) { header = new byte[] { 8, 4, (byte)(num4 / 256), (byte)(num4 % 256), (byte)num3, (byte)(num2 + 1) }; } else { header = new byte[0]; } IOperation operation = (base.Parent as CSms).MedSmsOutbox.SendSMSEx(0, this.Reference, 16 | (flag2 ? 32 : 0), validity, this.Number, 129, this.ServiceCenter, 129, strText, header) as IOperation; operation.Wait(); if (!progress(999 * (num2 + 1) / num3)) { return(false); } num2++; i = num2 * num; } return(progress(1000)); }
public virtual bool Activate(string key, string user, string company, string oem, CDriver.Progress progress) { IOperation operation; try { operation = (IOperation)this.MedLicense.Activate(key, user, company, oem); } catch (Exception ex) { throw new Exception(this.ToString() + " : Activation failed [ " + ex.Message + " ]", ex); } if (!CDriver.OperationToProgress(operation, progress, 0, 1000)) { return(false); } if (operation.Status != 1) { throw new Exception(this.ToString() + " : Activation failed with error " + operation.Error.ToString()); } return(true); }
public bool Update(CDriver.Progress progress) { if (this.Events != null) { this.Events.Invalidate(); } if (this.Tasks != null) { this.Tasks.Invalidate(); } if (this.Notes != null) { this.Notes.Invalidate(); } for (int i = 0; i < this.EmptyListsToPush.Length; i++) { this.EmptyListsToPush[i].Clear(); this.EmptyLists[i].Clear(); } int num = 0; int num2 = 1000 / ((this.MedOrganizers.Length > 0) ? this.MedOrganizers.Length : 1); for (int j = 0; j < this.MedOrganizers.Length; j++) { IOrganizer organizer = this.MedOrganizers[j]; IOperation operation = organizer.Cache() as IOperation; if (!CDriver.OperationToProgress(operation, progress, num, num + num2 / 2)) { return(false); } int num3; try { num3 = organizer.StreamCount; } catch (Exception ex) { Console.WriteLine(this.ToString() + "Unable to query StreamCount property [ " + ex.Message + " ]"); num3 = 0; } for (int k = 1; k <= num3; k++) { IOrganizerItem organizerItem = (IOrganizerItem)organizer.GetStream(k); if (organizerItem.Type == 1) { this.Events.AddLast(new COrganizerEntry(this.Events, organizerItem, this.Events.EntryDescriptor)); } else { if (organizerItem.Type == 3) { this.Notes.AddLast(new COrganizerEntry(this.Notes, organizerItem, this.Notes.EntryDescriptor)); } else { if (organizerItem.Type == 2) { this.Tasks.AddLast(new COrganizerEntry(this.Tasks, organizerItem, this.Tasks.EntryDescriptor)); } else { this.EmptyLists[j].AddLast(organizerItem); } } } if (!progress(num + num2 * k / num3 / 2 + num2 / 2)) { return(false); } } num += num2; } return(progress(1000)); }
public virtual bool Push(CDriver.Progress progress) { IOperation operation = this.MedSmsFolder.Flush() as IOperation; return(CDriver.OperationToProgress(operation, progress, 0, 1000)); }