66 |
|
//path = builder.ToString(); |
67 |
|
//this.ConfigFilePath = path; |
68 |
|
|
69 |
+ |
|
70 |
+ |
//var asm_test = Assembly.LoadFile(this.AssemblyInfo.Location); |
71 |
+ |
|
72 |
|
ClientConfigPaths t = new ClientConfigPaths(this.AssemblyInfo, true); |
73 |
< |
|
73 |
> |
|
74 |
> |
this.ConfigFilePath = t.LocalConfigFilename; |
75 |
|
|
76 |
|
} |
77 |
|
|
99 |
|
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', |
100 |
|
'y', 'z', '0', '1', '2', '3', '4', '5'}; |
101 |
|
|
102 |
< |
static volatile ClientConfigPaths s_current; |
103 |
< |
static volatile bool s_currentIncludesUserConfig; |
102 |
> |
//static volatile ClientConfigPaths s_current; |
103 |
> |
//static volatile bool s_currentIncludesUserConfig; |
104 |
|
static SecurityPermission s_serializationPerm; |
105 |
|
static SecurityPermission s_controlEvidencePerm; |
106 |
|
|
107 |
< |
bool _hasEntryAssembly; |
108 |
< |
bool _includesUserConfig; |
109 |
< |
string _applicationUri; |
110 |
< |
string _applicationConfigUri; |
107 |
> |
//bool _hasEntryAssembly; |
108 |
> |
//bool _includesUserConfig; |
109 |
> |
//string _applicationUri; |
110 |
> |
//string _applicationConfigUri; |
111 |
|
string _roamingConfigDirectory; |
112 |
|
string _roamingConfigFilename; |
113 |
|
string _localConfigDirectory; |
242 |
|
//string validAppDomainName = Validate(AppDomain.CurrentDomain.FriendlyName, true); |
243 |
|
string friendlyName = new FileInfo(exeAssembly.Location).Name; |
244 |
|
string validAppDomainName = Validate(friendlyName, true); |
245 |
< |
string applicationUriLower = !String.IsNullOrEmpty(_applicationUri) ? _applicationUri.ToLower(CultureInfo.InvariantCulture) : null; |
245 |
> |
//string applicationUriLower = !String.IsNullOrEmpty(_applicationUri) ? _applicationUri.ToLower(CultureInfo.InvariantCulture) : null; |
246 |
|
string namePrefix = !String.IsNullOrEmpty(validAppDomainName) ? validAppDomainName : Validate(_productName, true); |
247 |
|
//string hashSuffix = GetTypeAndHashSuffix(AppDomain.CurrentDomain, applicationUriLower); |
248 |
< |
string hashSuffix = GetTypeAndHashSuffix(exeAssembly, applicationUriLower); |
248 |
> |
//string hashSuffix = GetTypeAndHashSuffix(exeAssembly, applicationUriLower); |
249 |
> |
string hashSuffix = GetTypeAndHashSuffix(exeAssembly); |
250 |
|
|
251 |
|
string part2 = (!String.IsNullOrEmpty(namePrefix) && !String.IsNullOrEmpty(hashSuffix)) ? namePrefix + hashSuffix : null; |
252 |
|
|
292 |
|
// return result; |
293 |
|
//} |
294 |
|
|
295 |
< |
internal static void RefreshCurrent() |
296 |
< |
{ |
297 |
< |
s_currentIncludesUserConfig = false; |
298 |
< |
s_current = null; |
299 |
< |
} |
295 |
> |
//internal static void RefreshCurrent() |
296 |
> |
//{ |
297 |
> |
// s_currentIncludesUserConfig = false; |
298 |
> |
// s_current = null; |
299 |
> |
//} |
300 |
|
|
301 |
|
//internal static ClientConfigPaths Current |
302 |
|
//{ |
306 |
|
// } |
307 |
|
//} |
308 |
|
|
309 |
< |
internal bool HasEntryAssembly |
310 |
< |
{ |
311 |
< |
get |
312 |
< |
{ |
313 |
< |
return _hasEntryAssembly; |
314 |
< |
} |
315 |
< |
} |
309 |
> |
//internal bool HasEntryAssembly |
310 |
> |
//{ |
311 |
> |
// get |
312 |
> |
// { |
313 |
> |
// return _hasEntryAssembly; |
314 |
> |
// } |
315 |
> |
//} |
316 |
|
|
317 |
< |
internal string ApplicationUri |
318 |
< |
{ |
319 |
< |
get |
320 |
< |
{ |
321 |
< |
return _applicationUri; |
322 |
< |
} |
323 |
< |
} |
317 |
> |
//internal string ApplicationUri |
318 |
> |
//{ |
319 |
> |
// get |
320 |
> |
// { |
321 |
> |
// return _applicationUri; |
322 |
> |
// } |
323 |
> |
//} |
324 |
|
|
325 |
< |
internal string ApplicationConfigUri |
326 |
< |
{ |
327 |
< |
get |
328 |
< |
{ |
329 |
< |
return _applicationConfigUri; |
330 |
< |
} |
331 |
< |
} |
325 |
> |
//internal string ApplicationConfigUri |
326 |
> |
//{ |
327 |
> |
// get |
328 |
> |
// { |
329 |
> |
// return _applicationConfigUri; |
330 |
> |
// } |
331 |
> |
//} |
332 |
|
|
333 |
|
internal string RoamingConfigFilename |
334 |
|
{ |
346 |
|
} |
347 |
|
} |
348 |
|
|
349 |
< |
internal bool HasRoamingConfig |
350 |
< |
{ |
351 |
< |
get |
352 |
< |
{ |
353 |
< |
// Assume we have roaming config if we haven't loaded user config file information. |
354 |
< |
return RoamingConfigFilename != null || !_includesUserConfig; |
355 |
< |
} |
356 |
< |
} |
349 |
> |
//internal bool HasRoamingConfig |
350 |
> |
//{ |
351 |
> |
// get |
352 |
> |
// { |
353 |
> |
// // Assume we have roaming config if we haven't loaded user config file information. |
354 |
> |
// return RoamingConfigFilename != null || !_includesUserConfig; |
355 |
> |
// } |
356 |
> |
//} |
357 |
|
|
358 |
|
internal string LocalConfigFilename |
359 |
|
{ |
371 |
|
} |
372 |
|
} |
373 |
|
|
374 |
< |
internal bool HasLocalConfig |
375 |
< |
{ |
376 |
< |
get |
377 |
< |
{ |
378 |
< |
// Assume we have roaming config if we haven't loaded user config file information. |
379 |
< |
return LocalConfigFilename != null || !_includesUserConfig; |
380 |
< |
} |
381 |
< |
} |
374 |
> |
//internal bool HasLocalConfig |
375 |
> |
//{ |
376 |
> |
// get |
377 |
> |
// { |
378 |
> |
// // Assume we have roaming config if we haven't loaded user config file information. |
379 |
> |
// return LocalConfigFilename != null || !_includesUserConfig; |
380 |
> |
// } |
381 |
> |
//} |
382 |
|
|
383 |
|
internal string ProductName |
384 |
|
{ |
447 |
|
// priority order, is Strong Name, Url and Exe Path. If one of these is found, we compute a |
448 |
|
// SHA1 hash of it and return a suffix based on that. If none is found, we return null. |
449 |
|
//private string GetTypeAndHashSuffix(AppDomain appDomain, string exePath) |
450 |
< |
private string GetTypeAndHashSuffix(Assembly appDomain, string exePath) |
450 |
> |
//private string GetTypeAndHashSuffix(Assembly appDomain, string exePath) |
451 |
> |
private string GetTypeAndHashSuffix(Assembly appDomain) |
452 |
|
{ |
453 |
|
string suffix = null; |
454 |
|
string typeName = null; |
455 |
|
object evidenceObj = null; |
456 |
< |
|
457 |
< |
evidenceObj = GetEvidenceInfo(appDomain, exePath, out typeName); |
456 |
> |
//evidenceObj = GetEvidenceInfo(appDomain, exePath, out typeName); |
457 |
> |
evidenceObj = GetEvidenceInfo(appDomain, out typeName); |
458 |
|
|
459 |
|
if (evidenceObj != null && !String.IsNullOrEmpty(typeName)) |
460 |
|
{ |
476 |
|
|
477 |
|
// Mostly borrowed from IsolatedStorage, with some modifications |
478 |
|
//private static object GetEvidenceInfo(AppDomain appDomain, string exePath, out string typeName) |
479 |
< |
private static object GetEvidenceInfo(Assembly appDomain, string exePath, out string typeName) |
479 |
> |
//private static object GetEvidenceInfo(Assembly appDomain, string exePath, out string typeName) |
480 |
> |
private static object GetEvidenceInfo(Assembly appDomain, out string typeName) |
481 |
|
{ |
482 |
|
ControlEvidencePermission.Assert(); |
483 |
|
Evidence evidence = appDomain.Evidence; |
519 |
|
o = url.Value.ToUpperInvariant(); |
520 |
|
typeName = UrlDesc; |
521 |
|
} |
522 |
< |
else if (exePath != null) |
523 |
< |
{ |
524 |
< |
o = exePath; |
525 |
< |
typeName = PathDesc; |
526 |
< |
} |
522 |
> |
//else if (exePath != null) |
523 |
> |
//{ |
524 |
> |
// o = exePath; |
525 |
> |
// typeName = PathDesc; |
526 |
> |
//} |
527 |
|
else |
528 |
|
{ |
529 |
|
typeName = null; |