Winify – Diff between revs 14 and 28
?pathlinks?
Rev 14 | Rev 28 | |||
---|---|---|---|---|
Line 26... | Line 26... | |||
26 | public static bool LaunchOnBootSet(bool enable) |
26 | public static bool LaunchOnBootSet(bool enable) |
|
27 | { |
27 | { |
|
28 | using (var key = Registry.CurrentUser.OpenSubKey |
28 | using (var key = Registry.CurrentUser.OpenSubKey |
|
29 | ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) |
29 | ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true)) |
|
30 | { |
30 | { |
|
31 | if (key == null) |
- | ||
32 | { |
- | ||
33 | return false; |
31 | if (key == null) return false; |
|
34 | } |
- | ||
Line 35... | Line 32... | |||
35 | |
32 | |
|
36 | switch (enable) |
33 | switch (enable) |
|
37 | { |
34 | { |
|
38 | case true: |
35 | case true: |
|
Line 62... | Line 59... | |||
62 | /// <param name="control">the control to enable double buffering for</param> |
59 | /// <param name="control">the control to enable double buffering for</param> |
|
63 | /// <returns>true on success</returns> |
60 | /// <returns>true on success</returns> |
|
64 | /// <remarks>Do not enable double buffering on RDP: https://devblogs.microsoft.com/oldnewthing/20060103-12/?p=32793</remarks> |
61 | /// <remarks>Do not enable double buffering on RDP: https://devblogs.microsoft.com/oldnewthing/20060103-12/?p=32793</remarks> |
|
65 | public static bool SetDoubleBuffered(this Control control) |
62 | public static bool SetDoubleBuffered(this Control control) |
|
66 | { |
63 | { |
|
67 | if (SystemInformation.TerminalServerSession) |
64 | if (SystemInformation.TerminalServerSession) return false; |
|
68 | { |
- | ||
69 | return false; |
- | ||
70 | } |
- | ||
Line 71... | Line 65... | |||
71 | |
65 | |
|
72 | var dgvType = control.GetType(); |
66 | var dgvType = control.GetType(); |
|
73 | var pi = dgvType.GetProperty("DoubleBuffered", |
67 | var pi = dgvType.GetProperty("DoubleBuffered", |
|
74 | BindingFlags.Instance | BindingFlags.NonPublic); |
- | ||
75 | if (pi == null) |
- | ||
76 | { |
68 | BindingFlags.Instance | BindingFlags.NonPublic); |
|
77 | return false; |
- | ||
Line 78... | Line 69... | |||
78 | } |
69 | if (pi == null) return false; |
|
Line 79... | Line 70... | |||
79 | |
70 | |
|
80 | pi.SetValue(control, true, null); |
71 | pi.SetValue(control, true, null); |
|
Line 98... | Line 89... | |||
98 | { |
89 | { |
|
99 | var assembly = Assembly.GetExecutingAssembly(); |
90 | var assembly = Assembly.GetExecutingAssembly(); |
|
Line 100... | Line 91... | |||
100 | |
91 | |
|
101 | using (var manifestResourceStream = assembly.GetManifestResourceStream(resource)) |
92 | using (var manifestResourceStream = assembly.GetManifestResourceStream(resource)) |
|
102 | { |
93 | { |
|
103 | if (manifestResourceStream == null) |
- | ||
104 | { |
- | ||
105 | return null; |
- | ||
Line 106... | Line 94... | |||
106 | } |
94 | if (manifestResourceStream == null) return null; |
|
Line 107... | Line 95... | |||
107 | |
95 | |
|
Line 142... | Line 130... | |||
142 | |
130 | |
|
143 | using (var ea = a.GetEnumerator()) |
131 | using (var ea = a.GetEnumerator()) |
|
144 | { |
132 | { |
|
145 | while (ea.MoveNext()) |
133 | while (ea.MoveNext()) |
|
146 | { |
134 | { |
|
147 | if (ea.Current == null) |
- | ||
148 | { |
- | ||
149 | continue; |
- | ||
Line 150... | Line 135... | |||
150 | } |
135 | if (ea.Current == null) continue; |
|
151 | |
136 | |
|
152 | foreach (var ib in eb) |
137 | foreach (var ib in eb) |
|
153 | { |
- | ||
154 | if (cmp.Invoke(ea.Current, ib)) |
- | ||
155 | { |
- | ||
Line 156... | Line 138... | |||
156 | continue; |
138 | { |
|
Line 157... | Line 139... | |||
157 | } |
139 | if (cmp.Invoke(ea.Current, ib)) continue; |
|
158 | |
140 | |
|
Line 178... | Line 160... | |||
178 | RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) |
160 | RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) |
|
179 | { |
161 | { |
|
180 | using (var rk = localMachineX64View.OpenSubKey(location)) |
162 | using (var rk = localMachineX64View.OpenSubKey(location)) |
|
181 | { |
163 | { |
|
182 | if (rk == null) |
164 | if (rk == null) |
|
183 | { |
- | ||
184 | throw new KeyNotFoundException( |
165 | throw new KeyNotFoundException( |
|
185 | string.Format("Key Not Found: {0}", location)); |
166 | string.Format("Key Not Found: {0}", location)); |
|
186 | } |
- | ||
Line 187... | Line 167... | |||
187 | |
167 | |
|
188 | var machineGuid = rk.GetValue(name); |
168 | var machineGuid = rk.GetValue(name); |
|
189 | if (machineGuid == null) |
- | ||
190 | { |
169 | if (machineGuid == null) |
|
191 | throw new IndexOutOfRangeException( |
170 | throw new IndexOutOfRangeException( |
|
192 | string.Format("Index Not Found: {0}", name)); |
- | ||
Line 193... | Line 171... | |||
193 | } |
171 | string.Format("Index Not Found: {0}", name)); |
|
194 | |
172 | |
|
195 | return machineGuid.ToString(); |
173 | return machineGuid.ToString(); |
|
196 | } |
174 | } |