/// <summary> /// Get n-th properties. /// </summary> /// <typeparam name="T">Type of result.</typeparam> /// <param name="index">Property index.</param> /// <param name="properties">Property objects.</param> /// <returns>N'th properties.</returns> public T GetNthProperties <T>(int index, object[] properties) { object result = null; VMWareInterop.Check(_handle.GetNthProperties(index, properties, ref result)); return((T)result); }
/// <summary> /// Wait for the job to complete, return a result. /// </summary> /// <param name="properties">Properties to return.</param> /// <typeparam name="T">Type of results.</typeparam> /// <returns>A job result.</returns> private T Wait <T>(object[] properties) { object result = null; VMWareInterop.Check(_handle.Wait(properties, ref result)); return((T)result); }
/// <summary> /// Get an array of properties. /// </summary> /// <param name="properties">properties to fetch</param> /// <returns>An array of property values.</returns> public object[] GetProperties(object[] properties) { object result = null; VMWareInterop.Check(_vixhandle.GetProperties(properties, ref result)); return((object[])result); }
/// <summary> /// Current snapshot. /// </summary> /// <returns>Current snapshot.</returns> public VMWareSnapshot GetCurrentSnapshot() { ISnapshot snapshot = null; VMWareInterop.Check(_vm.GetCurrentSnapshot(out snapshot)); return(new VMWareSnapshot(_vm, snapshot, null)); }
/// <summary> /// A VMWare job created with a job completion callback. /// </summary> /// <param name="job">An instance of IJob.</param> /// <param name="callback">Job completion callback.</param> public VMWareJob(IJob job, VMWareJobCallback callback) : base(job) { _callback = callback; // API-level errors aren't surfaced and the callback wait will never be set bool completedImmediately = false; VMWareInterop.Check(job.CheckCompletion(out completedImmediately)); }
/// <summary> /// Get a snapshot by its exact name. /// </summary> /// <param name="name">Snapshot name.</param> /// <returns>A snapshot.</returns> /// <remarks>This function will throw an exception if more than one snapshot with the same exists or if the snapshot doesn't exist.</remarks> public VMWareSnapshot GetNamedSnapshot(string name) { ISnapshot snapshot = null; ulong rc = _vm.GetNamedSnapshot(name, out snapshot); switch (rc) { case Constants.VIX_OK: return(new VMWareSnapshot(_vm, snapshot, null)); default: VMWareInterop.Check(rc); break; } return(null); }
/// <summary> /// Wait for the job to complete, timeout. /// </summary> /// <param name="timeoutInSeconds">Timeout in seconds.</param> public void Wait(int timeoutInSeconds) { _callback.WaitForCompletion(timeoutInSeconds * 1000); VMWareInterop.Check(_handle.WaitWithoutResults()); }