Beispiel #1
0
        /// <summary>
        ///   Interprets the profile name from the lastprof.txt file.
        /// </summary>
        public void Load()
        {
            try
            {
                var data   = ReadAllText();
                var split  = data.Split('\\');
                var offset = split.Length - 2;
                Profile = split[offset];
            }
            catch (System.IndexOutOfRangeException e)
            {
                var msg = " -- LASTPROFILE.LOAD FAILED" + NewLine
                          + " Error:  " + e.ToString() + NewLine;
                var log = (File)Exception;
                log.AppendAllText(msg);
                Error(e.Message + " -- LASTPROFILE.LOAD FAILED");

                Core("Recreating LastProf.txt...");
                {
                    Profile firstProfile = new Profile();
                    string  userPath     = System.IO.Path.GetDirectoryName(Path);
                    try
                    {
                        firstProfile = HCE.Profile.List(Custom.Profiles(userPath)).First();
                        // TODO : validate profile. Is it corrupted?
                        Name = firstProfile.Name;
                    }
                    catch (System.Exception)
                    {
                        NewProfile.Generate(userPath, this, firstProfile, Directory.Exists(Custom.Profiles(userPath)));
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///   Interprets the profile name from the lastprof.txt file.
        /// </summary>
        public void Load()
        {
            try
            {
                var data   = ReadAllText();
                var split  = data.Split('\\');
                var offset = split.Length - 2;
                Profile = split[offset];
            }
            catch (System.IndexOutOfRangeException e)
            {
                var msg = " -- LASTPROFILE.LOAD FAILED" + NewLine
                          + " Error:  " + e.ToString() + NewLine;
                var log = (File)Exception;
                log.AppendAllText(msg);
                Error(e.Message + " -- LASTPROFILE.LOAD FAILED");

                Core("Recreating LastProf.txt...");
                {
                    var pathParam    = System.IO.Path.GetDirectoryName(Path);
                    var firstProfile = (Profile)Custom.Profile(pathParam, "New001");

                    try
                    {
                        // TODO : validate profile. Is it corrupted?
                        if (HCE.Profile.List().Count != 0)
                        {
                            firstProfile = HCE.Profile.List(Custom.Profiles(pathParam))[0];
                            Name         = firstProfile.Name;
                        }
                        else
                        {
                            NewProfile.Create(pathParam, this, firstProfile);
                        }
                    }
                    catch (System.Exception)
                    {
                        NewProfile.Create(pathParam, this, firstProfile);
                    }
                }
            }
        }