コード例 #1
0
ファイル: DaemonCommand.cs プロジェクト: yongaru/fuse-studio
        public static DaemonCommand CreateDaemonCommand()
        {
            var shell               = new Shell();
            var coloredConsole      = ColoredTextWriter.Out;
            var coloredErrorConsole = ColoredTextWriter.Error;
            var fuse                 = FuseApi.Initialize("daemon", new List <string>());
            var daemonReport         = fuse.Report;
            var localSocketServer    = new LocalSocketServer(daemonReport);
            var serviceRunnerFactory = new ServiceRunnerFactory(
                new Service("CodeAssistance", fuse.CodeAssistance)
                , new Service("Tray", fuse.Tray)
                );

            var daemonSingleInstance = new EnsureSingleUser(
                coloredErrorConsole,
                shell,
                userFile: DaemonPossessionFile);

            return(new DaemonCommand(
                       coloredConsole,
                       daemonReport,
                       daemonSingleInstance,
                       fuse,
                       (a) => new DaemonRunner(
                           daemonSingleInstance,
                           localSocketServer,
                           a.Debug,
                           !a.IsMinimal,
                           fuse,
                           serviceRunnerFactory,
                           daemonReport)));
        }
コード例 #2
0
ファイル: InstallCommand.cs プロジェクト: yongaru/fuse-studio
        public static CliCommand CreateInstallCommand()
        {
            var fuse = FuseApi.Initialize("Fuse", new List <string>());

            return(new InstallCommand(
                       ColoredTextWriter.Out,
                       fuse));
        }
コード例 #3
0
ファイル: KillAllCommand.cs プロジェクト: yongaru/fuse-studio
        public static KillAllCommand CreateKillAllCommand()
        {
            var fuse = FuseApi.Initialize("Fuse", new List <string>());

            return(new KillAllCommand(
                       fuse,
                       ColoredTextWriter.Out,
                       new FuseKiller(fuse.Report, fuse.FuseRoot)));
        }
コード例 #4
0
        public static CreateCommand CreateCreateCommand()
        {
            var shell          = new Shell();
            var coloredConsole = ColoredTextWriter.Out;
            var fuse           = FuseApi.Initialize("Fuse", new List <string>());

            return(new CreateCommand(
                       shell,
                       () => TemplateLoader.LoadTemplatesFrom(UnoConfig.Current.GetTemplatesDir() / "Projects", shell),
                       () => TemplateLoader.LoadTemplatesFrom(UnoConfig.Current.GetTemplatesDir() / "Files", shell),
                       coloredConsole,
                       fuse));
        }
コード例 #5
0
        public static BuildCommand CreateBuildCommand()
        {
            var shell           = new Shell();
            var projectDetector = new ProjectDetector(shell);
            var fuse            = FuseApi.Initialize("Fuse", new List <string>());

            return(new BuildCommand(
                       fuse,
                       ColoredTextWriter.Out,
                       ColoredTextWriter.Error,
                       fuse.Report,
                       projectDetector,
                       fileSystem: shell,
                       uno: fuse.Uno));
        }
コード例 #6
0
        public static DashboardCommand CreateDashboardCommand()
        {
            var fuse  = FuseApi.Initialize("Dashboard", new List <string>());
            var Log   = fuse.Report;
            var shell = new Shell();

            return(new DashboardCommand(
                       log: Log,
                       fuseVersion: fuse.Version,
                       fs: shell,
                       userDataDir:
                       fuse.UserDataDir,
                       launchFuse: fuse,
                       fuseKiller: new FuseKiller(Log, fuse.FuseRoot),
                       outWriter: ColoredTextWriter.Out));
        }
コード例 #7
0
        public static ImportCommand CreateImportCommand()
        {
            var shell           = new Shell();
            var fuse            = FuseApi.Initialize("Fuse", new List <string>());
            var projectDetector = new ProjectDetector(shell);

            ImportOperation[] importers =
            {
                new SketchConversionOperation(
                    "sketch",
                    "Import Sketch symbols from given sketch file or from <project>.sketchFiles",
                    shell,
                    fuse.Report)
            };

            return(new ImportCommand(shell, projectDetector, importers));
        }
