Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornosami <jasonimison@gmail.com>2022-06-10 01:18:38 +0300
committernosami <jasonimison@gmail.com>2022-06-10 01:18:38 +0300
commit3e45fef6c647f7fdc7d3f5c07b48b2e6e4056f87 (patch)
tree9a1049a67f151f7dbab569c1031a2871cf9bb7c0
parentab8035a8feb9ac57628f3a74fcc744c65583625d (diff)
Simplify uri -> filename conversion
-rw-r--r--Mono.Debugging/Mono.Debugging.Client/SourceLink.cs25
1 files changed, 1 insertions, 24 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs b/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs
index 9c78393..56cde15 100644
--- a/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs
+++ b/Mono.Debugging/Mono.Debugging.Client/SourceLink.cs
@@ -1,17 +1,11 @@
using System;
-using System.Collections.Generic;
using System.IO;
-using System.Linq;
-using System.Text;
namespace Mono.Debugging.Client
{
[Serializable]
public class SourceLink
{
- // Keep the / character to use as a path separator to help group related symbols
- static readonly HashSet<char> invalids = new HashSet<char>(Path.GetInvalidFileNameChars ().Except (new char[] { '/' }));
-
public string Uri { get; }
public string RelativeFilePath { get; }
@@ -25,24 +19,7 @@ namespace Mono.Debugging.Client
public string GetDownloadLocation (string cachePath)
{
var uri = new Uri (Uri);
- return Path.Combine (cachePath, MakeValidFileName (uri));
- }
-
- static string MakeValidFileName (Uri uri)
- {
- // Remove scheme from uri
- var text = uri.Host + uri.PathAndQuery;
- var sb = new StringBuilder (text.Length);
- for (int i = 0; i < text.Length; i++) {
- char c = text[i];
- if (invalids.Contains (c)) {
- sb.Append ('_');
- } else
- sb.Append (c);
- }
- if (sb.Length == 0)
- return "_";
- return sb.ToString ();
+ return Path.Combine (cachePath, uri.Host + uri.PathAndQuery);
}
}
}