Browse Source

Merge branch 'master' into patch-1

tags/4.2.1.0
Allen Zhu GitHub 5 years ago
parent
commit
b4d02f8334
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 8192 additions and 8349 deletions
  1. +10
    -0
      CHANGES
  2. +186
    -22
      appveyor.yml
  3. +24
    -0
      appveyor.yml.obsolete
  4. +483
    -0
      appveyor.yml.sample
  5. +0
    -6
      nuget.config
  6. +129
    -128
      shadowsocks-csharp/Controller/Service/GfwListUpdater.cs
  7. +2
    -2
      shadowsocks-csharp/Controller/Service/PACDaemon.cs
  8. +7
    -7
      shadowsocks-csharp/Controller/Service/PACServer.cs
  9. +1
    -1
      shadowsocks-csharp/Controller/Service/UpdateChecker.cs
  10. +4
    -3
      shadowsocks-csharp/Data/abp.js
  11. +7250
    -0
      shadowsocks-csharp/Data/default-abp-rule.js
  12. +0
    -8040
      shadowsocks-csharp/Data/proxy.pac.txt
  13. +1
    -1
      shadowsocks-csharp/FodyWeavers.xsd
  14. +66
    -68
      shadowsocks-csharp/Properties/Resources.Designer.cs
  15. +3
    -3
      shadowsocks-csharp/Properties/Resources.resx
  16. +7
    -7
      shadowsocks-csharp/packages.config
  17. +17
    -59
      shadowsocks-csharp/shadowsocks-csharp.csproj
  18. +1
    -1
      test/ShadowsocksTest.csproj
  19. +1
    -1
      test/packages.config

+ 10
- 0
CHANGES View File

