Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="platform"></param>
        /// <param name="previousPlatformState">Etat précédent, si disponible</param>
        public GamePathsModel(IPlatform selectedPlatform, string previousPlatformName = null)
        {
            if (selectedPlatform == null)
            {
                throw new NullReferenceException("Object Plateform is null !");
            }

            Core.UpdateStatus    += (x, y) => HeTrace.WriteLine(y.Message);
            Core.SelectedPlatform = selectedPlatform;

            SelectedPlatform  = selectedPlatform;
            Core.PlatformName = SelectedPlatform.Name;
            Core.ChosenMode   = GamePathMode.None;

            if (Global.DebugMode)
            {
                DebugResources.Set_GamesPaths(selectedPlatform.Name);
            }

            //
            Core.AddAppPaths = Properties.Settings.Default.cgpAddApp;

            // Messenger
            Mev = new MeVerbose()
            {
                ByPass   = true,
                LogLevel = Global.Config.VerbLvl,
            };
            HeTrace.AddMessenger("Verbose", Mev);
            HeTrace.WriteLine("Initialisation"); // NewLine

            HeTrace.WriteLine($"[CGamePaths] [InitializeEdition] Initialisation");

            HeTrace.WriteLine($@"LaunchBox main path: {Global.LaunchBoxPath}"); // NewLine
            HeTrace.WriteLine($@"Platform '{Core.PlatformName}' selected");     // NewLine


            // --- Initialisation de la plateforme actuelle
            Core.InitializePlatform();

            // --- Récupération des jeux (Async)
            PrepareInitializeGames();

            // --- Initialisation des champs grâce à l'ancienne plateforme
            if (!string.IsNullOrEmpty(previousPlatformName))
            {
                Core.PlatformToReplace = previousPlatformName;
            }
            else
            {
                Core.PlatformToReplace = FindBadPlatform();
            }


            //    ToReplace = Platform_Tools.GetRoot_ByFolder(PreviousPlatform.Folder);
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IPlatformFolder[] GetAllPlatformFolders()
        {
            string folderCont = string.Empty;

            // Cherche les plateformes dans le debug
            switch (Name)
            {
            case "Sega Master System":
                return(DebugResources.Get_PlatformPaths(Name));

            case "Metzo":
                folderCont = Folder.Substring(Folder.LastIndexOf(@"\") + 1);
                return(DebugResources.Get_PlatformPaths(folderCont, "G:", @"Frontend\Plateformes"));

            default:

                folderCont = Folder.Substring(Folder.LastIndexOf(@"\") + 1);
                return(DebugResources.Get_PlatformPaths(folderCont, @"G:", "Plateformes"));
            }
        }