コード例 #1
0
        public LaunchGameTask(IParkitect parkitect)
            : base("Launch parkitect")
        {
            _parkitect = parkitect;

            StatusDescription = "Launch the game.";
        }
コード例 #2
0
 public ModsPageView(IParkitect parkitect, ILogger log, IPresenter parent, IQueueableTaskManager queueableTaskManager,
                     IWebsite website) : base(parkitect, website, log, AssetType.Mod, parent, "Mods")
 {
     _parkitect            = parkitect;
     _queueableTaskManager = queueableTaskManager;
     _website = website;
 }
コード例 #3
0
ファイル: ModLoaderUtil.cs プロジェクト: calintx3/calin
        private static void InstallModLoaderFile(IParkitect parkitect, string fileName)
        {
            var targetDirectory = parkitect.Paths.NativeMods;

            Directory.CreateDirectory(targetDirectory);
            var targetPath = Path.Combine(targetDirectory, fileName);
            var sourcePath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), fileName);

            if (!File.Exists(sourcePath))
            {
                return;
            }

            if (File.Exists(targetPath))
            {
                using (var stream = File.OpenRead(sourcePath))
                    using (var stream2 = File.OpenRead(targetPath))
                        if (stream.CreateMD5Checksum() == stream2.CreateMD5Checksum())
                        {
                            return;
                        }
            }

            File.Copy(sourcePath, targetPath, true);
        }
コード例 #4
0
        private static void InstallModLoaderFile(IParkitect parkitect, string fileName, string exten)
        {
            var targetDirectory = parkitect.Paths.NativeMods;

            Directory.CreateDirectory(targetDirectory);
            var targetPath = Path.Combine(targetDirectory, fileName + "." + exten);

            var sourcePath = NSBundle.MainBundle.PathForResource(fileName, exten);

            if (!File.Exists(sourcePath))
            {
                return;
            }

            if (File.Exists(targetPath))
            {
                using (var stream = File.OpenRead(sourcePath))
                    using (var stream2 = File.OpenRead(targetPath))
                        if (stream.CreateMD5Checksum() == stream2.CreateMD5Checksum())
                        {
                            return;
                        }
            }

            File.Copy(sourcePath, targetPath, true);
        }
コード例 #5
0
        private object Generate(string action, IParkitect parkitect, Exception exception)
        {
            try
            {
                var os = OperatingSystem.Detect();
                switch (os)
                {
                case SupportedOperatingSystem.Windows:
                    return(new WindowsCrashReport(parkitect, action, exception, _log));

                case SupportedOperatingSystem.MacOSX:
                    return(new MacOSXCrashReport(parkitect, action, exception, _log));

                case SupportedOperatingSystem.Linux:
                    return(new LinuxCrashReport(parkitect, action, exception, _log));

                default:
                    throw new Exception("unsupported operating system " + os);
                }
            }
            catch (Exception e)
            {
                return(new FailedCrashReport(action, exception, e));
            }
        }
コード例 #6
0
 public CheckForUpdatesTask(IParkitect parkitect, IWebsite website, ILogger log, IQueueableTaskManager queueableTaskManager) : base("Check for updates")
 {
     _parkitect = parkitect;
     _website = website;
     _log = log;
     _queueableTaskManager = queueableTaskManager;
     StatusDescription = "Check for updates.";
 }
コード例 #7
0
 public CrashReporterFactory(INexusWebClientFactory webClientFactory, IWebsite website,
     IParkitect parkitect, ILogger log)
 {
     _website = website;
     _parkitect = parkitect;
     _webClientFactory = webClientFactory;
     _log = log;
 }
コード例 #8
0
 protected BaseParkitectPaths(IParkitect parkitect)
 {
     if (parkitect == null)
     {
         throw new ArgumentNullException(nameof(parkitect));
     }
     Parkitect = parkitect;
 }
コード例 #9
0
ファイル: CheckForUpdatesTask.cs プロジェクト: calintx3/calin
 public CheckForUpdatesTask(IParkitect parkitect, IWebsite website, ILogger log, IQueueableTaskManager queueableTaskManager) : base("Check for updates")
 {
     _parkitect            = parkitect;
     _website              = website;
     _log                  = log;
     _queueableTaskManager = queueableTaskManager;
     StatusDescription     = "Check for updates.";
 }