@@ -1,3 +1,13 @@
4.1.8 2019-10-31
- Update the nuget configurations and packages
- Fix some crash about thread-safe in statistics (#2591)
- Fix server list index invalidation (#2543, #2542)
- Refine PAC server (#2539)
- Update the GFWList via IPv6Loopback when available
- Modify PAC request behavior (#2526)
- Fix .NET 4.7.2 on Win7 TLS compatibility (#2473)
- Other minor bug fixes and improvements
4.1.7.1 2019-07-14
- Fix unexpected server delete behavior (#2459)
- Reduce info log when checking Windows 10 Light Theme


+ 186
- 22
appveyor.yml View File

@@ -1,22 +1,186 @@
version: 1.0.{build}
image: Visual Studio 2017
environment:
matrix:
- platform: x86
configuration: Debug
- platform: x86
configuration: Release
matrix:
fast_finish: false
nuget:
project_feed: true
before_build:
- cmd: nuget restore
build:
parallel: true
verbosity: normal
artifacts:
- path: shadowsocks-csharp\bin\x86\Release\Shadowsocks.exe
name: Shadowsocks-release.exe
- path: shadowsocks-csharp\bin\x86\Debug\Shadowsocks.exe
name: Shadowsocks-debug.exe
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
# Build version format is taken from UI if it is not set
# version: 1.0.{build}
# # branches to build
# branches:
# # whitelist
# only:
# - master
# - production
# # blacklist
# except:
# - gh-pages
#---------------------------------#
# environment configuration #
#---------------------------------#
# Build worker image (VM template)
image: Visual Studio 2017
# scripts that are called at very beginning, before repo cloning
# init:
# - git config --global core.autocrlf false
# set clone depth
clone_depth: 5 # clone entire repository history if not defined
# environment variables
environment:
# my_var1: value1
# # this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
# my_secure_var1:
# secure: FW3tJ3fMncxvs58/ifSP7w==
matrix:
- platform: x86
configuration: Debug
- platform: x86
configuration: Release
# this is how to allow failing jobs in the matrix
matrix:
fast_finish: false # set this flag to immediately finish build once one of the jobs fails.
# build cache to preserve files/folders between builds
cache:
- packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
# - '%LocalAppData%\NuGet\Cache' # NuGet < v3
- '%LocalAppData%\NuGet\v3-cache' # NuGet v3
# Automatically register private account and/or project AppVeyor NuGet feeds.
# nuget:
# account_feed: true
# project_feed: true
# disable_publish_on_pr: true # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
# publish_wap_octopus: true # disable publishing of Octopus Deploy .nupkg artifacts to account/project feeds
#---------------------------------#
# build configuration #
#---------------------------------#
# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
build:
# parallel: true # enable MSBuild parallel builds
# publish_nuget: true # package projects with .nuspec files and push to artifacts
# publish_nuget_symbols: true # generate and publish NuGet symbol packages
# include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts
# MSBuild verbosity level
verbosity: normal # quiet|minimal|normal|detailed
# scripts to run before build
before_build:
- cmd: nuget restore
# to run your custom scripts instead of automatic MSBuild
# build_script:
# scripts to run after build (working directory and environment changes are persisted from the previous steps)
after_build:
ps: |
function CalculateHash($file)
{
$newLine = "`r`n"
$text = (Split-Path $file -Leaf) + $newLine
$text += 'MD5' + $newLine
$text += (Get-FileHash $file -Algorithm MD5).Hash + $newLine
$text += 'SHA-1' + $newLine
$text += (Get-FileHash $file -Algorithm SHA1).Hash + $newLine
$text += 'SHA-256' + $newLine
$text += (Get-FileHash $file -Algorithm SHA256).Hash + $newLine
$text += 'SHA-512' + $newLine
$text += (Get-FileHash $file -Algorithm SHA512).Hash
return $text
}
$WorkingFolder = "$env:APPVEYOR_BUILD_FOLDER\working"
$ExeFileName = "Shadowsocks-$env:APPVEYOR_BUILD_VERSION-$env:CONFIGURATION.exe"
$ExeFile = "$WorkingFolder\$ExeFileName"
$ExeHashFile = "$Exefile.hash"
New-Item $WorkingFolder -ItemType Directory -Force
Copy-Item $env:APPVEYOR_BUILD_FOLDER\shadowsocks-csharp\bin\$env:PLATFORM\$env:CONFIGURATION\Shadowsocks.exe $WorkingFolder\Shadowsocks.exe
Copy-Item $WorkingFolder\Shadowsocks.exe $ExeFile
CalculateHash -file $Exefile | Out-File -FilePath $ExeHashFile
Push-AppveyorArtifact $ExeFile
Push-AppveyorArtifact $ExeHashFile
# Create and deploy the release zip
if ($env:configuration -eq 'Release')
{
$ReleaseFile = "$WorkingFolder\Shadowsocks.exe"
$HashFile = "$ReleaseFile.hash"
$ZipFile = "$WorkingFolder\Shadowsocks-$env:APPVEYOR_BUILD_VERSION.zip"
$ZipHashFile = "$ZipFile.hash"
# Calculate exe Hash and archieve both exe and hash to zip
CalculateHash -file $ReleaseFile | Out-File -FilePath $hashFile
7z a $ZipFile $ReleaseFile
7z a $ZipFile $HashFile
Push-AppveyorArtifact $ZipFile
# Calculate zip Hash
CalculateHash -file $ZipFile | Out-File -FilePath $ZipHashFile
Push-AppveyorArtifact $ZipHashFile
}
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
# before_package:
# to disable automatic builds
#build: off
#---------------------------------#
# deployment configuration #
#---------------------------------#
# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment
# provider names are case-sensitive!
deploy:
# Deploy to GitHub Releases
- provider: GitHub
auth_token:
secure: ZrRlVe3eWp1ccIVZcmFrI7vaCxwz5ewIMSmaPUTjMGyC1rVRlYm7nWWi6Pzkpe0A
description: '%APPVEYOR_BUILD_VERSION%'
artifact: Shadowsocks-%APPVEYOR_BUILD_VERSION%.zip, Shadowsocks-%APPVEYOR_BUILD_VERSION%.zip.hash
draft: true
prerelease: true
on:
branch: master # release from master branch only
configuration: Release
APPVEYOR_REPO_TAG: true # deploy on tag push only
# # scripts to run before deployment
# before_deploy:
# # scripts to run after deployment
# after_deploy:
# # to run your custom scripts instead of provider deployments
# deploy_script:
# # to disable deployment
#deploy: off

+ 24
- 0
appveyor.yml.obsolete View File

@@ -0,0 +1,24 @@
# Created by wongsyrone

version: 1.0.{build}
image: Visual Studio 2017
environment:
matrix:
- platform: x86
configuration: Debug
- platform: x86
configuration: Release
matrix:
fast_finish: false
nuget:
project_feed: true
before_build:
- cmd: nuget restore
build:
parallel: true
verbosity: normal
artifacts:
- path: shadowsocks-csharp\bin\x86\Release\Shadowsocks.exe
name: Shadowsocks-release.exe
- path: shadowsocks-csharp\bin\x86\Debug\Shadowsocks.exe
name: Shadowsocks-debug.exe

+ 483
- 0
appveyor.yml.sample View File

@@ -0,0 +1,483 @@
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: 1.0.{build}
# you can use {branch} name in version format too
# version: 1.0.{build}-{branch}
# branches to build
branches:
# whitelist
only:
- master
- production
# blacklist
except:
- gh-pages
# Do not build on tags (GitHub and BitBucket)
skip_tags: true
# Start builds on tags only (GitHub and BitBucket)
skip_non_tags: true
# Skipping commits with particular message or from specific user
skip_commits:
message: /Created.*\.(png|jpg|jpeg|bmp|gif)/ # Regex for matching commit message
author: John # Commit author's username, name, email or regexp maching one of these.
# Including commits with particular message or from specific user
only_commits:
message: /build/ # Start a new build if message contains 'build'
author: jack@company.com # Start a new build for commit of user with email jack@company.com
# Skipping commits affecting specific files (GitHub only). More details here: /docs/appveyor-yml
#skip_commits:
# files:
# - docs/*
# - '**/*.html'
# Including commits affecting specific files (GitHub only). More details here: /docs/appveyor-yml
#only_commits:
# files:
# - Project-A/
# - Project-B/
# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true
# Maximum number of concurrent jobs for the project
max_jobs: 1
#---------------------------------#
# environment configuration #
#---------------------------------#
# Build worker image (VM template)
image: Visual Studio 2015
# scripts that are called at very beginning, before repo cloning
init:
- git config --global core.autocrlf input
# clone directory
clone_folder: c:\projects\myproject
# fetch repository as zip archive
shallow_clone: true # default is "false"
# set clone depth
clone_depth: 5 # clone entire repository history if not defined
# setting up etc\hosts file
hosts:
queue-server: 127.0.0.1
db.server.com: 127.0.0.2
# environment variables
environment:
my_var1: value1
my_var2: value2
# this is how to set encrypted variable. Go to "Settings" -> "Encrypt YAML" page in account menu to encrypt data.
my_secure_var1:
secure: FW3tJ3fMncxvs58/ifSP7w==
# environment:
# global:
# connection_string: server=12;password=13;
# service_url: https://127.0.0.1:8090
#
# matrix:
# - db: mysql
# provider: mysql
#
# - db: mssql
# provider: mssql
# password:
# secure: $#(JFDA)jQ@#$
# this is how to allow failing jobs in the matrix
matrix:
fast_finish: true # set this flag to immediately finish build once one of the jobs fails.
allow_failures:
- platform: x86
configuration: Debug
- platform: x64
configuration: Release
# exclude configuration from the matrix. Works similarly to 'allow_failures' but build not even being started for excluded combination.
exclude:
- platform: x86
configuration: Debug
# build cache to preserve files/folders between builds
cache:
- packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
- projectA\libs
- node_modules # local npm modules
- '%LocalAppData%\NuGet\Cache' # NuGet < v3
- '%LocalAppData%\NuGet\v3-cache' # NuGet v3
# enable service required for build/tests
services:
- mssql2014 # start SQL Server 2014 Express
- mssql2014rs # start SQL Server 2014 Express and Reporting Services
- mssql2012sp1 # start SQL Server 2012 SP1 Express
- mssql2012sp1rs # start SQL Server 2012 SP1 Express and Reporting Services
- mssql2008r2sp2 # start SQL Server 2008 R2 SP2 Express
- mssql2008r2sp2rs # start SQL Server 2008 R2 SP2 Express and Reporting Services
- mysql # start MySQL 5.6 service
- postgresql # start PostgreSQL 9.5 service
- iis # start IIS
- msmq # start Queuing services
- mongodb # start MongoDB
# scripts that run after cloning repository
install:
# by default, all script lines are interpreted as batch
- echo This is batch
# to run script as a PowerShell command prepend it with ps:
- ps: Write-Host 'This is PowerShell'
# batch commands start from cmd:
- cmd: echo This is batch again
- cmd: set MY_VAR=12345
# enable patching of AssemblyInfo.* files
assembly_info:
patch: true
file: AssemblyInfo.*
assembly_version: "2.2.{build}"
assembly_file_version: "{version}"
assembly_informational_version: "{version}"
# Automatically register private account and/or project AppVeyor NuGet feeds.
nuget:
account_feed: true
project_feed: true
disable_publish_on_pr: true # disable publishing of .nupkg artifacts to account/project feeds for pull request builds
publish_wap_octopus: true # disable publishing of Octopus Deploy .nupkg artifacts to account/project feeds
#---------------------------------#
# build configuration #
#---------------------------------#
# build platform, i.e. x86, x64, Any CPU. This setting is optional.
platform: Any CPU
# to add several platforms to build matrix:
#platform:
# - x86
# - Any CPU
# build Configuration, i.e. Debug, Release, etc.
configuration: Release
# to add several configurations to build matrix:
#configuration:
# - Debug
# - Release
# Build settings, not to be confused with "before_build" and "after_build".
# "project" is relative to the original build directory and not influenced by directory changes in "before_build".
build:
parallel: true # enable MSBuild parallel builds
project: MyTestAzureCS.sln # path to Visual Studio solution or project
publish_wap: true # package Web Application Projects (WAP) for Web Deploy
publish_wap_xcopy: true # package Web Application Projects (WAP) for XCopy deployment
publish_wap_beanstalk: true # Package Web Applications for AWS Elastic Beanstalk deployment
publish_wap_octopus: true # Package Web Applications for Octopus deployment
publish_azure_webjob: true # Package Azure WebJobs for Zip Push deployment
publish_azure: true # package Azure Cloud Service projects and push to artifacts
publish_aspnet_core: true # Package ASP.NET Core projects
publish_core_console: true # Package .NET Core console projects
publish_nuget: true # package projects with .nuspec files and push to artifacts
publish_nuget_symbols: true # generate and publish NuGet symbol packages
include_nuget_references: true # add -IncludeReferencedProjects option while packaging NuGet artifacts
# MSBuild verbosity level
verbosity: quiet|minimal|normal|detailed
# scripts to run before build
before_build:
# to run your custom scripts instead of automatic MSBuild
build_script:
# scripts to run after build (working directory and environment changes are persisted from the previous steps)
after_build:
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
before_package:
# to disable automatic builds
#build: off
#---------------------------------#
# tests configuration #
#---------------------------------#
# to run tests against only selected assemblies and/or categories
test:
assemblies:
only:
- asm1.dll
- asm2.dll
categories:
only:
- UI
- E2E
# to run tests against all except selected assemblies and/or categories
#test:
# assemblies:
# except:
# - asm1.dll
# - asm2.dll
#
# categories:
# except:
# - UI
# - E2E
# to run tests from different categories as separate jobs in parallel
#test:
# categories:
# - A # A category common for all jobs
# - [UI] # 1st job
# - [DAL, BL] # 2nd job
# scripts to run before tests (working directory and environment changes are persisted from the previous steps such as "before_build")
before_test:
- echo script1
- ps: Write-Host "script1"
# to run your custom scripts instead of automatic tests
test_script:
- echo This is my custom test script
# scripts to run after tests
after_test:
# to disable automatic tests
#test: off
#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
# pushing a single file
- path: test.zip
# pushing a single file with environment variable in path and "Deployment name" specified
- path: MyProject\bin\$(configuration)
name: myapp
# pushing entire folder as a zip archive
- path: logs
# pushing all *.nupkg files in build directory recursively
- path: '**\*.nupkg'
#---------------------------------#
# deployment configuration #
#---------------------------------#
# providers: Local, FTP, WebDeploy, AzureCS, AzureBlob, S3, NuGet, Environment
# provider names are case-sensitive!
deploy:
# FTP deployment provider settings
- provider: FTP
protocol: ftp|ftps|sftp
host: ftp.myserver.com
username: admin
password:
secure: eYKZKFkkEvFYWX6NfjZIVw==
folder:
application:
active_mode: false
beta: true # enable alternative FTP library for 'ftp' and 'ftps' modes
debug: true # show complete FTP log
# Amazon S3 deployment provider settings
- provider: S3
access_key_id:
secure: ABcd==
secret_access_key:
secure: ABcd==
bucket: my_bucket
folder:
artifact:
set_public: false
# Azure Blob storage deployment provider settings
- provider: AzureBlob
storage_account_name:
secure: ABcd==
storage_access_key:
secure: ABcd==
container: my_container
folder:
artifact:
# Web Deploy deployment provider settings
- provider: WebDeploy
server: http://www.deploy.com/myendpoint
website: mywebsite
username: user
password:
secure: eYKZKFkkEvFYWX6NfjZIVw==
ntlm: false
remove_files: false
app_offline: false
do_not_use_checksum: true # do not use check sum for comparing source and destination files. By default checksums are used.
sync_retry_attempts: 2 # sync attempts, max
sync_retry_interval: 2000 # timeout between sync attempts, milliseconds
aspnet_core: true # artifact zip contains ASP.NET Core application
aspnet_core_force_restart: true # poke app's web.config before deploy to force application restart
skip_dirs: \\App_Data
skip_files: web.config
on:
branch: release
platform: x86
configuration: debug
# Deploying to Azure Cloud Service
- provider: AzureCS
subscription_id:
secure: fjZIVw==
subscription_certificate:
secure: eYKZKFkkEv...FYWX6NfjZIVw==
storage_account_name: my_storage
storage_access_key:
secure: ABcd==
service: my_service
slot: Production
target_profile: Cloud
artifact: MyPackage.cspkg
# Deploying to NuGet feed
- provider: NuGet
server: https://my.nuget.server/feed
api_key:
secure: FYWX6NfjZIVw==
skip_symbols: false
symbol_server: https://your.symbol.server/feed
artifact: MyPackage.nupkg
# Deploy to GitHub Releases
- provider: GitHub
artifact: /.*\.nupkg/ # upload all NuGet packages to release assets
draft: false
prerelease: false
on:
branch: master # release from master branch only
APPVEYOR_REPO_TAG: true # deploy on tag push only
# Deploying to a named environment
- provider: Environment
name: staging
on:
branch: staging
env_var1: value1
env_var2: value2
# scripts to run before deployment
before_deploy:
# scripts to run after deployment
after_deploy:
# to run your custom scripts instead of provider deployments
deploy_script:
# to disable deployment
#deploy: off
#---------------------------------#
# global handlers #
#---------------------------------#
# on successful build
on_success:
- do something
# on build failure
on_failure:
- do something
# after build failure or success
on_finish:
- do something
#---------------------------------#
# notifications #
#---------------------------------#
notifications:
# Email
- provider: Email
to:
- user1@email.com
- user2@email.com
subject: 'Build {{status}}' # optional
message: "{{message}}, {{commitId}}, ..." # optional
on_build_status_changed: true
# HipChat
- provider: HipChat
auth_token:
secure: RbOnSMSFKYzxzFRrxM1+XA==
room: ProjectA
template: "{message}, {commitId}, ..."
# Slack
- provider: Slack
incoming_webhook: http://incoming-webhook-url
# ...or using auth token
- provider: Slack
auth_token:
secure: kBl9BlxvRMr9liHmnBs14A==
channel: development
template: "{message}, {commitId}, ..."
# Campfire
- provider: Campfire
account: appveyor
auth_token:
secure: RifLRG8Vfyol+sNhj9u2JA==
room: ProjectA
template: "{message}, {commitId}, ..."
# Webhook
- provider: Webhook
url: http://www.myhook2.com
headers:
User-Agent: myapp 1.0
Authorization:
secure: GhD+5xhLz/tkYY6AO3fcfQ==
on_build_success: false
on_build_failure: true
on_build_status_changed: true

+ 0
- 6
nuget.config View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="repositoryPath" value="shadowsocks-csharp\3rd" />
</config>
</configuration>

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

@@ -1,128 +1,129 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;
namespace Shadowsocks.Controller
{
public class GFWListUpdater
{
private const string GFWLIST_URL = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt";
public event EventHandler<ResultEventArgs> UpdateCompleted;
public event ErrorEventHandler Error;
public class ResultEventArgs : EventArgs
{
public bool Success;
public ResultEventArgs(bool success)
{
this.Success = success;
}
}
private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' };
private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
try
{
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), e.Result, Encoding.UTF8);
bool pacFileChanged = MergeAndWritePACFile(e.Result);
UpdateCompleted?.Invoke(this, new ResultEventArgs(pacFileChanged));
}
catch (Exception ex)
{
Error?.Invoke(this, new ErrorEventArgs(ex));
}
}
public static bool MergeAndWritePACFile(string gfwListResult)
{
string abpContent = MergePACFile(gfwListResult);
if (File.Exists(PACDaemon.PAC_FILE))
{
string original = FileManager.NonExclusiveReadAllText(PACDaemon.PAC_FILE, Encoding.UTF8);
if (original == abpContent)
{
return false;
}
}
File.WriteAllText(PACDaemon.PAC_FILE, abpContent, Encoding.UTF8);
return true;
}
private static string MergePACFile(string gfwListResult)
{
string abpContent;
if (File.Exists(PACDaemon.USER_ABP_FILE))
{
abpContent = FileManager.NonExclusiveReadAllText(PACDaemon.USER_ABP_FILE, Encoding.UTF8);
}
else
{
abpContent = Resources.abp_js;
}
List<string> userruleLines = new List<string>();
if (File.Exists(PACDaemon.USER_RULE_FILE))
{
string userrulesString = FileManager.NonExclusiveReadAllText(PACDaemon.USER_RULE_FILE, Encoding.UTF8);
userruleLines = ParseToValidList(userrulesString);
}
List<string> gfwLines = new List<string>();
gfwLines = ParseBase64ToValidList(gfwListResult);
abpContent = abpContent.Replace("__USERRULES__", JsonConvert.SerializeObject(userruleLines, Formatting.Indented))
.Replace("__RULES__", JsonConvert.SerializeObject(gfwLines, Formatting.Indented));
return abpContent;
}
public void UpdatePACFromGFWList(Configuration config)
{
Logging.Info($"Checking GFWList from {GFWLIST_URL}");
WebClient http = new WebClient();
if (config.enabled)
{
http.Proxy = new WebProxy(
config.isIPv6Enabled
? $"[{IPAddress.IPv6Loopback.ToString()}]"
: IPAddress.Loopback.ToString(),
config.localPort);
}
http.DownloadStringCompleted += http_DownloadStringCompleted;
http.DownloadStringAsync(new Uri(GFWLIST_URL));
}
public static List<string> ParseBase64ToValidList(string response)
{
byte[] bytes = Convert.FromBase64String(response);
string content = Encoding.ASCII.GetString(bytes);
return ParseToValidList(content);
}
private static List<string> ParseToValidList(string content)
{
List<string> valid_lines = new List<string>();
using (var sr = new StringReader(content))
{
foreach (var line in sr.NonWhiteSpaceLines())
{
if (line.BeginWithAny(IgnoredLineBegins))
continue;
valid_lines.Add(line);
}
}
return valid_lines;
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;

using Newtonsoft.Json;

using Shadowsocks.Model;
using Shadowsocks.Properties;
using Shadowsocks.Util;

namespace Shadowsocks.Controller
{
public class GFWListUpdater
{
private const string GFWLIST_URL = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt";

public event EventHandler<ResultEventArgs> UpdateCompleted;

public event ErrorEventHandler Error;

public class ResultEventArgs : EventArgs
{
public bool Success;

public ResultEventArgs(bool success)
{
this.Success = success;
}
}

private static readonly IEnumerable<char> IgnoredLineBegins = new[] { '!', '[' };
private void http_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
try
{
File.WriteAllText(Utils.GetTempPath("gfwlist.txt"), e.Result, Encoding.UTF8);
bool pacFileChanged = MergeAndWritePACFile(e.Result);
UpdateCompleted?.Invoke(this, new ResultEventArgs(pacFileChanged));
}
catch (Exception ex)
{
Error?.Invoke(this, new ErrorEventArgs(ex));
}
}

public static bool MergeAndWritePACFile(string gfwListResult)
{
string abpContent = MergePACFile(gfwListResult);
if (File.Exists(PACDaemon.PAC_FILE))
{
string original = FileManager.NonExclusiveReadAllText(PACDaemon.PAC_FILE, Encoding.UTF8);
if (original == abpContent)
{
return false;
}
}
File.WriteAllText(PACDaemon.PAC_FILE, abpContent, Encoding.UTF8);
return true;
}

private static string MergePACFile(string gfwListResult)
{
string abpContent;
if (File.Exists(PACDaemon.USER_ABP_FILE))
{
abpContent = FileManager.NonExclusiveReadAllText(PACDaemon.USER_ABP_FILE, Encoding.UTF8);
}
else
{
abpContent = Resources.abp_js;
}

List<string> userruleLines = new List<string>();
if (File.Exists(PACDaemon.USER_RULE_FILE))
{
string userrulesString = FileManager.NonExclusiveReadAllText(PACDaemon.USER_RULE_FILE, Encoding.UTF8);
userruleLines = ParseToValidList(userrulesString);
}

List<string> gfwLines = new List<string>();
gfwLines = ParseBase64ToValidList(gfwListResult);
abpContent =
$@"var __USERRULES__ = {JsonConvert.SerializeObject(userruleLines, Formatting.Indented)};
var __RULES__ = {JsonConvert.SerializeObject(gfwLines, Formatting.Indented)};
{abpContent}";
return abpContent;
}

public void UpdatePACFromGFWList(Configuration config)
{
Logging.Info($"Checking GFWList from {GFWLIST_URL}");
WebClient http = new WebClient();
if (config.enabled)
{
http.Proxy = new WebProxy(
config.isIPv6Enabled
? $"[{IPAddress.IPv6Loopback.ToString()}]"
: IPAddress.Loopback.ToString(),
config.localPort);
}
http.DownloadStringCompleted += http_DownloadStringCompleted;
http.DownloadStringAsync(new Uri(GFWLIST_URL));
}

public static List<string> ParseBase64ToValidList(string response)
{
byte[] bytes = Convert.FromBase64String(response);
string content = Encoding.ASCII.GetString(bytes);
return ParseToValidList(content);
}

private static List<string> ParseToValidList(string content)
{
List<string> valid_lines = new List<string>();
using (var sr = new StringReader(content))
{
foreach (var line in sr.NonWhiteSpaceLines())
{
if (line.BeginWithAny(IgnoredLineBegins))
continue;
valid_lines.Add(line);
}
}
return valid_lines;
}
}
}

+ 2
- 2
shadowsocks-csharp/Controller/Service/PACDaemon.cs View File

@@ -39,7 +39,7 @@ namespace Shadowsocks.Controller
{
if (!File.Exists(PAC_FILE))
{
File.WriteAllText(PAC_FILE, Resources.proxy_pac_txt);
File.WriteAllText(PAC_FILE, Resources.default_abp_rule + Resources.abp_js);
}
return PAC_FILE;
}
@@ -61,7 +61,7 @@ namespace Shadowsocks.Controller
}
else
{
return Resources.proxy_pac_txt;
return Resources.default_abp_rule + Resources.abp_js;
}
}


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

@@ -70,7 +70,7 @@ namespace Shadowsocks.Controller
Host: www.example.com
Accept-Language: en, mi
*/
string request = Encoding.UTF8.GetString(firstPacket, 0, length);
string[] lines = request.Split('\r', '\n');
bool hostMatch = false, pathMatch = false, useSocks = false;
@@ -164,15 +164,15 @@ namespace Shadowsocks.Controller
string proxy = GetPACAddress(localEndPoint, useSocks);
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);


+ 1
- 1
shadowsocks-csharp/Controller/Service/UpdateChecker.cs View File

@@ -24,7 +24,7 @@ namespace Shadowsocks.Controller
public string LatestVersionLocalName;
public event EventHandler CheckUpdateCompleted;
public const string Version = "4.1.7.1";
public const string Version = "4.1.8.0";
private class CheckUpdateTimer : System.Timers.Timer
{


+ 4
- 3
shadowsocks-csharp/Data/abp.js View File

@@ -1,10 +1,11 @@
// Generated by gfwlist2pac in precise mode
/* eslint-disable */
// Was generated by gfwlist2pac in precise mode
// https://github.com/clowwindy/gfwlist2pac
// 2019-10-06: More 'javascript' way to interaction with main program
// 2019-02-08: Updated to support shadowsocks-windows user rules.
var proxy = "__PROXY__";
var proxy = __PROXY__;
var userrules = __USERRULES__;
var rules = __RULES__;


+ 7250
- 0
shadowsocks-csharp/Data/default-abp-rule.js
File diff suppressed because it is too large
View File


+ 0
- 8040
shadowsocks-csharp/Data/proxy.pac.txt
File diff suppressed because it is too large
View File


+ 1
- 1
shadowsocks-csharp/FodyWeavers.xsd View File

@@ -4,7 +4,6 @@
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="Caseless" minOccurs="0" maxOccurs="1" type="xs:anyType" />
<xs:element name="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
@@ -91,6 +90,7 @@
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="Caseless" minOccurs="0" maxOccurs="1" type="xs:anyType" />
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>


+ 66
- 68
shadowsocks-csharp/Properties/Resources.Designer.cs View File

@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
@@ -13,12 +13,12 @@ namespace Shadowsocks.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
@@ -33,7 +33,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
@@ -47,8 +47,8 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@@ -61,13 +61,14 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to // Generated by gfwlist2pac in precise mode
/// 查找类似 /* eslint-disable */
///// Was generated by gfwlist2pac in precise mode
///// https://github.com/clowwindy/gfwlist2pac
///
///// 2019-10-06: More &apos;javascript&apos; way to interaction with main program
///// 2019-02-08: Updated to support shadowsocks-windows user rules.
///
///var proxy = &quot;__PROXY__&quot;;
///
///var proxy = __PROXY__;
///var userrules = __USERRULES__;
///var rules = __RULES__;
///
@@ -75,9 +76,7 @@ namespace Shadowsocks.Properties {
///* This file is part of Adblock Plus &lt;http://adblockplus.org/&gt;,
///* Copyright (C) 2006-2014 Eyeo GmbH
///*
///* Adblock Plus is free software: you can redistribute it and/or modify
///* it under the terms of the GNU General Public License version 3 as
///* published by t [rest of string was truncated]&quot;;.
///* Adblock Plus is free software: you can redistribute it and/or [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string abp_js {
get {
@@ -86,7 +85,37 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to # translation for Japanese
/// 查找类似 var __USERRULES__ = [];
///var __RULES__ = [
/// &quot;|http://85.17.73.31/&quot;,
/// &quot;||agnesb.fr&quot;,
/// &quot;||akiba-web.com&quot;,
/// &quot;||altrec.com&quot;,
/// &quot;||angela-merkel.de&quot;,
/// &quot;||angola.org&quot;,
/// &quot;||apartmentratings.com&quot;,
/// &quot;||apartments.com&quot;,
/// &quot;||arena.taipei&quot;,
/// &quot;||asianspiss.com&quot;,
/// &quot;||assimp.org&quot;,
/// &quot;||athenaeizou.com&quot;,
/// &quot;||azubu.tv&quot;,
/// &quot;||bankmobilevibe.com&quot;,
/// &quot;||banorte.com&quot;,
/// &quot;||bash-hackers.org&quot;,
/// &quot;||beeg.com&quot;,
/// &quot;||global.bing.com&quot;,
/// &quot;||bloombergview.com&quot;,
/// &quot; [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string default_abp_rule {
get {
return ResourceManager.GetString("default_abp_rule", resourceCulture);
}
}
/// <summary>
/// 查找类似 # translation for Japanese
///
///Shadowsocks=Shadowsocks
///
@@ -107,7 +136,7 @@ namespace Shadowsocks.Properties {
///Edit Local PAC File...=ローカル PAC ファイルの編集...
///Update Local PAC from GFWList=GFWList からローカル PAC を更新
///Edit User Rule for GFWList...=ユーザールールの編集...
///Secure Local PA [rest of string was truncated]&quot;;.
///Secure Local PA [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string ja {
get {
@@ -116,7 +145,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] libsscrypto_dll {
get {
@@ -126,7 +155,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__
/// 查找类似 listen-address __PRIVOXY_BIND_IP__:__PRIVOXY_BIND_PORT__
///toggle 0
///logfile ss_privoxy.log
///show-on-task-bar 0
@@ -134,7 +163,7 @@ namespace Shadowsocks.Properties {
///forward-socks5 / __SOCKS_HOST__:__SOCKS_PORT__ .
///max-client-connections 2048
///hide-console
///.
/// 的本地化字符串。
/// </summary>
internal static string privoxy_conf {
get {
@@ -143,7 +172,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] privoxy_exe {
get {
@@ -153,38 +182,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to // Generated by gfwlist2pac in precise mode
///// https://github.com/clowwindy/gfwlist2pac
///
///// 2019-02-08: Updated to support shadowsocks-windows user rules.
///
///var proxy = &quot;__PROXY__&quot;;
///
///var userrules = [];
///var rules = [
/// &quot;|http://85.17.73.31/&quot;,
/// &quot;||agnesb.fr&quot;,
/// &quot;||akiba-web.com&quot;,
/// &quot;||altrec.com&quot;,
/// &quot;||angela-merkel.de&quot;,
/// &quot;||angola.org&quot;,
/// &quot;||apartmentratings.com&quot;,
/// &quot;||apartments.com&quot;,
/// &quot;||arena.taipei&quot;,
/// &quot;||asianspiss.com&quot;,
/// &quot;||assimp.org&quot;,
/// &quot;||athenaeizou.com&quot;,
/// &quot;||azubu.tv&quot;,
/// [rest of string was truncated]&quot;;.
/// </summary>
internal static string proxy_pac_txt {
get {
return ResourceManager.GetString("proxy_pac_txt", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ss32Fill {
get {
@@ -194,7 +192,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ss32In {
get {
@@ -204,7 +202,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ss32Out {
get {
@@ -214,7 +212,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ss32Outline {
get {
@@ -224,7 +222,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap ssw128 {
get {
@@ -234,7 +232,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] sysproxy_exe {
get {
@@ -244,7 +242,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// 查找 System.Byte[] 类型的本地化资源。
/// </summary>
internal static byte[] sysproxy64_exe {
get {
@@ -254,9 +252,9 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to ! Put user rules line by line in this file.
/// 查找类似 ! Put user rules line by line in this file.
///! See https://adblockplus.org/en/filter-cheatsheet
///.
/// 的本地化字符串。
/// </summary>
internal static string user_rule {
get {
@@ -265,7 +263,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to # translation for Simplified Chinese
/// 查找类似 # translation for Simplified Chinese
///
///Shadowsocks=Shadowsocks
///
@@ -287,7 +285,7 @@ namespace Shadowsocks.Properties {
///Update Local PAC from GFWList=从 GFWList 更新本地 PAC
///Edit User Rule for GFWList...=编辑 GFWList 的用户规则...
///Secure Local PAC=保护本地 PAC
///Copy Lo [rest of string was truncated]&quot;;.
///Copy Lo [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string zh_CN {
get {
@@ -296,7 +294,7 @@ namespace Shadowsocks.Properties {
}
/// <summary>
/// Looks up a localized string similar to # translation for Traditional Chinese
/// 查找类似 # translation for Traditional Chinese
///
///Shadowsocks=Shadowsocks
///
@@ -317,7 +315,7 @@ namespace Shadowsocks.Properties {
///Edit Local PAC File...=編輯本機 PAC 檔案...
///Update Local PAC from GFWList=從 GFWList 更新本機 PAC
///Edit User Rule for GFWList...=編輯 GFWList 的使用者規則...
///Secure Local PAC=安全本機 PAC /// [rest of string was truncated]&quot;;.
///Secure Local PAC=安全本機 PAC /// [字符串的其余部分被截断]&quot;; 的本地化字符串。
/// </summary>
internal static string zh_TW {
get {


+ 3
- 3
shadowsocks-csharp/Properties/Resources.resx View File

@@ -121,6 +121,9 @@
<data name="abp_js" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\abp.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
</data>
<data name="default_abp_rule" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\default-abp-rule.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="ja" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\ja.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
@@ -133,9 +136,6 @@
<data name="privoxy_exe" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\data\privoxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="proxy_pac_txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Data\proxy.pac.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="ss32Fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ss32Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>


+ 7
- 7
shadowsocks-csharp/packages.config View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Caseless.Fody" version="1.8.3" targetFramework="net462" developmentDependency="true" />
<package id="Costura.Fody" version="3.3.2" targetFramework="net462" developmentDependency="true" />
<package id="Fody" version="4.0.0" targetFramework="net462" developmentDependency="true" />
<package id="GlobalHotKey" version="1.1.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="StringEx.CS" version="0.3.1" targetFramework="net462" developmentDependency="true" />
<package id="ZXing.Net" version="0.16.4" targetFramework="net462" />
<package id="Caseless.Fody" version="1.8.3" targetFramework="net472" />
<package id="Costura.Fody" version="3.3.3" targetFramework="net472" />
<package id="Fody" version="4.2.1" targetFramework="net472" developmentDependency="true" />
<package id="GlobalHotKey" version="1.1.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="StringEx.CS" version="0.3.1" targetFramework="net472" developmentDependency="true" />
<package id="ZXing.Net" version="0.16.5" targetFramework="net472" />
</packages>

+ 17
- 59
shadowsocks-csharp/shadowsocks-csharp.csproj View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="3rd\Caseless.Fody.1.8.3\build\Caseless.Fody.props" Condition="Exists('3rd\Caseless.Fody.1.8.3\build\Caseless.Fody.props')" />
<Import Project="3rd\Costura.Fody.3.3.2\build\Costura.Fody.props" Condition="Exists('3rd\Costura.Fody.3.3.2\build\Costura.Fody.props')" />
<Import Project="..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" />
<Import Project="..\packages\Caseless.Fody.1.8.3\build\Caseless.Fody.props" Condition="Exists('..\packages\Caseless.Fody.1.8.3\build\Caseless.Fody.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -69,19 +69,18 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Caseless, Version=1.8.3.0, Culture=neutral, PublicKeyToken=409b3227471b0f0d, processorArchitecture=MSIL">
<HintPath>3rd\Caseless.Fody.1.8.3\lib\net452\Caseless.dll</HintPath>
<HintPath>..\packages\Caseless.Fody.1.8.3\lib\net452\Caseless.dll</HintPath>
</Reference>
<Reference Include="Costura, Version=3.3.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>3rd\Costura.Fody.3.3.2\lib\net40\Costura.dll</HintPath>
<Reference Include="Costura, Version=3.3.3.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.3.3.3\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>3rd\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
<Private>True</Private>
<HintPath>..\packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>3rd\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
@@ -94,11 +93,11 @@
<Reference Include="System.Windows.Forms.DataVisualization" />
<Reference Include="System.XML" />
<Reference Include="WindowsBase" />
<Reference Include="zxing, Version=0.16.4.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<HintPath>3rd\ZXing.Net.0.16.4\lib\net461\zxing.dll</HintPath>
<Reference Include="zxing, Version=0.16.5.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<HintPath>..\packages\ZXing.Net.0.16.5\lib\net47\zxing.dll</HintPath>
</Reference>
<Reference Include="zxing.presentation, Version=0.16.4.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<HintPath>3rd\ZXing.Net.0.16.4\lib\net461\zxing.presentation.dll</HintPath>
<Reference Include="zxing.presentation, Version=0.16.5.0, Culture=neutral, PublicKeyToken=4e88037ac681fe60, processorArchitecture=MSIL">
<HintPath>..\packages\ZXing.Net.0.16.5\lib\net47\zxing.presentation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -162,8 +161,8 @@
<Compile Include="Controller\Service\Sip003Plugin.cs" />
<Compile Include="Proxy\Socks5Proxy.cs" />
<Compile Include="Settings.cs" />
<Compile Include="StringEx.cs" />
<Compile Include="Controller\System\Hotkeys\Hotkeys.cs" />
<Compile Include="StringEx.cs" />
<Compile Include="Util\ProcessManagement\Job.cs" />
<Compile Include="Util\ProcessManagement\ThreadUtil.cs" />
<Compile Include="Util\Sockets\LineReader.cs" />
@@ -270,7 +269,7 @@
</None>
<None Include="Resources\ssw128.png" />
<Content Include="Data\abp.js" />
<Content Include="Data\proxy.pac.txt" />
<Content Include="Data\default-abp-rule.js" />
<Content Include="Data\zh_CN.txt" />
<Content Include="Data\zh_TW.txt" />
<Content Include="Data\ja.txt" />
@@ -291,11 +290,6 @@
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
@@ -318,51 +312,15 @@
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<UsingTask TaskName="CosturaCleanup" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" TaskFactory="CodeTaskFactory">
<ParameterGroup>
<Config Output="false" Required="true" ParameterType="Microsoft.Build.Framework.ITaskItem" />
<Files Output="false" Required="true" ParameterType="Microsoft.Build.Framework.ITaskItem[]" />
</ParameterGroup>
<Task Evaluate="true">
<Reference xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Include="System.Xml" />
<Reference xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Include="System.Xml.Linq" />
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System" />
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.IO" />
<Using xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Namespace="System.Xml.Linq" />
<Code xmlns="http://schemas.microsoft.com/developer/msbuild/2003" Type="Fragment" Language="cs"><![CDATA[
var config = XElement.Load(Config.ItemSpec).Elements("Costura").FirstOrDefault();
if (config == null) return true;
var excludedAssemblies = new List<string>();
var attribute = config.Attribute("ExcludeAssemblies");
if (attribute != null)
foreach (var item in attribute.Value.Split('|').Select(x => x.Trim()).Where(x => x != string.Empty))
excludedAssemblies.Add(item);
var element = config.Element("ExcludeAssemblies");
if (element != null)
foreach (var item in element.Value.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).Where(x => x != string.Empty))
excludedAssemblies.Add(item);
var filesToCleanup = Files.Select(f => f.ItemSpec).Where(f => !excludedAssemblies.Contains(Path.GetFileNameWithoutExtension(f), StringComparer.InvariantCultureIgnoreCase));
foreach (var item in filesToCleanup)
File.Delete(item);
]]></Code>
</Task>
</UsingTask>
<Target Name="CleanReferenceCopyLocalPaths" AfterTargets="AfterBuild;NonWinFodyTarget">
<CosturaCleanup Config="FodyWeavers.xml" Files="@(ReferenceCopyLocalPaths->'$(OutDir)%(DestinationSubDirectory)%(Filename)%(Extension)')" />
</Target>
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('3rd\Costura.Fody.3.3.2\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '3rd\Costura.Fody.3.3.2\build\Costura.Fody.props'))" />
<Error Condition="!Exists('3rd\Caseless.Fody.1.8.3\build\Caseless.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '3rd\Caseless.Fody.1.8.3\build\Caseless.Fody.props'))" />
<Error Condition="!Exists('3rd\Fody.4.0.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '3rd\Fody.4.0.0\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Caseless.Fody.1.8.3\build\Caseless.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Caseless.Fody.1.8.3\build\Caseless.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props'))" />
</Target>
<Import Project="3rd\Fody.4.0.0\build\Fody.targets" Condition="Exists('3rd\Fody.4.0.0\build\Fody.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">


+ 1
- 1
test/ShadowsocksTest.csproj View File

@@ -36,7 +36,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="GlobalHotKey, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\shadowsocks-csharp\3rd\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
<HintPath>..\packages\GlobalHotKey.1.1.0\lib\GlobalHotKey.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Management" />


+ 1
- 1
test/packages.config View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GlobalHotKey" version="1.1.0" targetFramework="net462" />
<package id="GlobalHotKey" version="1.1.0" targetFramework="net472" />
</packages>

Loading…
Cancel
Save