Browse Source

Reformatting some string literals

tags/4.1.9.0
Student Main 5 years ago
parent
commit
a44f810890
2 changed files with 10 additions and 12 deletions
  1. +4
    -4
      shadowsocks-csharp/Controller/Service/GfwListUpdater.cs
  2. +6
    -8
      shadowsocks-csharp/Controller/Service/PACServer.cs

+ 4
- 4
shadowsocks-csharp/Controller/Service/GfwListUpdater.cs View File

@@ -81,10 +81,10 @@ namespace Shadowsocks.Controller
List<string> gfwLines = new List<string>();
gfwLines = ParseBase64ToValidList(gfwListResult);
abpContent = $"var __USERRULES__ = {JsonConvert.SerializeObject(userruleLines, Formatting.Indented)};\n" +
$"var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)};\n";
//abpContent = abpContent.Replace("__USERRULES__", JsonConvert.SerializeObject(userruleLines, Formatting.Indented))
// .Replace("__RULES__", JsonConvert.SerializeObject(gfwLines, Formatting.Indented));
abpContent =
$@"var __USERRULES__ = {JsonConvert.SerializeObject(userruleLines, Formatting.Indented)};
var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)};
";
return abpContent;
}


+ 6
- 8
shadowsocks-csharp/Controller/Service/PACServer.cs View File

@@ -164,17 +164,15 @@ namespace Shadowsocks.Controller
string proxy = GetPACAddress(localEndPoint, useSocks);
string pacContent = $"var __PROXY__ = \"{proxy}\";\n" + _pacDaemon.GetPACContent();
//string pacContent = _pacDaemon.GetPACContent().Replace("__PROXY__", proxy);
string responseHead = String.Format(@"HTTP/1.1 200 OK
Server: Shadowsocks
string pacContent = $"var __PROXY__ = '{proxy}';\n" + _pacDaemon.GetPACContent();
string responseHead =
$@"HTTP/1.1 200 OK
Server: ShadowsocksWindows/{UpdateChecker.Version}
Content-Type: application/x-ns-proxy-autoconfig
Content-Length: {0}
Content-Length: { Encoding.UTF8.GetBytes(pacContent).Length}
Connection: Close
", Encoding.UTF8.GetBytes(pacContent).Length);
";
byte[] response = Encoding.UTF8.GetBytes(responseHead + pacContent);
socket.BeginSend(response, 0, response.Length, 0, new AsyncCallback(SendCallback), socket);
Utils.ReleaseMemory(true);


Loading…
Cancel
Save