コード例 #8
0
        public static PreviewCommand CreatePreviewCommand()
        {
            var shell           = new Shell();
            var projectDetector = new ProjectDetector(shell);
            var coloredConsole  = ColoredTextWriter.Out;
            var fuse            = FuseApi.Initialize("Fuse", new List <string>());

            return(new PreviewCommand(
                       coloredConsole,
                       new PreviewArgumentResolver(
                           projectDetector,
                           shell),
                       new PreviewMain(
                           shell, fuse,
                           new PreviewExported(coloredConsole),
                           coloredConsole),
                       fuse));
        }
コード例 #9
0
ファイル: OpenCommand.cs プロジェクト: yongaru/fuse-studio
 public static CliCommand CreateOpenCommand()
 {
     return(new OpenCommand(new Shell(), FuseApi.Initialize("Fuse", new List <string>())));
 }
コード例 #10
0
 public static CliCommand CreateEventViewerCommand()
 {
     return(new EventViewerCommand(ColoredTextWriter.Out, FuseApi.Initialize("Fuse", new List <string>())));
 }
コード例 #11
0
        public static CliCommand Create()
        {
            var fuse = FuseApi.Initialize("daemon-client", new List <string>());

            return(new DaemonClientCommand(ColoredTextWriter.Out, fuse));
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: x78w/fuse-studio
        public static int Run(List <string> args)
        {
            var fuse = FuseApi.Initialize("Fuse", args);

            Log = fuse.Report;

            Log.Info("Version " + fuse.Version);

            if (args.Contains("--version"))
            {
                Console.Out.WriteVersion(fuse.Version);
                return(0);
            }

            // Launch services adds -psn_something to the programs argument list
            // After moving an app from a dmg, and then starting the app
            var psnArgIdx = args.FindIndex(str => str.StartsWith("-psn"));

            if (psnArgIdx >= 0)
            {
                args.RemoveAt(psnArgIdx);
            }

            if (Platform.OperatingSystem == OS.Mac)
            {
                SetMinimumThreads(6);                 // For faster task creation in Mono. Mono doesn't have a good task system
            }
            var shell = new Shell();

            if (fuse.IsInstalled && shell.IsInsideRepo(AbsoluteDirectoryPath.Parse(Directory.GetCurrentDirectory())))
            {
                Log.Error("Please don't run installed Fuse from inside the Fuse repository. It will get confused by .unoconfigs.", ReportTo.LogAndUser);
                return(1);
            }

            var program =
                new CliProgram(
                    Log,
                    ColoredTextWriter.Out,
                    ColoredTextWriter.Error,
                    FuseCommandName,
                    () =>
            {
                MoveSdkConfigTmpBackCompatibleThing(shell);
            },
                    DashboardCommand.CreateDashboardCommand(),
                    OpenCommand.CreateOpenCommand(),
                    new LazyCliCommand("daemon", "Start the fuse daemon", false, () => DaemonCommand.CreateDaemonCommand()),
                    new LazyCliCommand("daemon-client", "Create a connection to a daemon.", false, () => DaemonClientCommand.Create()),
                    new LazyCliCommand("preview", "Preview an app", false, () => PreviewCommand.CreatePreviewCommand()),
                    new LazyCliCommand("build", "Build a project for a given target", false, () => BuildCommand.CreateBuildCommand()),
                    new LazyCliCommand("create", "Create a project or file from a template", false, () => CreateCommand.CreateCreateCommand()),
                    new LazyCliCommand("install", "Install an external component", false, () => InstallCommand.CreateInstallCommand()),
                    new LazyCliCommand("event-viewer", "Dump all events", true, () => EventViewerCommand.CreateEventViewerCommand()),
                    new LazyCliCommand("tutorial", "Go to tutorials and guides", false, () => TutorialCommand.CreateTutorialCommand()),
                    new LazyCliCommand("import", "Import a file to your fuse project", false, () => ImportCommand.CreateImportCommand()),
                    new LazyCliCommand("reset-preview", "Causes all active previews to reset to the default state.", true, () => ResetPreviewCliCommand.CreateResetPreviewCommand()),
                    new LazyCliCommand("kill-all", "Kill all Fuse processes (even the daemon)", false, () => KillAllCommand.CreateKillAllCommand()),
                    new LazyCliCommand("unoconfig", "Print uno config", false, () => UnoConfigCommand.CreateUnoConfigCommand()));

            var ctSource = new CancellationTokenSource();

            Console.CancelKeyPress += (sender, eventArgs) => ctSource.Cancel();

            return(program.Main(args.ToArray(), ctSource.Token));
        }