Beispiel #1
0
        public void Initialize()
        {
            var userName = Environment.GetEnvironmentVariable("FritzBoxUserName");
            var password = Environment.GetEnvironmentVariable("FritzBoxPassword");

            _fb = new FritzClient {
                UserName = userName, Password = password
            };
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var userName = Environment.GetEnvironmentVariable("FritzBoxUserName");
            var password = Environment.GetEnvironmentVariable("FritzBoxPassword");

            var fritzBox = new FritzClient()
            {
                UserName = userName,
                Password = password
            };

            // Write csv file to the application folder
            fritzBox.WritePhonebookCsv(name: "Test Phonebook", folder: AppDomain.CurrentDomain.BaseDirectory, separator: ";");
        }
Beispiel #3
0
        private Dictionary <string, string> GetPhoneBook(string userName, string password)
        {
            Dictionary <string, string> book = new Dictionary <string, string>();

            Internals = new Dictionary <string, string>();

            FritzClient _fb = new FritzClient {
                UserName = userName, Password = password
            };

            phonebooksPhonebook phonebook = _fb.GetPhonebook("Telefonbuch");

            foreach (phonebooksPhonebookContact contact in phonebook.contact)
            {
                Log.Debug($"{contact.uniqueid}\t{contact.person[0].realName}\t{contact.telephony[0].number[0].Value}");

                foreach (phonebooksPhonebookContactTelephony phone in contact.telephony)
                {
                    foreach (phonebooksPhonebookContactTelephonyNumber number in phone.number)
                    {
                        string dial = Align(number.Value);
                        if (!string.IsNullOrEmpty(dial) &&
                            !book.ContainsKey(dial))
                        {
                            Log.Trace($"\t->{dial}");
                            book.Add(dial, contact.person[0].realName);
                        }
                        if (dial.StartsWith("**6"))
                        {
                            string homephone = dial.Substring(3);
                            if (!Internals.ContainsKey(homephone))
                            {
                                Log.Trace($"\t(internal)->{homephone}");
                                Internals.Add(homephone, contact.person[0].realName);
                            }
                        }
                    }
                }
            }
            return(book);
        }