コード例 #10
0
 public ModsPageView(IParkitect parkitect, ILogger log, IPresenter parent, IQueueableTaskManager queueableTaskManager,
     IWebsite website)
     : base(parkitect, website, log, AssetType.Mod, parent, "Mods")
 {
     _parkitect = parkitect;
     _queueableTaskManager = queueableTaskManager;
     _website = website;
 }
コード例 #11
0
 public CrashReporterFactory(INexusWebClientFactory webClientFactory, IWebsite website,
                             IParkitect parkitect, ILogger log)
 {
     _website          = website;
     _parkitect        = parkitect;
     _webClientFactory = webClientFactory;
     _log = log;
 }
コード例 #12
0
 public LocalAssetRepository(IParkitect parkitect, IWebsite website, ILogger log, IAssetMetadataStorage assetMetadataStorage,
                             IAssetCachedDataStorage assetCachedDataStorage)
 {
     _parkitect              = parkitect;
     _website                = website;
     _log                    = log;
     _assetMetadataStorage   = assetMetadataStorage;
     _assetCachedDataStorage = assetCachedDataStorage;
 }
コード例 #13
0
 public LocalAssetRepository(IParkitect parkitect, IWebsite website, ILogger log, IAssetMetadataStorage assetMetadataStorage,
     IAssetCachedDataStorage assetCachedDataStorage)
 {
     _parkitect = parkitect;
     _website = website;
     _log = log;
     _assetMetadataStorage = assetMetadataStorage;
     _assetCachedDataStorage = assetCachedDataStorage;
 }
コード例 #14
0
        public InstallAssetTask(IParkitect parkitect, IWebsite website, IRemoteAssetRepository remoteAssetRepository,
            IQueueableTaskManager queueableTaskManager) : base("Install asset")
        {
            _parkitect = parkitect;
            _website = website;
            _remoteAssetRepository = remoteAssetRepository;
            _queueableTaskManager = queueableTaskManager;

            StatusDescription = "Install an asset.";
        }
コード例 #15
0
ファイル: App.cs プロジェクト: calintx3/calin
 public App(IPresenterFactory presenterFactory, IParkitect parkitect, IQueueableTaskManager taskManager,
            ILogger log, IUpdateManager updateManager, Migrator migrator)
 {
     _migrator         = migrator;
     _presenterFactory = presenterFactory;
     _parkitect        = parkitect;
     _taskManager      = taskManager;
     _log           = log;
     _updateManager = updateManager;
 }
コード例 #16
0
        public MacOSXCrashReport(IParkitect parkitect, string action, Exception exception, ILogger logger)
        {
            if (parkitect == null) throw new ArgumentNullException(nameof(parkitect));
            if (exception == null) throw new ArgumentNullException(nameof(exception));

            _logger = logger;
            _parkitect = parkitect;
            Action = action;
            Exception = exception;
        }
コード例 #17
0
 public App(IPresenterFactory presenterFactory, IParkitect parkitect, IQueueableTaskManager taskManager,
     ILogger log, IUpdateManager updateManager, Migrator migrator)
 {
     _migrator = migrator;
     _presenterFactory = presenterFactory;
     _parkitect = parkitect;
     _taskManager = taskManager;
     _log = log;
     _updateManager = updateManager;
 }
コード例 #18
0
ファイル: InstallAssetTask.cs プロジェクト: calintx3/calin
        public InstallAssetTask(IParkitect parkitect, IWebsite website, IRemoteAssetRepository remoteAssetRepository,
                                IQueueableTaskManager queueableTaskManager) : base("Install asset")
        {
            _parkitect             = parkitect;
            _website               = website;
            _remoteAssetRepository = remoteAssetRepository;
            _queueableTaskManager  = queueableTaskManager;

            StatusDescription = "Install an asset.";
        }
コード例 #19
0
        public UpdateModTask(IModAsset mod, IParkitect parkitect, IQueueableTaskManager queueableTaskManager, IWebsite website) : base($"Update mod {mod?.Name}")
        {
            if (mod == null) throw new ArgumentNullException(nameof(mod));
            _mod = mod;
            _parkitect = parkitect;
            _queueableTaskManager = queueableTaskManager;
            _website = website;

            StatusDescription = $"Update mod {mod.Name}";
        }
