Example #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));
        }
        bool InstallPlugin(IAbsoluteDirectoryPath tsPath, IContentEngineContent mod, string plugin, bool force)
        {
            if (!tsPath.IsNotNullAndExists())
            {
                throw new ArgumentNullException("Unable to find the Teamspeak Install Directory");
            }

            if (mod == null)
            {
                throw new ArgumentNullException(nameof(mod), "Fatal Error Occured: Mod incorrectly registered");
            }
            if (plugin == null)
            {
                throw new ArgumentNullException(nameof(plugin), "Fatal Error Occured: Plugin Path was not set");
            }

            if (!mod.IsInstalled || !mod.PathInternal.IsNotNullAndExists())
            {
                throw new InvalidOperationException("The mod is not installed");
            }

            var pluginPath     = Path.Combine(mod.PathInternal.ToString(), plugin).ToAbsoluteFilePath();
            var tsPluginFolder = GetPluginPath(tsPath);

            return(InstallDll(pluginPath, tsPluginFolder, force));
        }
Example #3
0
        bool InstallPlugin(IAbsoluteDirectoryPath gamePath, IContentEngineContent mod, string plugin, bool force)
        {
            if (!gamePath.IsNotNullAndExists())
            {
                throw new ArgumentNullException("Unable to find the Game Install Directory");
            }
            if (mod == null)
            {
                throw new ArgumentNullException(nameof(mod), "Fatal Error Occured: Mod incorrectly registered");
            }
            if (plugin == null)
            {
                throw new ArgumentNullException(nameof(plugin), "Fatal Error Occured: Plugin Path was not set");
            }

            if (!mod.IsInstalled || !mod.PathInternal.IsNotNullAndExists())
            {
                throw new InvalidOperationException("The mod is not installed");
            }

            var pluginPath       = mod.PathInternal.GetChildFileWithName(plugin);
            var gamePluginFolder = gamePath;

            return(InstallDll(pluginPath, gamePluginFolder, force));
        }
Example #4
0
        public void Test_Exist()
        {
            DirForTest.Delete();
            string dirForTestPath = DirForTest.Dir;
            IAbsoluteDirectoryPath absoluteDirectoryPath = dirForTestPath.ToAbsoluteDirectoryPath();

            Assert.IsFalse(absoluteDirectoryPath.Exists);
            Assert.IsFalse(absoluteDirectoryPath.IsNotNullAndExists());

            DirForTest.EnsureDirForTestExistAndEmpty();
            Assert.IsTrue(absoluteDirectoryPath.Exists);
            Assert.IsTrue(absoluteDirectoryPath.IsNotNullAndExists());

            string            dirForTestWithExecutingAssemblyFilePath = DirForTest.ExecutingAssemblyFilePathInDirForTest;
            IAbsoluteFilePath absoluteFilePath = dirForTestWithExecutingAssemblyFilePath.ToAbsoluteFilePath();

            Assert.IsFalse(absoluteFilePath.Exists);

            DirForTest.CopyExecutingAssemblyFileInDirForTest();
            Assert.IsTrue(absoluteFilePath.Exists);
        }
        bool InstallPlugin(IAbsoluteDirectoryPath gamePath, IContentEngineContent mod, string plugin, bool force) {
            Contract.Requires<ArgumentNullException>(gamePath.IsNotNullAndExists(),
                "Unable to find the Game Install Directory");
            Contract.Requires<ArgumentNullException>(mod != null, "Fatal Error Occured: Mod incorrectly registered");
            Contract.Requires<ArgumentNullException>(plugin != null, "Fatal Error Occured: Plugin Path was not set");

            if (!mod.IsInstalled || !mod.PathInternal.IsNotNullAndExists())
                throw new InvalidOperationException("The mod is not installed");

            var pluginPath = mod.PathInternal.GetChildFileWithName(plugin);
            var gamePluginFolder = gamePath;

            return InstallDll(pluginPath, gamePluginFolder, force);
        }
        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);
        }
        static void InstallFolder(IAbsoluteDirectoryPath pluginPath, IAbsoluteDirectoryPath tsPluginFolder, bool force)
        {
            if (tsPluginFolder == null)
            {
                throw new ArgumentNullException(nameof(tsPluginFolder));
            }
            if (pluginPath == null)
            {
                throw new ArgumentNullException(nameof(pluginPath));
            }

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

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

            TryCopyFolder(pluginPath, tsPluginFolder.GetChildDirectoryWithName(pluginPath.DirectoryName), force);
        }
        static void InstallFolder(IAbsoluteDirectoryPath pluginPath, IAbsoluteDirectoryPath tsPluginFolder, bool force) {
            Contract.Requires<ArgumentNullException>(tsPluginFolder != null);
            Contract.Requires<ArgumentNullException>(pluginPath != null);

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

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

            TryCopyFolder(pluginPath, tsPluginFolder.GetChildDirectoryWithName(pluginPath.DirectoryName), force);
        }
        bool InstallPlugin(IAbsoluteDirectoryPath tsPath, IContentEngineContent mod, string plugin, bool force) {
            Contract.Requires<ArgumentNullException>(tsPath.IsNotNullAndExists(),
                "Unable to find the Teamspeak Install Directory");
            Contract.Requires<ArgumentNullException>(mod != null, "Fatal Error Occured: Mod incorrectly registered");
            Contract.Requires<ArgumentNullException>(plugin != null, "Fatal Error Occured: Plugin Path was not set");

            if (!mod.IsInstalled || !mod.PathInternal.IsNotNullAndExists())
                throw new InvalidOperationException("The mod is not installed");

            var pluginPath = Path.Combine(mod.PathInternal.ToString(), plugin).ToAbsoluteFilePath();
            var tsPluginFolder = GetPluginPath(tsPath);

            return InstallDll(pluginPath, tsPluginFolder, force);
        }
Example #10
0
 public bool IsX64Installed() => TS3_64_Path.IsNotNullAndExists();
Example #11
0
 public bool IsX86Installed() => TS3_32_Path.IsNotNullAndExists();