Example #1
0
        public override void Run()
        {
            if (parameters.Count < 1)
            {
                throw new SlipeException("Please specify the project name, syntax: \nslipe remove-project {project-name} [-server] [-client]");
            }

            string projectName = parameters[0];

            if (!options.ContainsKey("server") && !options.ContainsKey("client"))
            {
                throw new SlipeException("Please specify server or client (or both): \nslipe remove-project {project-name} [-server] [-client]");
            }


            SlipeConfigCompileTarget target = targetsModule ? targetModule.compileTargets : config.compileTargets;

            if (options.ContainsKey("server"))
            {
                if (!target.server.Contains(projectName))
                {
                    throw new SlipeException(projectName + " not found in server");
                }
                target.server.Remove(projectName);
            }
            if (options.ContainsKey("client"))
            {
                if (!target.server.Contains(projectName))
                {
                    throw new SlipeException(projectName + " not found in client");
                }
                target.client.Remove(projectName);
            }
        }
Example #2
0
        public override void Run()
        {
            if (parameters.Count < 1)
            {
                throw new SlipeException("Please specify the project name, syntax: \nslipe add-project {project-name} [-server] [-client]");
            }

            string projectName = parameters[0];

            if (!options.ContainsKey("server") && !options.ContainsKey("client"))
            {
                throw new SlipeException("Please specify server or client (or both): \nslipe add-project {project-name} [-server] [-client]");
            }

            SlipeConfigCompileTarget target = targetsModule ? targetModule.compileTargets : config.compileTargets;

            if (options.ContainsKey("server"))
            {
                if (!Directory.Exists("./Source/Server/" + projectName) && !options.ContainsKey("force"))
                {
                    throw new SlipeException("No project by this name is found in ./Source/Server, if you wish to add it anyway use -force");
                }
                target.server.Add(projectName);
            }
            if (options.ContainsKey("client"))
            {
                if (!Directory.Exists("./Source/Client/" + projectName) && !options.ContainsKey("force"))
                {
                    throw new SlipeException("No project by this name is found in ./Source/Server, if you wish to add it anyway use -force");
                }
                target.client.Add(projectName);
            }
        }
Example #3
0
        public override void Run()
        {
            if (parameters.Count < 1)
            {
                throw new SlipeException("Please specify the project name, syntax: \nslipe delete-project {project-name} [-server] [-client]");
            }

            if (!options.ContainsKey("y"))
            {
                Console.WriteLine("Are you sure you wish to proceed? This action can not be undone. y/n");
                if (Console.ReadKey().Key != ConsoleKey.Y)
                {
                    return;
                }
            }

            string name = parameters[0];
            string path = "Source/" + name;

            if (targetsModule)
            {
                path = targetModule.path + "/" + path;
            }

            // delete everything
            DirectoryInfo directoryInfo = new DirectoryInfo(path);

            foreach (FileInfo file in directoryInfo.GetFiles())
            {
                file.Delete();
            }
            foreach (DirectoryInfo directory in directoryInfo.GetDirectories())
            {
                directory.Delete(true);
            }
            Directory.Delete(path);

            SlipeConfigCompileTarget target = options.ContainsKey("module") ? targetModule.compileTargets : config.compileTargets;

            target.server.Remove(name);
            target.client.Remove(name);

            string  csProjPath = path + "/" + name + ".csproj";
            SlnFile solution   = new SlnFile("Resource.sln");

            solution.RemoveProject(name, csProjPath);
        }
Example #4
0
        public override void Run()
        {
            if (parameters.Count < 1)
            {
                throw new SlipeException("Please specify the project name, syntax: \nslipe create-project {project-name} [-server] [-client]");
            }
            string name = parameters[0];
            string path = "Source/" + name;

            if (targetsModule)
            {
                path = targetModule.path + "/" + path;
            }


            string csProjPath = path + "/" + name + ".csproj";

            if (Directory.Exists(path))
            {
                throw new SlipeException("A directory with this name already exists.");
            }

            Directory.CreateDirectory(path);

            CsprojFile projectFile = new CsprojFile(csProjPath, name, "netcoreapp3.0");

            projectFile.Save();

            SlnFile solution = new SlnFile("Resource.sln");

            solution.AddProject(name, csProjPath);

            SlipeConfigCompileTarget target = targetsModule ? targetModule.compileTargets : config.compileTargets;

            if (options.ContainsKey("server"))
            {
                target.server.Add(name);
            }
            if (options.ContainsKey("client"))
            {
                target.client.Add(name);
            }
        }