Exemplo n.º 1
0
        private void PublishHoloJsApp(AppPublishingOptions opts)
        {
            XrsPackage xrsApp = null;

            try
            {
                xrsApp = XrsPackage.Open(opts.SourcePath);
            }
            catch (Exception)
            {
                Console.WriteLine("Cannot open the specified HoloJs app. Make sure the source points to a valid Spin app.");
                return;
            }

            if (System.IO.File.Exists(opts.DestinationPath) && !opts.Overwrite)
            {
                Console.WriteLine("a XRSX file with this name already exists. Use --overwrite to overwrite it.");
                return;
            }

            Console.WriteLine("Writing XRSX file ...");

            xrsApp.CreatePackage(opts.DestinationPath);

            Console.WriteLine("Done!");
        }
Exemplo n.º 2
0
        private void OpenHoloJsApp(OpenAppOptions opts)
        {
            XrsPackage xrsApp = null;

            try
            {
                xrsApp = XrsPackage.Open(opts.Path);
            }
            catch (Exception)
            {
                Console.WriteLine("Cannot open the specified HoloJs app. Make sure the path to a valid Spin app.");
                return;
            }

            var appDirectory = System.IO.Path.GetDirectoryName(System.IO.Path.GetFullPath(opts.Path));

            RunVsCode(appDirectory);
        }
Exemplo n.º 3
0
        private void EditHoloJsApp(AppEditingOptions opts)
        {
            XrsPackage xrsApp = null;

            try
            {
                xrsApp = XrsPackage.Open(opts.Path);
            }
            catch (Exception)
            {
                Console.WriteLine("Cannot open the specified HoloJs app. Make sure the path to a valid Spin app.");
                return;
            }

            if (!string.IsNullOrEmpty(opts.Name))
            {
                xrsApp.name = opts.Name;
            }

            if (!string.IsNullOrEmpty(opts.AddScriptPath))
            {
                xrsApp.AddScriptFile(opts.AddScriptPath);
            }

            if (!string.IsNullOrEmpty(opts.AddResourcePath))
            {
                xrsApp.AddResourceFile(opts.AddResourcePath);
            }

            if (!string.IsNullOrEmpty(opts.RemoveScriptPath))
            {
                xrsApp.RemoveScript(opts.RemoveScriptPath);
            }

            if (!string.IsNullOrEmpty(opts.RemoveResourcePath))
            {
                xrsApp.RemoveResource(opts.RemoveResourcePath);
            }

            xrsApp.Save();
        }
Exemplo n.º 4
0
        private void ServeHoloJsApp(ServeAppOptions opts)
        {
            XrsPackage xrsApp = null;

            try
            {
                xrsApp = XrsPackage.Open(opts.Path);
            }
            catch (Exception)
            {
                Console.WriteLine("Cannot open the specified HoloJs app. Make sure the source points to a valid Spin app.");
                return;
            }

            DebugHttpServer = new AppServer(opts.Path);

            var appUrl = DebugHttpServer.GetLaunchUrl() + xrsApp.XsrFileName;

            Console.WriteLine("HTTP server running for " + appUrl + ". Ctrl - C to stop.");
            Console.CancelKeyPress += Console_CancelKeyPress;

            if (opts.ShowQr)
            {
                DebugHttpServer.RunAsync();

                QRConnectWindow = new QrConnect();
                QRConnectWindow.SetUrl(appUrl);
                QRConnectWindow.ShowDialog();
            }
            else
            {
                DebugHttpServer.Run();
            }

            Console.WriteLine("HTTP server exited");
        }