Beispiel #1
0
        private static int RunAdd(AddOptions options)
        {
            var file = Path.Combine(Directory.GetCurrentDirectory(), options.File);

            if (System.IO.File.Exists(file))
            {
                var solution = LoadSolution(options);
                var project  = FindProject(solution, options.Project) as CPlusPlusProject;

                if (project != null)
                {
                    var sourceFile = SourceFile.FromPath(project, project, options.File);
                    project.Items.Add(sourceFile);
                    project.SourceFiles.InsertSorted(sourceFile);
                    project.Save();
                    Console.WriteLine("File added.");
                    return(1);
                }
                Console.WriteLine("Project not found.");
                return(-1);
            }
            Console.WriteLine("File not found.");
            return(-1);
        }