示例#1
0
        /// <summary> Initializes a new instance of the Stackstorm.Api.Client.St2Client class. </summary>
        /// <exception cref="ArgumentException">Thrown when one or more arguments have unsupported or
        ///          illegal values. </exception>
        /// <param name="authUrl">        URL of the authentication endpoint. </param>
        /// <param name="apiUrl">        URL of the API. </param>
        /// <param name="username">        The username. </param>
        /// <param name="password">        The password. </param>
        /// <param name="ignoreCertificateValidation"> true to ignore certificate validation. </param>
        public St2Client(string authUrl, string apiUrl, string username, string password, bool ignoreCertificateValidation = false)
        {
            if (String.IsNullOrWhiteSpace(authUrl))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'authUrl'.",
                                            "authUrl");
            }

            if (String.IsNullOrWhiteSpace(apiUrl))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'apiUrl'.",
                                            "apiUrl");
            }

            if (String.IsNullOrWhiteSpace(password))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'password'.",
                                            "password");
            }

            if (String.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'username'.",
                                            "username");
            }

            _apiUrl   = new Uri(apiUrl);
            _authUrl  = new Uri(authUrl);
            _password = password;
            _username = username;

            if (ignoreCertificateValidation)
            {
                ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
            }

            Actions    = new ActionsApi(this);
            Packs      = new PacksApi(this);
            Executions = new ExecutionsApi(this);
            Rules      = new RulesApi(this);
            VSphere    = new VSphere(this);
            Core       = new Core(this);
            Email      = new Email(this);
            AzureGov   = new AzureGov(this);
        }
示例#2
0
 private void Connect()
 {
     _vsphere = new VSphere(_options.ApiBaseUrl, _options.ApiUsername, _options.ApiPassword);
 }
    void Start()
    {
        // Some coordinates for the GUI
        int fy   = 10;
        int fw   = 400;
        int btx  = 275;
        int fh   = 25;
        int offs = 7;

        VSphere sphere = GameObject.Find("SphereControler").GetComponent <VSphere>();


        // Create the title textfield with displaying the FPS and running time
        titleTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript));
        titleTF.InitializeTextField(10, fy, fw, fh, offs, 5, true, Color.cyan, 18, FontStyle.Bold);


        titleTF.AddTextLine("VR Sphere ");
        titleTF.AddAutoUpdateLine("Current render FPS: ", () => { return(currentFPS.ToString()); });
        titleTF.AddAutoUpdateLine("Total running time: ", () => { return(Time.realtimeSinceStartup.ToString("F2")); });
        titleTF.AddAutoUpdateLine("3D camera position: ", () => { return(Global.mainCameraScr.getPosition().ToString()); });
        titleTF.AddAutoUpdateLine("Current polygons: ", () => { return(sphere.getPolygonCount().ToString()); });


        fy        += 5 * fh + 3 * offs;
        controlsTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript));
        controlsTF.InitializeTextField(10, fy, fw, fh, offs, 5);
        controlsTF.InitializedActiveLineSettings(btx, offs, () => { Global.mainCameraScr.doubleClick = 0; });
        controlsTF.AddTextLine("<color=#00ffffff>Controls</color>     ");
        controlsTF.AddTextLine("<Double-Click> screen for mouse control");
        controlsTF.AddTextLine("Free camera movement with <WASD> keys");
        controlsTF.AddTextLine("Camera zoom out with <Q>. In with <E>. Or <Scrollwheel>");
        controlsTF.AddTextLine("Loop through predefined points with <Spacebar>");



        fy         += 5 * fh + 3 * offs;
        functionsTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript));
        functionsTF.InitializeTextField(10, fy, fw, fh, offs, 3);
        functionsTF.InitializedActiveLineSettings(btx, offs, () => { Global.mainCameraScr.doubleClick = 0; });

        functionsTF.AddTextLine("<color=#00ffffff>Settings</color>     ");
        functionsTF.AddActiveLine("Rays: ", "Whether the whole rays should be drawn or the actual desired model.", "",
                                  new string[] { "Object", "Full" }, new System.Action[] { () => { sphere.FullRays = false; },
                                                                                           () => { sphere.FullRays = true; } },
                                  () => { return(sphere.FullRays ? "Full" : "Object"); },
                                  KeyCode.U);

        functionsTF.AddActiveLine("Paused: ", "Model updating is paused or not.", "",
                                  new string[] { "Yes", "No" }, new System.Action[] { () => { sphere.Paused = true; },
                                                                                      () => { sphere.Paused = false; } },
                                  () => { return(sphere.Paused ? "Yes" : "No"); },
                                  KeyCode.P);

        fy       += 3 * fh + 3 * offs;
        previewTF = (TextFieldScript)Instantiate(Global.TextFieldObject).GetComponent(typeof(TextFieldScript));
        previewTF.InitializeTextField(10, fy, fw, fh, offs, 4);
        previewTF.InitializedActiveLineSettings(btx, offs, () => { Global.mainCameraScr.doubleClick = 0; });

        previewTF.AddTextLine("<color=#00ffffff>Preview</color>     ");

        /*
         * previewTF.AddActiveLine("Preview Window: ", "The camera input preview is visible or not.", "",
         *                               new string[] { "OFF", "ON" }, new System.Action[] {()=>{sphere.PreviewEnabled = false;},
         *                                                                                  ()=>{sphere.PreviewEnabled = true;} },
         *                                                                                  () => { return (sphere.PreviewEnabled ? "ON" : "OFF"); },
         *                                                                                  KeyCode.P);
         */

        previewTF.AddActiveLine("Preview Mode: ", "Type of preview mode.", "",
                                new string[] { "Last", "Next" }, new System.Action[] { () => { sphere.nextPreviewType(); },
                                                                                       () => { sphere.lastPreviewType(); } },
                                () => { return(sphere.PreviewType.ToString()); },
                                KeyCode.M, KeyCode.DownArrow, KeyCode.UpArrow);


        previewTF.AddActiveLine("Separated Windows: ", "The camera input preview is separated into multiple windows.", "",
                                new string[] { "OFF", "ON" }, new System.Action[] { () => { sphere.PreviewWindowVariant = 2; },
                                                                                    () => { sphere.PreviewWindowVariant = 1; } },
                                () => { return(sphere.PreviewWindowVariant == 1 ? "ON" : "OFF"); },
                                KeyCode.I);

        previewTF.AddActiveLine("Preview focus: ", "Which camera is in focus in the non-separated preivew window.", "",
                                new string[] { "Last", "Next" }, new System.Action[] { () => { sphere.lastPreviewWindowOrderOffset(); },
                                                                                       () => { sphere.nextPreviewWindowOrderOffset(); } },
                                () => { return(sphere.PreviewWindowOrderOffset.ToString()); },
                                KeyCode.F, KeyCode.UpArrow, KeyCode.DownArrow);
    }
 public StackstormConnector()
 {
     this.VSphere = new VSphere();
 }