public void GetUsers() { try { int cnt = GetUserCount(), idx; StringBuilder userName = new StringBuilder(128); users = new string[cnt]; for (idx = 0; idx < cnt; idx++) { int size = userName.Capacity; if (Palm.PltGetUser(idx, userName, ref size) > 0) { users[idx] = userName.ToString(); } if (userName.Length > 0) { userName.Remove(0, userName.Length); } } } catch {} }
public fWizard() { string s = Environment.OSVersion.ToString(); win32 = s.Contains("Windows"); InitializeComponent(); config = new Config(); config.Load(); if ((config.dbPath != null) && (config.dbPath.Length > 0)) { if (File.Exists(config.dbPath) == false) { config.dbPath = null; } } else { config.dbPath = null; } if ((config.outputPath != null) && (config.outputPath.Length > 0)) { if (Directory.Exists(config.outputPath) == false) { config.outputPath = null; } } else { config.outputPath = null; } if (win32) { if (config.dbPath == null) { RegistryKey key; config.dbPath = ""; if ((key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\HP\instant contact")) != null) { string p; if ((p = (string)key.GetValue("workingDirectory")) != null) { if (p.EndsWith(@"\") == true) { p = p.Substring(0, p.Length - 1); } if (File.Exists(p + @"\database\PDA\database.ddb") == true) { config.dbPath = p + @"\database\PDA\database.ddb"; } else if (File.Exists(p) == true) { config.dbPath = p; } } key.Close(); } } if (config.outputPath == null) { config.outputPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\HP\PeopleFinder Offline for Palm OS"; } palm = new Palm(); palm.GetUsers(); } else { config.dbPath = ""; palm = null; } }
public int GetUserCount() { return(Palm.PltGetUserCount()); }