static void Main(string[] args) { Palm palm = new Palm(); bool oneShot; if ((args.Length > 0) && (args[0].ToLower().CompareTo("/oneshot") == 0)) { oneShot = true; } else { oneShot = false; } palm.GetUsers(); if (palm.users.Length > 1) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new fMain(palm, prcFile, oneShot)); } else { palm.InstallToMemory(palm.users[0], prcFile); } }
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); } } Array.Sort(users, InvariantComparer.Default); } catch {} }
public fMain(Palm p, string file, bool os) { palm = p; prcFile = file; oneShot = os; InitializeComponent(); for (int idx = 0; idx < palm.users.Length; idx++) { cProfile.Items.Add(palm.users[idx]); } cProfile.SelectedIndex = 0; }
public int GetUserCount() { return(Palm.PltGetUserCount()); }