Esempio n. 1
0
        public static async Task <Tuple <RabotoraGameProject, RabotoraScript> > InitializeAsync(string gameBasePath)
        {
            try
            {
                var project = await RabotoraGameProject.CreateFromGamePathAsync(gameBasePath);

                if (project != null)
                {
                    var entryScriptDataWrapper = project.SystemPack["/main.rts"];
                    if (entryScriptDataWrapper.HasValue)
                    {
                        var entryScript = RabotoraScript.LoadScript("%system%/main.rts", "main", entryScriptDataWrapper.Value.ToArray());
                        return(Tuple.Create(project, entryScript));
                    }
                    else
                    {
                        throw new RabotoraException($"Failed to initialize Rabotora Game Project: Cannot find entry script data in {RabotoraDataPack.PackTypeToFileName(PackageType.SystemPack)}.");
                    }
                }
                else
                {
                    throw new RabotoraException($"Failed to initialize Rabotora Game Project.");
                }
            }
            catch (RabotoraException)
            {
                throw;
            }
        }
Esempio n. 2
0
        private static async Task InitializeLauncher()
        {
            try
            {
                var projGroup = await RabotoraStartup.InitializeAsync(AppContext.BaseDirectory);

                MainProject = projGroup.Item1;
                EntryScript = projGroup.Item2;
            }
            catch (RabotoraException ex)
            {
                MessageBox.Show(ex.Message, "Failed to initialize Rabotora Launcher", MessageBoxButton.OK, MessageBoxImage.Error);
#if DEBUG
                return;
#else
                Environment.Exit(0);
#endif
            }
        }