-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Expand file tree
/
Copy pathDevToolsDomainBase.cs
More file actions
39 lines (32 loc) · 1.23 KB
/
DevToolsDomainBase.cs
File metadata and controls
39 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright © 2020 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using CefSharp.DevTools.Browser;
namespace CefSharp.DevTools
{
public abstract class DevToolsDomainBase
{
protected string EnumToString(Enum val)
{
var memInfo = val.GetType().GetMember(val.ToString());
var dataMemberAttribute = (EnumMemberAttribute)Attribute.GetCustomAttribute(memInfo[0], typeof(EnumMemberAttribute), false);
return dataMemberAttribute.Value;
}
protected IEnumerable<string> EnumToString(PermissionType[] values)
{
foreach (var val in values)
{
var memInfo = val.GetType().GetMember(val.ToString());
var dataMemberAttribute = (EnumMemberAttribute)Attribute.GetCustomAttribute(memInfo[0], typeof(EnumMemberAttribute), false);
yield return dataMemberAttribute.Value;
}
}
protected string ToBase64String(byte[] bytes)
{
return Convert.ToBase64String(bytes);
}
}
}