Пример #1
0
 /// <summary>
 /// Given a Hashtable with field-value pairs, it updates the fields of this VUSB
 /// with the values listed in the Hashtable. Note that only the fields contained
 /// in the Hashtable will be updated and the rest will remain the same.
 /// </summary>
 /// <param name="table"></param>
 public void UpdateFrom(Hashtable table)
 {
     if (table.ContainsKey("uuid"))
     {
         uuid = Marshalling.ParseString(table, "uuid");
     }
     if (table.ContainsKey("allowed_operations"))
     {
         allowed_operations = Helper.StringArrayToEnumList <vusb_operations>(Marshalling.ParseStringArray(table, "allowed_operations"));
     }
     if (table.ContainsKey("current_operations"))
     {
         current_operations = Maps.convert_from_proxy_string_vusb_operations(Marshalling.ParseHashTable(table, "current_operations"));
     }
     if (table.ContainsKey("VM"))
     {
         VM = Marshalling.ParseRef <VM>(table, "VM");
     }
     if (table.ContainsKey("USB_group"))
     {
         USB_group = Marshalling.ParseRef <USB_group>(table, "USB_group");
     }
     if (table.ContainsKey("other_config"))
     {
         other_config = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     }
     if (table.ContainsKey("currently_attached"))
     {
         currently_attached = Marshalling.ParseBool(table, "currently_attached");
     }
 }
Пример #2
0
 /// <summary>
 /// Creates a new VUSB from a Hashtable.
 /// </summary>
 /// <param name="table"></param>
 public VUSB(Hashtable table)
 {
     uuid = Marshalling.ParseString(table, "uuid");
     allowed_operations = Helper.StringArrayToEnumList <vusb_operations>(Marshalling.ParseStringArray(table, "allowed_operations"));
     current_operations = Maps.convert_from_proxy_string_vusb_operations(Marshalling.ParseHashTable(table, "current_operations"));
     VM                 = Marshalling.ParseRef <VM>(table, "VM");
     USB_group          = Marshalling.ParseRef <USB_group>(table, "USB_group");
     other_config       = Maps.convert_from_proxy_string_string(Marshalling.ParseHashTable(table, "other_config"));
     currently_attached = Marshalling.ParseBool(table, "currently_attached");
 }
Пример #3
0
 /// <summary>
 /// Get the current_operations field of the given VUSB.
 /// First published in XenServer 7.3.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_vusb">The opaque_ref of the given vusb</param>
 public static Dictionary <string, vusb_operations> get_current_operations(Session session, string _vusb)
 {
     if (session.JsonRpcClient != null)
     {
         return(session.JsonRpcClient.vusb_get_current_operations(session.opaque_ref, _vusb));
     }
     else
     {
         return(Maps.convert_from_proxy_string_vusb_operations(session.proxy.vusb_get_current_operations(session.opaque_ref, _vusb ?? "").parse()));
     }
 }
Пример #4
0
        internal void UpdateFromProxy(Proxy_VUSB proxy)
        {
            uuid = proxy.uuid == null ? null : proxy.uuid;
            allowed_operations = proxy.allowed_operations == null ? null : Helper.StringArrayToEnumList <vusb_operations>(proxy.allowed_operations);
            current_operations = proxy.current_operations == null ? null : Maps.convert_from_proxy_string_vusb_operations(proxy.current_operations);
            VM = proxy.VM == null ? null : XenRef <VM> .Create(proxy.VM);

            USB_group = proxy.USB_group == null ? null : XenRef <USB_group> .Create(proxy.USB_group);

            other_config       = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            currently_attached = (bool)proxy.currently_attached;
        }
Пример #5
0
 /// <summary>
 /// Get the current_operations field of the given VUSB.
 /// First published in Unreleased.
 /// </summary>
 /// <param name="session">The session</param>
 /// <param name="_vusb">The opaque_ref of the given vusb</param>
 public static Dictionary <string, vusb_operations> get_current_operations(Session session, string _vusb)
 {
     return(Maps.convert_from_proxy_string_vusb_operations(session.proxy.vusb_get_current_operations(session.uuid, _vusb ?? "").parse()));
 }