Esempio n. 1
0
        static bool InstallDll(IAbsoluteFilePath pluginPath, IAbsoluteDirectoryPath gamePluginFolder,
                               bool force = true)
        {
            if (gamePluginFolder == null)
            {
                throw new ArgumentNullException(nameof(gamePluginFolder));
            }
            if (pluginPath == null)
            {
                throw new ArgumentNullException(nameof(pluginPath));
            }

            if (!pluginPath.IsNotNullAndExists())
            {
                throw new PathDoesntExistException(pluginPath.ToString());
            }

            if (!gamePluginFolder.IsNotNullAndExists())
            {
                throw new PathDoesntExistException(gamePluginFolder.ToString());
            }

            var fullPath = gamePluginFolder.GetChildFileWithName(pluginPath.FileName);

            if (!force && fullPath.Exists)
            {
                return(false);
            }

            return(TryCopyDll(pluginPath, fullPath));
        }
        static bool InstallDll(IAbsoluteFilePath pluginPath, IAbsoluteDirectoryPath gamePluginFolder,
            bool force = true) {
            Contract.Requires<ArgumentNullException>(gamePluginFolder != null);
            Contract.Requires<ArgumentNullException>(pluginPath != null);

            if (!pluginPath.IsNotNullAndExists())
                throw new PathDoesntExistException(pluginPath.ToString());

            if (!gamePluginFolder.IsNotNullAndExists())
                throw new PathDoesntExistException(gamePluginFolder.ToString());

            var fullPath = gamePluginFolder.GetChildFileWithName(pluginPath.FileName);

            if (!force && fullPath.Exists)
                return false;

            return TryCopyDll(pluginPath, fullPath);
        }