Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: experimental/visual_studio_plugin/src/MsAd7.BaseImpl/ComUtils.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Runtime.InteropServices;
5 using System.Text;
6
7 namespace Google.MsAd7.BaseImpl
8 {
9 public class ComUtils
10 {
11 public static Guid GuidOf(Type t) {
12 Guid result = Guid.Empty;
13
14 object[] attrs = t.GetCustomAttributes(typeof (InheritGuidAttribute),
15 false);
16 if(attrs.Length > 0) {
17 result = GuidOf(((InheritGuidAttribute) attrs[0]).InheritFrom);
18 }
19
20 attrs = t.GetCustomAttributes(typeof (GuidAttribute),false);
21 if (attrs.Length > 0) {
22 result = new Guid(((GuidAttribute) attrs[0]).Value);
23 }
24 return result;
25 }
26
27 public static Guid GuidOf(object o) {
28 return GuidOf(o.GetType());
29 }
30
31 public static void RequireOk(int hr) {
32 if (hr != 0) {
33 throw new COMException("Error", hr);
34 }
35 }
36 }
37
38 public class InheritGuidAttribute : Attribute {
39 public InheritGuidAttribute(Type inheritFrom) {
40 InheritFrom = inheritFrom;
41 }
42
43 public Type InheritFrom { get; set; }
44 }
45
46
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698