コード例 #1
0
        public static void Main()
        {
            string space = new string(' ', 1);
            bool   do2   = false;

            string[] userData = new string[5];

            Exceptions.NeaFolderDataCheck();

            Exceptions.NoUserFolderCatch();

            PostFirstTimeSetupFlow();

            do
            {
                Console.WriteLine("Do you have an account? Yes or No?"); //Ask user if they have an account
                string AccountCheck = Console.ReadLine().ToLower();      //Save response
                AccountCheck.ToLower();

                Console.WriteLine(space);

                switch (AccountCheck) //Switch statement to check response
                {
                case "yes":
                    Console.Clear();
                    Login.SignIn();     //Move to method SignIn in class Login
                    break;

                case "no":
                    userData    = UserInfo();                                //Call method UserInfo to get user info, store return data in an array
                    userData[4] = userData[0].Substring(0, 3) + userData[2]; //Create userName and put it into the array
                    Console.WriteLine("Your username is {0}", userData[4]);

                    FileOps.MainFW(userData.ToArray());     //Call FileOps.MainFW passing userData along
                    break;

                default:     //If the users reponse didn't equal yes or no
                    Console.WriteLine("Error incorrect response");
                    Console.WriteLine(space);
                    do2 = true;
                    break;
                }
            } while (do2 == true);

            Console.ReadKey();
        }
コード例 #2
0
        static void PostFirstTimeSetupFlow()
        {
            string[] userData = new string[5];

            string        root         = FileOps.GetRoot();
            DirectoryInfo countFolders = new DirectoryInfo(FileOps.GetCustomUserFolder(root));

            int postFirstTimeSetupCheck = countFolders.EnumerateDirectories().Count();

            if (postFirstTimeSetupCheck == 1)
            {
                Console.WriteLine("No user accounts detected, press any key to continue");
                Console.ReadKey();
                userData = UserInfo();

                userData[4] = userData[0].Substring(0, 3) + userData[2];
                Console.WriteLine("Your username is {0}", userData[4]);

                FileOps.MainFW(userData.ToArray());
            }

            return;
        }