コード例 #20
0
ファイル: UpdateModTask.cs プロジェクト: calintx3/calin
        public UpdateModTask(IModAsset mod, IParkitect parkitect, IQueueableTaskManager queueableTaskManager, IWebsite website) : base($"Update mod {mod?.Name}")
        {
            if (mod == null)
            {
                throw new ArgumentNullException(nameof(mod));
            }
            _mod                  = mod;
            _parkitect            = parkitect;
            _queueableTaskManager = queueableTaskManager;
            _website              = website;

            StatusDescription = $"Update mod {mod.Name}";
        }
コード例 #21
0
        public static void InstallModLoader(IParkitect parkitect, ILogger logger)
        {
            if (parkitect == null) throw new ArgumentNullException(nameof(parkitect));
            if (logger == null) throw new ArgumentNullException(nameof(logger));

            try
            {
                InstallModLoaderFile(parkitect, "ParkitectNexus.Mod.ModLoader", "dll");
            }
            catch (Exception e)
            {
                logger.WriteLine("Failed to install mod loader.", LogLevel.Warn);
                logger.WriteException(e, LogLevel.Warn);
            }
        }
コード例 #22
0
        public MacOSXCrashReport(IParkitect parkitect, string action, Exception exception, ILogger logger)
        {
            if (parkitect == null)
            {
                throw new ArgumentNullException(nameof(parkitect));
            }
            if (exception == null)
            {
                throw new ArgumentNullException(nameof(exception));
            }

            _logger    = logger;
            _parkitect = parkitect;
            Action     = action;
            Exception  = exception;
        }
コード例 #23
0
        public AssetsPageView(IParkitect parkitect, IWebsite website, ILogger log, AssetType type, IPresenter parent, string displayName)
            : base(log, displayName)
        {
            if (!(parent is MainView))
                throw new ArgumentException("parent must be MainView", nameof(parent));

            _parkitect = parkitect;
            _website = website;
            _log = log;
            _type = type;
            MainView = (MainView) parent;

            parkitect.Assets.AssetAdded += Assets_AssetAdded;
            parkitect.Assets.AssetRemoved += Assets_AssetRemoved;

            GetRequiredMods();
        }
コード例 #24
0
ファイル: AssetsPageView.cs プロジェクト: calintx3/calin
        public AssetsPageView(IParkitect parkitect, IWebsite website, ILogger log, AssetType type, IPresenter parent, string displayName)
            : base(log, displayName)
        {
            if (!(parent is MainView))
            {
                throw new ArgumentException("parent must be MainView", nameof(parent));
            }

            _parkitect = parkitect;
            _website   = website;
            _log       = log;
            _type      = type;
            MainView   = (MainView)parent;

            parkitect.Assets.AssetAdded   += Assets_AssetAdded;
            parkitect.Assets.AssetRemoved += Assets_AssetRemoved;

            GetRequiredMods();
        }
コード例 #25
0
ファイル: ModLoaderUtil.cs プロジェクト: calintx3/calin
        public static void InstallModLoader(IParkitect parkitect, ILogger logger)
        {
            if (parkitect == null)
            {
                throw new ArgumentNullException(nameof(parkitect));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            try
            {
                InstallModLoaderFile(parkitect, "ParkitectNexus.Mod.ModLoader.dll");
            }
            catch (Exception e)
            {
                logger.WriteLine("Failed to install mod loader.", LogLevel.Warn);
                logger.WriteException(e, LogLevel.Warn);
            }
        }
コード例 #26
0
        private static void InstallModLoaderFile(IParkitect parkitect, string fileName)
        {
            var targetDirectory = parkitect.Paths.NativeMods;

            Directory.CreateDirectory(targetDirectory);
            var targetPath = Path.Combine(targetDirectory, fileName);
            var sourcePath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), fileName);

            if (!File.Exists(sourcePath))
                return;

            if (File.Exists(targetPath))
            {
                using (var stream = File.OpenRead(sourcePath))
                using (var stream2 = File.OpenRead(targetPath))
                    if (stream.CreateMD5Checksum() == stream2.CreateMD5Checksum())
                        return;
            }

            File.Copy(sourcePath, targetPath, true);
        }
コード例 #27
0
        private static void InstallModLoaderFile(IParkitect parkitect, string fileName, string exten)
        {
            var targetDirectory = parkitect.Paths.NativeMods;

            Directory.CreateDirectory(targetDirectory);
            var targetPath = Path.Combine(targetDirectory, fileName + "." + exten);

            var sourcePath = NSBundle.MainBundle.PathForResource(fileName, exten);

            if (!File.Exists(sourcePath))
                return;

            if (File.Exists(targetPath))
            {
                using (var stream = File.OpenRead(sourcePath))
                using (var stream2 = File.OpenRead(targetPath))
                    if (stream.CreateMD5Checksum() == stream2.CreateMD5Checksum())
                        return;
            }

            File.Copy(sourcePath, targetPath, true);
        }
