Skip to content

Commit

Permalink
Upgrate from original repo (#1)
Browse files Browse the repository at this point in the history
* nopSolutions#2697 Localizae value of "Is system role" property on the customer details page

* Move PluginManager constants to properties

* Move PluginManager GetPluginDescriptor methods from utilities to methods

* Move plugins uploading methods to UploadManager

* Rename ThemeConfiguration to ThemeDescriptor

* Rename some ThemeProvider methods

* Move some of theme files in Nop.Core project

* Rename theme Title to FriendlyName

* Move ThemeProvider constants to properties

* Move ThemeProvider GetThemeDescriptor method from utilities to methods

* Add IDescriptor interface

* nopSolutions#353 Add support for uploading themes in the same way as plugins

* nopSolutions#353 Move UploadManager and ThemeProvider to Nop.Services project

* nopSolutions#353 Move static UploadManager to injectable UploadService

* nopSolutions#353 Rename locales, change uploaded sample file

* Minor fix. Added forgotten using

* Update Square.Connect library to the latest version

* nopSolutions#2250 Fixed "rounding with 0.05 interval" error

* Square payment plugin. Remove option to use personal access tokens.

* Square payment plugin.  Send a payment note with each transaction

* Square payment plugin. Make token renewal period 14 days by default and remove ability to change it from the plugin configuration page

* Square payment plugin. Update error handling

* Square payment plugin. Add Integration ID parameter to charge requests

* Square payment plugin. Pull additional locations info

* Square payment plugin. Change message on pending refund

* Square payment plugin. Leave the access token editable

* Remove warnings about shipping plugins. They are not required

* Wrong URL warning should be error (not just a warning)

* nopSolutions#2715 Display warnings on admin area home page if a store has some errors

* Squre integration ID is now hard-coded

* Added logos to the WorldPay plugin

* Updated WorldPay instructions

* Updated WorldPay developer ID

* Updated Worldpay instructions

* Simplified a way to init schedule tasks from plugins. There's no need to specify the fully qualified assembly name now

* Removed extra spae from Worldpay plugin

* Updated a schedule task type in the Square plugin

* Square payment plugin. Add UseSandbox setting

* Square plugin. Added validation for sandbox account

* Square payment plugin. Further changes to validation for sandbox credentials

* Updated "ImageResizer.Plugins.PrettyGifs" third-party library to the latest version

* Worldpay payment plugin. Use certified developer credentials

* nopSolutions#2250 Rewrote "rounding with 0.05 interval"

* Updated fast installation SQL scripts

* Added upgrade scripts for the next version

* Fixed the issue with "Notify me" button for back in stock subscriptions

* nopSolutions#2745 Added missing "partial" keyword

* Fixed an issue in the previous commit

* Updated nopCommerce version to 4.10

* nopSolutions#2762 Forum pager (small) didn't work

* Source code refactoring. Remove redundant chars

* nopSolutions#2752 Meta keywords didn't work for grouped products

* nopSolutions#2774 Fix bug with overridden rates for international shipping in the UPS plugin

* nopSolutions#2774 Remove testing data from previous commit

* nopSolutions#2738 Exclude from bundle scripts in Worldpay and Square payment plugins

* nopSolutions#2738 Remove try-catch block

* nopSolutions#196 Updated third-party packages

* nopSolutions#2749 Ensure that display order of shipping methods is distinct

* nopSolutions#2702 Removed "ParseTaxRates" from "Order" entity

* nopSolutions#2724 Currency details page. Wrong URL was used in a hint

* nopSolutions#2768 Support multiple topics (the same system name) with ACL

* nopSolutions#2780 Fixed problem with not create browscap.crawlersonly.xml file

* Added index into database for speedup executing GetLowStockProducts method from ProductService

* nopSolutions#2733 Rename GetPublicViewComponent method of IWidgetPlugin

* nopSolutions#2730 Add OrderVoided event

* nopSolutions#2631 Rename all event types at the same way for the consistency

*  nopSolutions#2385 Added displaying the customer avatar (if enabled) in the customer list page

*  nopSolutions#2282 Added support import picture of product by URL

* Return view component name as output instead of out parameter

* Minor addition to the previous commit

* nopSolutions#2788 Square payment plugin. Identify a route by name instead of route values

* nopSolutions#2788 Worldpay plugin. Identify a route by name instead of route values

* nopSolutions#33 Further changes to properly format dates in Kendo grids

* nopSolutions#2777 Ignore reviews of deleted products

* nopSolutions#2769 Support order tokens in "return request" message templates

* nopSolutions#2717 Create a new language. Pre-set "Display order"

* Fixed problems in tests

* nopSolutions#484 Pass entire model to widgets

* Refactoring. The code of the PrepareRenderWidgetModel method is simplified

*  nopSolutions#2744 Performance optimization.Implemented  loading only total count  for PagedList instance creating by IQueryable<T>

*  nopSolutions#793 Allowed a store owner to search topics by keywords

* nopSolutions#2776 Ignore reviews of limited to stores products and filter reviews on enabled ShowProductReviewsPerStore setting on the account page

* nopSolutions#2341 Add entity reference to activity log

* Implemented display primary currency code on Value of 'X' (free shipping)

* nopSolutions#2721 Fixed problem with IPv6 in GetCurrentIPAddress method

*  nopSolutions#1500 Moved default view (grid/view) setting to UI

* Renamed a locale

* Move PluginFinder to Nop.Services project

* Add PluginUpdatedEvent

* nopSolutions#783 Clear cached widgets on updating a widget plugin descriptor

* nopSolutions#1918 Add filters by dates on the discount list page

* nopSolutions#2751 Ensure that built-in "crawler" (search engine) customer account cannot be affiliated

* nopSolutions#2679 "Registration method" setting (values) wasn't localizable

* nopSolutions#2740 CommonSettings were reset (cleared) when updating settings for an individual store

* Updated third-party libraries to the latest version

* nopSolutions#2722 There's no need to explicitly validate child properties anymore. FluentValidation library again supports automatic (implicit) validation of child properties

*  nopSolutions#2783 Prevent adding the same picture to the product

* nopSolutions#2721 Further changes. Added a code comment

* nopSolutions#558 Warning admin that the entered SKU already exists

* nopSolutions#2807 Add Form property to BaseNopModel

* nopSolutions#2502 Add filter by unpublished products on low stock report page

* nopSolutions#2707 Add pagination support on "AppliedTo" discount pages

* Fix bug with ignoring the selected services on saturday delivery in UPS shipping plugin

*  nopSolutions#1991 Do not display product availability until all required product attributes are selected

* nopSolutions#2819 Fix bug with empty tokens in test message templates

*  nopSolutions#2115 Implemented showing vendor name on the shopping cart and order details page

* nopSolutions#2249 nopSolutions#2775 Send all active message templates with the same name

* nopSolutions#73 Add settings to include customer identifier to the Google Analytics script

*  nopSolutions#1004 Added possibility to preselect a country if there's only one country available (public store)

*  nopSolutions#2729 Fixed address restriction and "Shipping to the same address" issue

* Added ignore rules into AutoMapper configuration

* nopSolutions#2820 Use analytics.js as predefined script on installation GoogleAnalytics plugin

* nopSolutions#2823 Add inline scripts in the correct order

* nopSolutions#290 Add PictureId to product attribute combination

* nopSolutions#1374 Allow admin to provide external links to his store which include a discount coupon code

* nopSolutions#1981 Notify customers when a store owner (or vendor) replies to their product reviews

* nopSolutions#2800 Added ignoring of products with the unchecked "Visible individually" property on cross-sell products list and related products list

*  nopSolutions#1973 Added possibility a store owner to delete shopping carts and wishlists on the admin area.

*  nopSolutions#2728 Fixed dotnet build problem

* update Register view - add localize labels for birth day

For languages other than English, localized.

* nopSolutions#1503 Use product URL instead just a name in "Require other products added to the cart" warning

*  nopSolutions#2821 Fixed rounding bug

* Create CODE_OF_CONDUCT.md

* Create CONTRIBUTING.md

* Create ISSUE_TEMPLATE.md

*  nopSolutions#662 Added order notification to affiliate

* nopSolutions#2731 Add URL encoding on RoxyFilemanController to allow downloading files with non-ASCII chars in names

* nopSolutions#2731 Add URL encoding on redirection to URL with non-ASCII chars

* nopSolutions#2841 Fixed the date problem on the customer reviews page

* nopSolutions#1787 Added some localized resource for grids

*  nopSolutions#1359 Added possibility a store owner to view all mapped products on a specification details page

* Remove SecureUrl property from the Store entity

* Proper determination of the store location in WebHelper

* Replace some of direct using Store.Url to using IWebHelper.GetStoreLocation method

* nopSolutions#2833 Add method to properly generating URLs in MessageTokenProvider

* Updated FluentValidation library to the latest version

* Updated MaxMind.GeoIP2 library to the latest version

* Updated GeoLite2-Country.mmdb database

* Updated Microsoft.AspNetCore.Mvc and ServiceModel libraries to the latest version

* nopSolutions#2824 More accurate start time of schedule tasks (after application restart)

* nopSolutions#2833 Properly encoding URL

*  nopSolutions#1524 Added setting to sort Reviews by Date Created Desc OR Asc

* nopSolutions#2782 Support filtering by product in summary reports on the order list page (admin area)

* Simplfied generated SQL command on the order list page (admin area)

* nopSolutions#2840 Added "Host" directive to robots.txt

*  nopSolutions#2320 Implemented splitting "big import file"

*  nopSolutions#2795 Fixed problem with assembly blocking on application startup

* nopSolutions#2848 Added PublicAntiForgery to the Login method

* nopSolutions#2779 Do not duplicate plugin version and description in csproj files

* Performance optimization of sitemap.xml generation (load all categories at once)

* Removed obsolete source code comment

* nopSolutions#2757 Prent throwing of InvalidCastException in admin area (notifications)

*  nopSolutions#1974 Combined shopping and wishlist pages on admin area

* nopSolutions#1974 Further changes. Selecting the menu item

* nopSolutions#1974 Further changes. Added page title

*  nopSolutions#2791 Moved widget zones to separate classes

* update Info view - add localize for birth day

For languages other than English, the date of birth will be displayed in the local info customer form.

* Wrong event was invoked in "RegisterCustomer" method

* Updated "FluentValidation.AspNetCore" library to the latest version

* Refactoring. Removed extra comma

* Source code refactoring

* nopSolutions#2791 Renamed some widget zone names (variable names)

* nopSolutions#2737 Performance optimization when we have a lot of categories.

* nopSolutions#2737 Performance optimization when we have a lot of categories. Discounts applied to categories

*  nopSolutions#26 Added possibility to set product attribute price adjustments as percentages

* Removed unused parameter. Anyway the implementation was too slow

* Refactoring. Removed redundant code

* Refactoring. There's no need to reset cache in CategoryService in some cases

* nopSolutions#2737 Performance optimization when we have a lot of categories. Load all categories only once and cache them

* nopSolutions#2737 Performance optimization when we have a lot of categories. Load all categories only once and cache them. Further changes (ACL)

* nopSolutions#2737 Performance optimization when we have a lot of categories. Refactoring of "GetChildCategoryIds" method. Now it doesn't make multiple SQL requests

* Update SitemapGenerator.cs to use gregorian date in sitemaps

Currently sitemap uses culture specific dates for generating modification dates of products, which leads to dates like "2561-01-29" for cultures which their default calendar is something other than gregorian calendar. This update fixes this issue in sitemaps' <lastmod> fields.

* Further changes on the previous commit

* Performance optimization. Enabled a stored procedure to load categories (database paging)

* nopSolutions#2856 Remove WebDAV module so that we can make DELETE requests (for WebAPI plugins)

* nopSolutions#2852 Add var initialization

* nopSolutions#196 Updated iTextSharp to the latest version

*  nopSolutions#2791 Further changes on "Moved widget zones to separate classes"

* nopSolutions#2723 Add missed TaxRate to recurring orders

* Issue 417 Allow a store owner to create vendor attributes

* nopSolutions#2540 Add county to address

* nopSolutions#2286 Add setting to ship product separately one item each

*  nopSolutions#2860 Added showing error message when two or more categories have the same name

*  nopSolutions#2771 Added settings for hide/show footer items

* nopSolutions#2755 More accurate rounding in PayPal Direct plugin

* nopSolutions#1418 Admin area. Simplified javascript code for grid checkboxes

* nopSolutions#2781 Deleted unnecessary code

* nopSolutions#2351 Properly displaying reports for dates with daylight saving time

*  nopSolutions#739 Added possibility to find orders by phone number

* nopSolutions#2215 Add sitemap pagination

* nopSolutions#2215 Further changes on the sitemap page

* nopSolutions#2403 Some further changes

*  nopSolutions#2243 Added possibility to create several product attribute combinations

* nopSolutions#2726 Fixed datepicker wrapper bug

* nopSolutions#2726 Fixed styles for datepicker

* nopSolutions#2873 Use dependency injection to get JSON serializer settings in BaseAdminController

* nopSolutions#33 Rename UseIsoDateTimeConverterInJson settings

* nopSolutions#2641 Use proper protocol to generate canonical URLs

* nopSolutions#2753 Use proper protocol to generate Twitter and Open Graph URLs

* nopSolutions#2874 To lowercase canonical URLs

* Fixed errors on tests

* nopSolutions#2183 Add delay usage of reward points when adding them manually in admin area

* nopSolutions#2834 Allow the use of cookies from SSL protected page on the other store pages which are not

* nopSolutions#2893 Require write permission for \logs directory

* nopSolutions#196 Updated some third-party libraries to the latest version

*  nopSolutions#1912 Allow to set number of days when reward points are valid

* nopSolutions#1912 Add settings to configure registration points validity

* nopSolutions#1912 Add settings to configure purchases points validity

* nopSolutions#1912 Add validity of reward points when adding them manually in admin area

* nopSolutions#1910 Add settings to configure minimum order total when points are granted

* nopSolutions#2834 Fixed exception on installation page

* nopSolutions#196 Update RedLock library to the latest version

*  nopSolutions#717 Added ability to allow a store owner to disable checkout process

* Fixed problem with a space in path on ClearPluginAssemblies.proj file

* Fixed error in unit tests after 38b7f50  commit

* nopSolutions#2899 Fixed bug on search by store id on "Topics (pages)" page
  • Loading branch information
dalhyncarrillo committed Mar 10, 2018
1 parent 801361c commit c32ede4
Show file tree
Hide file tree
Showing 1,890 changed files with 49,444 additions and 39,510 deletions.
18 changes: 12 additions & 6 deletions .gitignore
Expand Up @@ -159,18 +159,24 @@ glob:*.user
*.patch
*.hg
src/Presentation/Nop.Web/App_Data/browscap.crawlersonly.xml
src/Presentation/Nop.Web/App_Data/InstalledPlugins.txt
src/Presentation/Nop.Web/App_Data/Settings.txt
src/Presentation/Nop.Web/App_Data/installedPlugins.json
src/Presentation/Nop.Web/App_Data/dataSettings.json
src/Presentation/Nop.Web/App_Data/TempUploads/*
!src/Presentation/Nop.Web/App_Data/TempUploads/Index.htm
src/Presentation/Nop.Web/App_Data/DataProtectionKeys/*
!src/Presentation/Nop.Web/App_Data/DataProtectionKeys/Index.htm
src/Presentation/Nop.Web/Plugins/*
!src/Presentation/Nop.Web/Plugins/bin
src/Presentation/Nop.Web/Plugins/bin/*
!src/Presentation/Nop.Web/Plugins/bin/placeholder.txt
src/Presentation/Nop.Web/wwwroot/bundles/*
!src/Presentation/Nop.Web/wwwroot/bundles/Index.htm
src/Presentation/Nop.Web/wwwroot/db_backups/*.bak
!src/Presentation/Nop.Web/wwwroot/db_backups/Index.htm
src/Presentation/Nop.Web/wwwroot/files/exportimport/*
!src/Presentation/Nop.Web/wwwroot/files/exportimport/Index.htm
src/Presentation/Nop.Web/wwwroot/images/thumbs/*

!src/Presentation/Nop.Web/wwwroot/images/thumbs/placeholder.txt
src/packages/*
src/Presentation/Nop.Web/wwwroot/images/uploaded/*
!src/Presentation/Nop.Web/wwwroot/images/uploaded/placeholder.txt
src/Presentation/Nop.Web/wwwroot/files/exportimport/*
!src/Presentation/Nop.Web/wwwroot/files/exportimport/Index.htm
src/packages/*
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@nopCommerce.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,15 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue,
email, or any other method with the owners of this repository before making a change.

You are more than welcome to contribute to the success of nopCommerce by helping out in the realization of the project, by participating in the forums, or just by spreading the word! If you have a site, write about us or place a hyperlink! We are committed to nurturing the growth of the nopCommerce community!


Possible ways to contribute: [more info](http://docs.nopcommerce.com/display/en/Possible+ways+to+contribute)

Working with source code and contributions: [more info](http://docs.nopcommerce.com/display/en/Working+with+source+code+and+contributions)

Sharing your plugins, themes, and language packs: [more info](http://docs.nopcommerce.com/display/en/Sharing+your+plugins%2C+themes%2C+and+language+packs)

Contributing to the documentation: [more info](http://docs.nopcommerce.com/display/en/Contributing+to+the+documentation)
7 changes: 7 additions & 0 deletions ISSUE_TEMPLATE.md
@@ -0,0 +1,7 @@
nopCommerce version:

Expected behavior:

Actual behavior:

Steps to reproduce the problem:
Binary file added src/Build/ClearPluginAssemblies.dll
Binary file not shown.
71 changes: 4 additions & 67 deletions src/Build/ClearPluginAssemblies.proj
Expand Up @@ -12,83 +12,20 @@

<OutputPath>$(MSBuildProjectDirectory)\..\Presentation\Nop.Web\bin\$(Configuration)</OutputPath>
<NopWebPath>$(MSBuildProjectDirectory)\..\Presentation\Nop.Web</NopWebPath>
</PropertyGroup>

<!-- This task deletes files if they exist -->
<UsingTask TaskName="NopClearPluginsPath" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<!-- Paths for search and delete files -->
<Paths ParameterType="System.String" Required="true" />
<!-- File names without extensions for delete -->
<FileNames ParameterType="System.String" />
<!-- Plugin path for cleaning. If it's set and not empty, then it replaces the "Paths" parameter -->
<PluginPath ParameterType="System.String" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs">
<![CDATA[
if(string.IsNullOrEmpty(FileNames))
{
return true;
}
if(!string.IsNullOrEmpty(PluginPath))
{
Paths = PluginPath;
}
var filesToDelete = "dotnet-bundle.exe;Nop.Web.pdb;Nop.Web.exe;Nop.Web.exe.config";
foreach (var pluginPath in Paths.Split(';'))
{
try
{
foreach (var fileName in FileNames.Split(';'))
{
//delete dll file if it exist in current path
var dllfilePath = Path.Combine(pluginPath, fileName+".dll");
if(File.Exists(dllfilePath))
File.Delete(dllfilePath);
//delete pdb file if it exist in current path
var pdbfilePath = Path.Combine(pluginPath, fileName + ".pdb");
if (File.Exists(pdbfilePath))
File.Delete(pdbfilePath);
}
foreach(var fileName in filesToDelete.Split(';'))
{
//delete file if it exist in current path
var pdbfilePath = Path.Combine(pluginPath, fileName);
if (File.Exists(pdbfilePath))
File.Delete(pdbfilePath);
}
}
catch
{
continue;
}
}
return true;
]]>
</Code>
</Task>
</UsingTask>
</PropertyGroup>

<Target Name="NopClear">
<ItemGroup>
<!-- Get all libraries from /bin/{version}/ directory -->
<BaseDllFiles Include="$(OutputPath)\*.dll;" />
<!-- Get file name without extension for all libraries from /bin/{version}/ directory-->
<DllFileNames Include="@(BaseDllFiles->'%(filename)')" />
<!-- Get plugin description files to get plugin paths -->
<PluginsDescription Include="$(NopWebPath)\Plugins\**\Description.txt;" />
<PluginsDescription Include="$(NopWebPath)\Plugins\**\plugin.json;" />
<!-- Get paths for all plugins -->
<PluginsFolders Include="@(PluginsDescription->'%(relativedir)')" />
</ItemGroup>

<!-- When .NET Core builds a project, it copies all referenced libraries to the output folder.
For plugins it creates too many unnecessary files that just take up space.
At the moment you can't disable this behavior. That's why we have to manually delete all unnecessary libraries from plugin output directories. -->
<NopClearPluginsPath Paths="@(PluginsFolders)" FileNames="@(DllFileNames)" PluginPath="$(PluginPath)" />
At the moment you can't disable this behavior. That's why we have to manually delete all unnecessary libraries from plugin output directories. -->
<Exec Command='dotnet "$(MSBuildProjectDirectory)\ClearPluginAssemblies.dll" "OutputPath=$(OutputPath)|Paths=@(PluginsFolders)|PluginPath=$(PluginPath)|SaveLocalesFolders=$(SaveLocalesFolders)"' />
</Target>

</Project>
9 changes: 9 additions & 0 deletions src/Build/ClearPluginAssemblies.runtimeconfig.json
@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "netcoreapp2.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "2.0.0"
}
}
}
6 changes: 6 additions & 0 deletions src/Build/Note.txt
@@ -0,0 +1,6 @@
When .NET Core builds a project, it copies all referenced libraries to the output folder.
For plugins it creates too many unnecessary files that just take up space.
At the moment you can't disable this behavior. That's why we have to manually delete all unnecessary libraries from plugin output directories.

ClearPluginAssemblies.proj file contains preparation steps for delete unnecessary files.
ClearPluginAssemblies.dll file contains the code for deleting unnecessary files. This file is compiled from the project code from the src directory.
25 changes: 25 additions & 0 deletions src/Build/src/ClearPluginAssemblies.sln
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClearPluginAssemblies", "ClearPluginAssemblies\ClearPluginAssemblies.csproj", "{98B26C68-16E7-4545-ACE7-1A6FBBFC2E92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{98B26C68-16E7-4545-ACE7-1A6FBBFC2E92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{98B26C68-16E7-4545-ACE7-1A6FBBFC2E92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{98B26C68-16E7-4545-ACE7-1A6FBBFC2E92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{98B26C68-16E7-4545-ACE7-1A6FBBFC2E92}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E029116-51FD-4D73-AA78-4E26C730BFEB}
EndGlobalSection
EndGlobal
11 changes: 11 additions & 0 deletions src/Build/src/ClearPluginAssemblies/ClearPluginAssemblies.csproj
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>


</Project>
111 changes: 111 additions & 0 deletions src/Build/src/ClearPluginAssemblies/Program.cs
@@ -0,0 +1,111 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ClearPluginAssemblies
{
public class Program
{
protected const string FILES_TO_DELETE = "dotnet-bundle.exe;Nop.Web.pdb;Nop.Web.exe;Nop.Web.exe.config";

protected static void Clear(string paths, IList<string> fileNames, bool saveLocalesFolders)
{
foreach (var pluginPath in paths.Split(';'))
{
try
{
var pluginDirectoryInfo = new DirectoryInfo(pluginPath);
var allDirectoryInfo = new List<DirectoryInfo> { pluginDirectoryInfo };

if (!saveLocalesFolders)
allDirectoryInfo.AddRange(pluginDirectoryInfo.GetDirectories());

foreach (var directoryInfo in allDirectoryInfo)
{
foreach (var fileName in fileNames)
{
//delete dll file if it exists in current path
var dllfilePath = Path.Combine(directoryInfo.FullName, fileName + ".dll");
if (File.Exists(dllfilePath))
File.Delete(dllfilePath);
//delete pdb file if it exists in current path
var pdbfilePath = Path.Combine(directoryInfo.FullName, fileName + ".pdb");
if (File.Exists(pdbfilePath))
File.Delete(pdbfilePath);
}

foreach (var fileName in FILES_TO_DELETE.Split(';'))
{
//delete file if it exists in current path
var pdbfilePath = Path.Combine(directoryInfo.FullName, fileName);
if (File.Exists(pdbfilePath))
File.Delete(pdbfilePath);
}

if (!directoryInfo.GetFiles().Any() && !directoryInfo.GetDirectories().Any() && !saveLocalesFolders)
directoryInfo.Delete(true);
}
}
catch
{
//do nothing
}
}
}

private static void Main(string[] args)
{
var paths = string.Empty;
var outputPath = string.Empty;
var basePluginPath = string.Empty;
var saveLocalesFolders = true;

var settings = args.FirstOrDefault(a => a.Contains("|")) ?? string.Empty;
if(string.IsNullOrEmpty(settings))
return;

foreach (var arg in settings.Split('|'))
{
var data = arg.Split("=").Select(p => p.Trim()).ToList();

var name = data[0];
var value = data.Count > 1 ? data[1] : string.Empty;

switch (name)
{
case "Paths":
paths = value;
break;
case "OutputPath":
outputPath = value;
break;
case "PluginPath":
basePluginPath = value;
break;
case "SaveLocalesFolders":
bool.TryParse(value, out saveLocalesFolders);
break;
}
}

if(!Directory.Exists(outputPath))
return;

var di = new DirectoryInfo(outputPath);
var fileNames = di.GetFiles("*.dll", SearchOption.AllDirectories).Select(fi => fi.Name.Replace(fi.Extension, "")).ToList();

if (string.IsNullOrEmpty(paths) || !fileNames.Any())
{
return;
}

if (!string.IsNullOrEmpty(basePluginPath))
{
paths = basePluginPath;
}

Clear(paths, fileNames, saveLocalesFolders);
}
}
}

0 comments on commit c32ede4

Please sign in to comment.