Exemple #1
0
        /// <summary>
        /// Build Users array.
        /// </summary>
        public void GetUsers()
        {
            try
            {
                int cnt = GetUserCount(), idx;

                if (cnt > 0)
                {
                    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 {}
        }
Exemple #2
0
        /// <summary>
        /// Return backup directory for this profile.
        /// </summary>
        /// <param name="profile">Profile</param>
        /// <returns>Path.</returns>
        public string GetBackupDir(string profile)
        {
            try {
                StringBuilder path = new StringBuilder(512);
                int           size = path.Capacity;

                if (Palm.PltGetUserDirectory(profile, path, ref size) > 0)
                {
                    path.Append("\\backup");
                    return(path.ToString());
                }
            }
            catch {}

            return(null);
        }
Exemple #3
0
        public fProfile(Palm palm, string profile)
        {
            int selIdx = -1;

            InitializeComponent();

            okClicked = false;
            for (int idx = 0; idx < palm.users.Length; idx++)
            {
                if (profile == palm.users[idx])
                {
                    selIdx = idx;
                }

                cProfile.Items.Add(palm.users[idx]);
            }

            cProfile.SelectedIndex = selIdx;
        }
Exemple #4
0
 /// <summary>
 /// Return number # of HotSync users registered on this PC.
 /// </summary>
 /// <returns>Count.</returns>
 public int GetUserCount()
 {
     return(Palm.PltGetUserCount());
 }
Exemple #5
0
        public fMain()
        {
            InitializeComponent();

            config = new Config();
            config.Load();

            if (Environment.OSVersion.ToString().IndexOf("Windows") > -1)
            {
                palm = new Palm();
                palm.GetUsers();

                if (palm.users != null)
                {
                    mMainProfileOpen.Enabled = true;
                }

                if ((config.currentDB == null) || (config.currentDB.Length == 0))
                {
                    if ((config.profile == null) || (config.profile.Length == 0))
                    {
                        config.profile = GetProfile(null);
                    }

                    if ((config.profile != null) && (config.profile.Length > 0))
                    {
                        config.currentDB = palm.GetBackupDir(config.profile) + "\\iSec_iSecur_Data.pdb";

                        if (File.Exists(config.currentDB) == false)
                        {
                            MessageBox.Show("The selected user has not yet HotSync'ed the iSecur database - please locate the database file manually.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            config.currentDB = "";
                        }
                    }
                }
            }

            if ((config.currentDB == null) || (config.currentDB.Length == 0))
            {
                if (ofdDatabase.ShowDialog() == DialogResult.OK)
                {
                    config.currentDB = ofdDatabase.FileName;
                }
            }

            if ((config.currentDB != null) && (config.currentDB.Length > 0))
            {
                if (File.Exists(config.currentDB) == false)
                {
                    if (ofdDatabase.ShowDialog() == DialogResult.OK)
                    {
                        LoadDatabase(ofdDatabase.FileName);
                    }
                }
                else
                {
                    LoadDatabase(config.currentDB);
                }
            }

            switch (config.showIdx)
            {
            case 1:
                rbSecrets.Checked = true;
                break;

            case 2:
                rbTemplates.Checked = true;
                break;

            default:
                rbAll.Checked = true;
                break;
            }
        }