コード例 #28
0
 private object Generate(string action, IParkitect parkitect, Exception exception)
 {
     try
     {
         var os = OperatingSystem.Detect();
         switch (os)
         {
             case SupportedOperatingSystem.Windows:
                 return new WindowsCrashReport(parkitect, action, exception, _log);
             case SupportedOperatingSystem.MacOSX:
                 return new MacOSXCrashReport(parkitect, action, exception, _log);
             case SupportedOperatingSystem.Linux:
                 return new LinuxCrashReport(parkitect, action, exception, _log);
             default:
                 throw new Exception("unsupported operating system " + os);
         }
     }
     catch (Exception e)
     {
         return new FailedCrashReport(action, exception, e);
     }
 }
コード例 #29
0
 public BlueprintsPageView(IParkitect parkitect, IWebsite website, ILogger log, IPresenter parent)
     : base(parkitect, website, log, AssetType.Blueprint, parent, "Blueprints")
 {
 }
コード例 #30
0
 public Migrator(IParkitect parkitect)
 {
     _parkitect = parkitect;
 }
コード例 #31
0
 public MenuPageView(IParkitect parkitect, ILogger log, IWebsite website, App app)
     : base(log, "Menu")
 {
     _parkitect = parkitect;
     _website = website;
 }
コード例 #32
0
 public WindowsParkitectPaths(IParkitect parkitect) : base(parkitect)
 {
 }
コード例 #33
0
 public ModCompiler(IParkitect parkitect, ILogger log)
 {
     _parkitect = parkitect;
     _log = log;
 }
コード例 #34
0
ファイル: LaunchGameTask.cs プロジェクト: calintx3/calin
        public LaunchGameTask(IParkitect parkitect) : base("Launch parkitect")
        {
            _parkitect = parkitect;

            StatusDescription = "Launch the game.";
        }
コード例 #35
0
 protected BaseParkitectPaths(IParkitect parkitect)
 {
     if (parkitect == null) throw new ArgumentNullException(nameof(parkitect));
     Parkitect = parkitect;
 }
コード例 #36
0
 public ScenariosPageView(IParkitect parkitect, IWebsite website, ILogger log, IPresenter parent)
     : base(parkitect, website, log, AssetType.Scenario, parent, "Scenarios")
 {
 }
コード例 #37
0
ファイル: MenuPageView.cs プロジェクト: calintx3/calin
 public MenuPageView(IParkitect parkitect, ILogger log, IWebsite website, App app) : base(log, "Menu")
 {
     _parkitect = parkitect;
     _website   = website;
 }
コード例 #38
0
ファイル: SavegamesPageView.cs プロジェクト: calintx3/calin
 public SavegamesPageView(IParkitect parkitect, IWebsite website, ILogger log, IPresenter parent)
     : base(parkitect, website, log, AssetType.Savegame, parent, "Savegames")
 {
 }
コード例 #39
0
ファイル: ModLoadOrderBuilder.cs プロジェクト: calintx3/calin
 public ModLoadOrderBuilder(IParkitect parkitect, ILogger log)
 {
     _parkitect = parkitect;
     _log       = log;
 }
コード例 #40
0
 public SavegamesPageView(IParkitect parkitect, IWebsite website, ILogger log, IPresenter parent)
     : base(parkitect, website, log, AssetType.Savegame, parent, "Savegames")
 {
 }
コード例 #41
0
 public Migrator(IParkitect parkitect)
 {
     _parkitect = parkitect;
 }
コード例 #42
0
ファイル: ModCompiler.cs プロジェクト: calintx3/calin
 public ModCompiler(IParkitect parkitect, ILogger log)
 {
     _parkitect = parkitect;
     _log       = log;
 }
コード例 #43
0
ファイル: BlueprintsPageView.cs プロジェクト: calintx3/calin
 public BlueprintsPageView(IParkitect parkitect, IWebsite website, ILogger log, IPresenter parent)
     : base(parkitect, website, log, AssetType.Blueprint, parent, "Blueprints")
 {
 }