private void loginButton_Click(object sender, EventArgs e) { voiceConnection = new Voice(loginEmail.Text, loginPass.Text); voiceConnection.login(); callGroup.Enabled = true; smsGroup.Enabled = true; }
private void loginButton_Click(object sender, EventArgs e) { try { voiceConnection = new Voice(loginEmail.Text, loginPass.Text); callGroup.Enabled = true; smsGroup.Enabled = true; Folder inbox = voiceConnection.SMS; listView1.Groups.Add(Folder.SMS, "Inbox"); foreach (SharpVoice.Message msg in inbox.Messages) { ListViewItem item = new ListViewItem(listView1.Groups[Folder.SMS]); item.Text = msg.displayNumber; listView1.Items.Add(item); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// The main entry point for the application. /// </summary> //[STAThread] static void Main() { try { /*Visual Form = new Visual(); Form.ShowDialog(); */ #region persistance string cookieData = "cookie.dat"; var formatter = new BinaryFormatter(); if (File.Exists(cookieData)) using (Stream s = File.OpenRead(cookieData)) Voice.cookiejar = formatter.Deserialize(s) as System.Net.CookieContainer; #endregion ConsoleKeyInfo c = new ConsoleKeyInfo(); string email = "", password = "", smsPin = ""; Console.Write("Email: "); email = Console.ReadLine(); Console.Write("Password: "******"PIN (leave blank if you don't use 2-factor auth): "); smsPin = Console.ReadLine(); Voice v; if (string.IsNullOrEmpty(smsPin)) { v = new Voice(email, password, true); } else { v = new Voice(email, password, true, smsPin); } /* Console.Write("To (phone #): "); string to = Console.ReadLine(); Console.Write("Message: "); string msg = Console.ReadLine(); v.SendSMS(to, msg); */ Voice.MaxPages = 10; // Testing SMS foreach (SharpVoice.Message m in v.SMS.Messages) Console.WriteLine(string.Format("{0} - {1}",m.DisplayNumber,m.Text)); #region persistance using (Stream s = File.Create(cookieData)) formatter.Serialize(s, Voice.cookiejar); #endregion Console.WriteLine("Done"); Console.Read(); } catch (Exception e) { Console.WriteLine(e); //MessageBox.Show(e.Message);//more Debug help Console.Read(); } }
int type;// (1 - Home, 2 - Mobile, 3 - Work, 4 - Gizmo) public Phone(Voice v, string data) { //Phone(voice, data) }
static void Main() { /* // Give me your username Console.WriteLine("Enter Your Google Voice Username, eg [email protected]:"); String userName = null; try { userName = Console.ReadLine(); } catch { Console.WriteLine("IO error trying to read your name!"); return; } // And your password Console.WriteLine("Enter Your Password:"******"IO error trying to read your name!"); return; } // I honestly don't have a clue what this if for... // it was in the java code, so I left it but I don't think it's used for anything. Console.WriteLine("Enter A \"Source\" for the Log:"); String source = null; try { source = Console.ReadLine(); } catch { Console.WriteLine("IO error trying to read your name!"); return; } // the really long string you have to get from the google voice site source. Console.WriteLine("Log into Google Voice and find the _rnr_se variable in the page Source. "); Console.WriteLine("Enter rnr_se_ value:"); String rnrSee = null; try { rnrSee = Console.ReadLine(); } catch { Console.WriteLine("IO error trying to read your name!"); return; } */ try { string email = "*****@*****.**"; Console.Write("Login for "+email+"; password: "******"7175216367", "5705036367"); voice.logout(); /* try { XmlDocument test = new XmlDocument(); try { test.Load("sms.log"); XmlNodeList list = test.ChildNodes; list = list[1].ChildNodes; //list = list[0].ChildNodes; //XPath xpath = XPathFactory.newInstance().newXPath(); XPathDocument doc = new XPathDocument("inbox.log"); //InputSource isource = new InputSource(method.getResponseBodyAsStream()); XPathNavigator nav = doc.CreateNavigator(); nav.MoveToRoot(); XPathNodeIterator NodeIter; NodeIter = nav.Select("/response/json"); while (NodeIter.MoveNext()) { Console.WriteLine("test: {0}", NodeIter.Current.Value); }; //out = xpath.evaluate("/response/json", isource); } catch (Exception e) { MessageBox.Show(e.Message); } /* // This code is for sending text messages... Console.Write("Number: "); string number = Console.ReadLine(); Console.Write("Message: "); string msg = Console.ReadLine(); MessageBox.Show( voice.sendSMS(number, msg)); */ /* // This code is for getting the XML data from google about // information in your inboxes. // Parse it yourself, I'm too lazy to do it. File.WriteAllText("inbox.log", voice.getInbox()); Thread.Sleep(2000); File.WriteAllText("missed.log",voice.getMissed()); Thread.Sleep(2000); File.WriteAllText("placed.log",voice.getPlaced()); Thread.Sleep(2000); File.WriteAllText("received.log",voice.getReceived()); Thread.Sleep(2000); File.WriteAllText("recent.log",voice.getRecent()); Thread.Sleep(2000); File.WriteAllText("recorded.log",voice.getRecorded()); Thread.Sleep(2000); File.WriteAllText("sms.log",voice.getSMS()); Thread.Sleep(2000); File.WriteAllText("spam.log",voice.getSpam()); Thread.Sleep(2000); File.WriteAllText("starred.log",voice.getStarred()); Thread.Sleep(2000); Console.ReadLine(); } catch( Exception e) { Debug.WriteLine(e.StackTrace); MessageBox.Show(e.Message);//Debug help }*/ } catch (IOException e) { Debug.WriteLine(e.StackTrace); MessageBox.Show(e.Message);//more Debug help } }