Esempio n. 1
0
        public static FileManagerDesktop LoadFileManager(string staticDataDirAbs,
                                                         string dynamicDataDirAbs,
                                                         string packageDirAbs,
                                                         string logFileAbs,
                                                         string configFileRel,
                                                         string savedGamesRel)
        {
            var fileManager = new FileManagerDesktop(staticDataDirAbs,
                                                     dynamicDataDirAbs,
                                                     packageDirAbs,
                                                     logFileAbs,
                                                     configFileRel,
                                                     savedGamesRel);

            if (!Directory.Exists(fileManager.DynamicDirPath))
            {
                Directory.CreateDirectory(fileManager.DynamicDirPath);
            }

            if (!Directory.Exists(fileManager.SaveGameDirAbsolutePath))
            {
                Directory.CreateDirectory(fileManager.SaveGameDirAbsolutePath);
            }

            if (!Directory.Exists(fileManager.PackageDirectoryPath))
            {
                Directory.CreateDirectory(fileManager.PackageDirectoryPath);
            }

            File.Create(fileManager.LogPath).Dispose();

            return(fileManager);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
#if DEBUG
            string appDataAppPath = Path.Combine(Directory.GetCurrentDirectory(), "DynData");
#else
            string appDataAppPath = null;
            if ((appDataAppPath = ConfigurationManager.AppSettings["appDataPath"]) == null)
            {
                appDataAppPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), appDataDirName);
            }
#endif


            MHUrhoApp.FileManager = FileManagerDesktop.LoadFileManager(Directory.GetCurrentDirectory(),
                                                                       appDataAppPath,
                                                                       Path.Combine(appDataAppPath, "Packages"),
                                                                       Path.Combine(appDataAppPath, "Log.txt"),
                                                                       "config.xml",
                                                                       "SavedGames");

            MHUrhoApp.StartupArgs = StartupOptions.FromCommandLineParams(args, MHUrhoApp.FileManager);

            try {
                var appOptions = new ApplicationOptions("Data");
                new MHUrhoApp(appOptions).Run();
            }
            catch (InvalidOperationException e) {
                //Ignore, Error with the current release of UrhoSharp https://github.com/xamarin/urho-samples/issues/45
            }
        }