示例#1
0
        // ---

        public override bool ExportGames(ICollection <DataRep> games)
        {
            bool result = false;

            try
            {
                MeEmit mee = new MeEmit()
                {
                    ByPass = true,
                };
                mee.SignalWrite     += (x, y) => this.SetStatus(x, new StateArg(y, false));
                mee.SignalWriteLine += (x, y) => this.SetStatus(x, new StateArg(y, false));
                HeTrace.AddMessenger("Mee", mee);

                foreach (var game in games)
                {
                    //string tmpPath = Path.Combine(Path.GetTempPath(), Path.GetFileNameWithoutExtension(game.Name));

                    ExportGame(game.CurrentPath);
                }
                result = true;
            }

            catch (Exception exc)
            {
                HeTrace.WriteLine(exc.Message);
                HeTrace.WriteLine(exc.StackTrace);
                result = false;
            }
            finally
            {
                HeTrace.RemoveMessenger("Mee");
            }
            return(result);
        }
示例#2
0
        internal bool InjectGamesFo(ICollection <DataRep> games)
        {
            bool result = false;

            try
            {
                MeEmit mee = new MeEmit()
                {
                    ByPass = true,
                };
                mee.SignalWrite     += (x, y) => this.SetStatus(x, new StateArg(y, false));
                mee.SignalWriteLine += (x, y) => this.SetStatus(x, new StateArg(y, false));
                HeTrace.AddMessenger("Mee", mee);

                foreach (var game in games)
                {
                    InjectGame(game.CurrentPath);
                }

                result = true;
            }
            catch (Exception exc)
            {
                HeTrace.WriteLine(exc.Message);
                HeTrace.WriteLine(exc.StackTrace);
                result = false;
            }
            finally
            {
                HeTrace.RemoveMessenger("Mee");
            }
            return(result);
        }
示例#3
0
        public W_Common()
        {
#if DEBUG
            MeDebug md = new MeDebug
            {
                ByPass = true,
            };
            HeTrace.AddMessenger("Debug", md);
#endif

            // Tracing
            MeSimpleLog log = new MeSimpleLog(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Common.Logs, $"{DateTime.Now.ToFileTime()}.log"))
            {
                LogLevel   = 1,
                FuncPrefix = EPrefix.Horodating,
                ByPass     = true,
            };

            log.AddCaller(this);
            HeTrace.AddLogger("C_LBDPG", log);


            InitializeComponent();
            DataContext = this;
        }
示例#4
0
        /// <summary>
        /// Initialization with a platform (edition)
        /// </summary>
        /// <param name="platform"></param>
        /// <returns></returns>
        public void InitializeEdition(string platformName)
        {
            if (string.IsNullOrEmpty(platformName))
            {
                throw new NullReferenceException("Object Plateform is null !");
            }


            if (Global.DebugMode)
            {
                HeTrace.WriteLine("Debug Mode Activé");
                PlatformObject = DebugPoint.FakePlatforms.First(x => x.Name.Equals(platformName));
            }
            else
            {
                PlatformObject = PluginHelper.DataManager.GetPlatformByName(platformName);
                HeTrace.WriteLine("Plugin Mode Activé");
            }


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

            // on récupère le dernier dossier visité
            ChosenFolder = Properties.Settings.Default.LastKPath;


            HeTrace.WriteLine("Initialisation");
            HeTrace.WriteLine($@"LaunchBox main path: {Global.LaunchBoxPath}");
            HeTrace.WriteLine($"Identified System: {PlatformObject.Name}");

            // Initialization of paths
            this.InitializePaths();

            // Detection du nom du dossier system (vérifié le 29/04/2021)
            if (string.IsNullOrEmpty(PlatformObject.Folder))
            {
                SystemFolderName = PlatformObject.Name;
            }
            else
            {
                // On prend le dernier dossier
                SystemFolderName = PlatformObject.Folder.Substring(PlatformObject.Folder.LastIndexOf(@"\") + 1);
            }

            HeTrace.WriteLine($"Identified Folder System: {SystemFolderName}");

            // Initialisation des folders name
            GamesFName   = Default.AppsFolder;
            ImagesFName  = Default.ImagesFolder;
            ManualsFName = Default.ManualsFolder;
            MusicsFName  = Default.MusicsFolder;
            VideosFName  = Default.VideosFolder;
        }
示例#5
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);
        }
示例#6
0
        public DPGMakerCore()
        {
            MeEmit mee = new MeEmit()
            {
                ByPass = true,
            };

            mee.SignalWrite     += (x, y) => this.SetStatus(x, new StateArg(y, false));
            mee.SignalWriteLine += (x, y) => this.SetStatus(x, new StateArg(y, false));
            HeTrace.AddMessenger("Mee", mee);
        }
