コード例 #1
0
ファイル: SetupFile.cs プロジェクト: yasenRK/ThePipe
        public SetupFile Duplicate()
        {
            var copy = new SetupFile(_fileName, _targetDir, _targetDirDesc);

            copy.CreateTargetDirectory = _createTargetDir;
            return(copy);
        }
コード例 #2
0
ファイル: App.cs プロジェクト: yasenRK/ThePipe
        public void AddSetupFile(SetupFile file)
        {
            var file2 = file.Duplicate();

            if (file2.TargetDirectoryDescription == null)
            {
                file2.TargetDirectoryDescription = _targetDirDesc;
            }
            file2.CreateTargetDirectory = _createTargetDir;
            AddSetupFile(file, file2.TargetDirectoryDescription);
        }
コード例 #3
0
ファイル: App.cs プロジェクト: yasenRK/ThePipe
        public void AddSetupFile(SetupFile file, string targetDirDesc)
        {
            var file2 = file.Duplicate();

            if (file2.TargetDirectory == null)
            {
                file2.TargetDirectory = _targetDir;
            }
            file2.CreateTargetDirectory = _createTargetDir;
            AddSetupFile(file2, file2.TargetDirectory, targetDirDesc);
        }
コード例 #4
0
ファイル: App.cs プロジェクト: yasenRK/ThePipe
        public void AddSetupFile(SetupFile file, string targetDirPath, string targetDirDesc)
        {
            var file2 = file.Duplicate();

            file2.TargetDirectory            = targetDirPath;
            file2.TargetDirectoryDescription = targetDirDesc;

            file2.CreateTargetDirectory = file2.TargetDirectory == _targetDir ? _createTargetDir : false;

            file2.OwnerApp = this;
            _setupFiles.Add(file2);
        }
コード例 #5
0
        static void Main(string[] args)
        {
            //shared setup files
            SetupFile pipeDataModel     = new SetupFile("PipeDataModel.dll");
            SetupFile rhPipeConverter   = new SetupFile("RhinoPipeConverter.dll");
            SetupFile rhV6PipeConverter = new SetupFile("RhinoV6PipeConverter.dll");

            /*
             * Then create all the apps - i.e. ThePipe plugins and extensions for all the apps with proper setup files
             */
            //revit pipe addin
            string rvtApp    = "PipeForRevit";
            App    revitPipe = new App(rvtApp, setupFileDir, @"C:\", "PipeForRevit Installation Folder", true);

            revitPipe.AddSetupFile(pipeDataModel);
            revitPipe.AddSetupFile(new SetupFile("PipeForRevit.dll"));
            revitPipe.AddSetupFile(new SetupFile("PipeArrow.png"));
            revitPipe.AddSetupFile(new SetupFile("PipeForRevit.addin", Path.Combine(programDataDir, @"Autodesk\Revit\Addins\2017"),
                                                 "Revit Addin Manifests Folder"));

            //dynamo pipe library
            string dynAppName = "PipeForDynamo";
            App    dynamoPipe = new App(dynAppName, setupFileDir, Path.Combine(programDataDir, appAuthorName),
                                        "PipeForDynamo Installation Folder", true);

            dynamoPipe.AddSetupFile(pipeDataModel);
            dynamoPipe.AddSetupFile(new SetupFile("PipeForDynamo.dll"));
            dynamoPipe.Message = string.Format("NOTE: The files have been copied to {0}.\n" +
                                               "To use the dynamo Pipe library, from within Dynamo, select File > Import Library, browse to the above path\n" +
                                               "and select PipeForDynamo.dll.", dynamoPipe.TargetDirectory);

            //rhino pipe plugin
            string rhinoV5AppName = "PipeForRhinoV5";
            App    rhinoPipe      = new App(rhinoV5AppName, setupFileDir, Path.Combine(programDataDir, appAuthorName),
                                            "PipeForRhino Installation folder", true);

            rhinoPipe.AddSetupFile(pipeDataModel);
            rhinoPipe.AddSetupFile(rhPipeConverter);
            rhinoPipe.AddSetupFile(new SetupFile("PipeForRhino.rhp"));
            rhinoPipe.Message = string.Format("NOTE: Installation of ThePipe Rhinoceros plugin is NOT finished. The files are copied to {0},\n" +
                                              "but you need to load the RHP file (browse to that path) using Rhino's PluginManager to finish installation.",
                                              rhinoPipe.TargetDirectory);

            //rhino v6 pipe plugin
            string rhinoV6AppName = "PipeForRhinoV6";
            App    rhinoV6Pipe    = new App(rhinoV6AppName, setupFileDir, Path.Combine(programDataDir, appAuthorName),
                                            "PipeForRhino Installation folder", true);

            rhinoV6Pipe.AddSetupFile(pipeDataModel);
            rhinoV6Pipe.AddSetupFile(rhV6PipeConverter);
            rhinoV6Pipe.AddSetupFile(new SetupFile("PipeForRhinoV6.rhp"));
            rhinoV6Pipe.Message = string.Format("NOTE: Installation of ThePipe Rhinoceros(6) plugin is NOT finished. The files are copied to {0},\n" +
                                                "but you need to load the RHP file (browse to that path) using Rhino's PluginManager to finish installation.",
                                                rhinoV6Pipe.TargetDirectory);

            //grasshopperV5 pipe plugin
            string ghAppName = "PipeForGrasshopperV5";
            App    ghPipe    = new App(ghAppName, setupFileDir, Path.Combine(appDataDir, "Grasshopper", "Libraries"),
                                       "Grasshopper Plugins Folder", false);

            ghPipe.AddSetupFile(pipeDataModel);
            ghPipe.AddSetupFile(rhPipeConverter);
            ghPipe.AddSetupFile(new SetupFile("PipeForGrasshopper.gha"));
            ghPipe.Message = "Installtion of GH Pipe plugin for v5 will be overriden by the GH Pipe plugin for v6 if you choose to install v6." +
                             "use this if you use GH with Rhino 5 and skip the GH v6 installtion";

            //grasshopperV6 pipe plugin
            string ghV6AppName = "PipeForGrasshopperV6";
            App    ghPipeV6    = new App(ghV6AppName, setupFileDir, Path.Combine(appDataDir, "Grasshopper", "Libraries"),
                                         "Grasshopper Plugins Folder", false);

            ghPipeV6.AddSetupFile(pipeDataModel);
            ghPipeV6.AddSetupFile(rhV6PipeConverter);
            ghPipeV6.AddSetupFile(new SetupFile("PipeForGrasshopperV6.gha"));
            ghPipeV6.Message = "If you already installed GH Pipe plugin for v5, it was just overwritten by the v6 installtion just now." +
                               "This will work if you use GH with Rhino 6.";

            List <App> appList = new List <App> {
                revitPipe,
                dynamoPipe,
                rhinoPipe,
                rhinoV6Pipe,
                ghPipe,
                ghPipeV6
            };

            Console.WriteLine(GetHeader());

            foreach (var app in appList)
            {
                Console.Write(string.Format("Do you want to install {0} ?(y/n): ", app.Name));
                string response = Console.ReadLine();
                if (response.ToLower() != "y")
                {
                    continue;
                }
                try
                {
                    app.Install();
                }
                catch (Exception e)
                {
                    Console.WriteLine(string.Format("ERROR: Installation failed - {0}\n\tAborting.", e.Message));
                    app.Uninstall();
                }
                Console.WriteLine("================================");
            }

            ConsolePause("The Installer is finished, now exiting.");
        }