示例#7
0
        internal bool InjectGamesFi(ICollection <DataRep> games)
        {
            ProgressTotal = games.Count();
            try
            {
                MeEmit mee = new MeEmit()
                {
                    ByPass = true,
                };
                mee.SignalWrite     += (x, y) => this.SetStatus(x, new StateArg(y, false));
                mee.SignalWriteLine += (x, y) => this.SetStatus(x, new StateArg(y, true));
                HeTrace.AddMessenger("Mee", mee);

                List <DataRep> folders = new List <DataRep>();

                // Extraction des données
                foreach (DataRep game in games)
                {
                    string tmpPath = Path.Combine(Config.HWorkingFolder, Path.GetFileNameWithoutExtension(game.Name));
                    game.DestPath = tmpPath;

                    // extraction
                    ExtractDataFiles(game, tmpPath);

                    folders.Add(new DataRep(tmpPath));
                }

                // Exportation
                foreach (DataRep game in games)
                {
                    InjectGame(game.DestPath);
                }

                return(true);
            }
            catch (Exception exc)
            {
                HeTrace.WriteLine(exc.Message);
                HeTrace.WriteLine(exc.StackTrace);
                return(false);
            }
            finally
            {
                HeTrace.RemoveMessenger("Mee");
            }
        }
示例#8
0
        /// <summary>
        /// Sert au traitement de packaging pour un jeu
        /// </summary>
        /// <param name="iD"></param>
        /// <param name="platformName"></param>
        public LaunchBoxCore(string platformName)
        {
            if (string.IsNullOrEmpty(platformName))
            {
                throw new Exception();
            }


            //_PlatformName = platformName;

            #region Initialisation des chemins
            _WFolder = Config.HWorkingFolder;
            // Chemin du dossier temporaire du system
            _SystemPath = Path.Combine(_WFolder, platformName);

            #endregion

            _XMLPlatformFile = Path.Combine(Config.HLaunchBoxPath, Config.PlatformsFolder, $"{platformName}.xml");
            _ZePlatform      = XML_Platforms.GetPlatformPaths(Path.Combine(Config.HLaunchBoxPath, Config.PlatformsFile), platformName);


            #region Messages
            MeDebug mdb = new MeDebug()
            {
                ByPass = true,
            };
            HeTrace.AddMessenger("Debug", mdb);

            // Réorientation via les signaux
            MeEmit mdE = new MeEmit()
            {
                ByPass = true,
            };
            HeTrace.AddMessenger("Signal", mdE);
            mdE.SignalWrite     += (x, y) => SetStatus(x, new StateArg(y, false));
            mdE.SignalWriteLine += (x, y) => SetStatus(x, new StateArg(y, false));

            #endregion

            XML_Games.Signal += (x, y) => SetStatus(x, new StateArg(y, false));
        }
示例#9
0
        public static void Main()
        {
            Global.DebugMode = true;

            Global.SetPluginLocation();

            Global.InitializeConfig();

            // Initialisation du messager
            MeDebug meD = new MeDebug()
            {
                //Prefix = "",
                LogLevel = 10,
                ByPass   = true,
            };
            //meD.AddCaller(prefix: "Debug >>>");

            MeSimpleLog meSL = new MeSimpleLog(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, prop.Default.LogFolder, prop.Default.LogFile))
            {
                LogLevel   = Global.Config.LogLvl,
                ByPass     = true,
                FuncPrefix = Hermes.Cont.EPrefix.Horodating | Hermes.Cont.EPrefix.Prefixing
            };

            meSL.AddCaller(prefix: "DeDebug >>>");

            HeTrace.AddMessenger("Debug", meD);
            HeTrace.AddLogger("Logger", meSL);

            Hermes.HeTrace.WriteLine("Test");

            // On indique manuellement en debug
            Global.LaunchBoxPath = @"G:\Frontend\LaunchBox\Core\";

            string[] tmp = Global.LaunchBoxPath.Split(@"\");

            Global.SetLaunchBoxRoot();


            // Création de fausses plateformes
            MvPlatform plat1 = new MvPlatform()
            {
                Name = "Don't exists/proche reel", Folder = @"G:\Ailleurs\Games\Sega Genesis"
            };
            MvPlatform plat2 = new MvPlatform()
            {
                Name = "Nintendo Entertainment System", Folder = @"i:\Games\NES"
            };
            MvPlatform plat3 = new MvPlatform()
            {
                Name = "Sega Master System", Folder = @""
            };
            MvPlatform plat4 = new MvPlatform()
            {
                Name = "Sega Master System", Folder = @"../../Plateformes/Games/Sega Master System"
            };
            MvPlatform plat5 = new MvPlatform()
            {
                Name = "different letter/proche reel", Folder = @"m:\Ailleurs\Games\Sega Genesis"
            };
            MvPlatform plat6 = new MvPlatform()
            {
                Name = "Racine de Disque", Folder = @"..\..\Games\Sega Genesis"
            };
            MvPlatform plat7 = new MvPlatform()
            {
                Name = "Normal", Folder = @"..\..\Plateformes\Games\Sega Mega Drive"
            };
            MvPlatform plat8 = new MvPlatform()
            {
                Name = "Metzo", Folder = @"..\Plateformes\Games\Sega Genesis"
            };
            MvPlatform plat9 = new MvPlatform()
            {
                Name = "racine", Folder = @"..\..\Games\Sega Mega Drive"
            };


            FakePlatforms = new ObservableCollection <IPlatform>();
            FakePlatforms.Add(plat1);
            FakePlatforms.Add(plat2);
            FakePlatforms.Add(plat3);
            FakePlatforms.Add(plat4);
            FakePlatforms.Add(plat5);
            FakePlatforms.Add(plat6);
            FakePlatforms.Add(plat7);
            FakePlatforms.Add(plat8);
            FakePlatforms.Add(plat9);

            //
            W_PlateformsList wpl = new W_PlateformsList();

            wpl.ShowDialog();
        }