コード例 #1
0
ファイル: AppUpdater.cs プロジェクト: devil1510/SmartStore
        private void MigrateInitial()
        {
            var installedPlugins = PluginFileParser.ParseInstalledPluginsFile();

            if (installedPlugins.Count == 0)
            {
                return;
            }

            var renamedPlugins = new List <string>();

            var pluginRenameMap = new Dictionary <string, string>
            {
                { "CurrencyExchange.ECB", null /* null means: remove it */ },
                { "CurrencyExchange.MoneyConverter", null },
                { "ExternalAuth.OpenId", null },
                { "Tax.Free", null },
                { "Api.WebApi", "SmartStore.WebApi" },
                { "DiscountRequirement.MustBeAssignedToCustomerRole", "SmartStore.DiscountRules" },
                { "DiscountRequirement.HadSpentAmount", "SmartStore.DiscountRules" },
                { "DiscountRequirement.HasAllProducts", "SmartStore.DiscountRules" },
                { "DiscountRequirement.HasOneProduct", "SmartStore.DiscountRules" },
                { "DiscountRequirement.Store", "SmartStore.DiscountRules" },
                { "DiscountRequirement.BillingCountryIs", "SmartStore.DiscountRules" },
                { "DiscountRequirement.ShippingCountryIs", "SmartStore.DiscountRules" },
                { "DiscountRequirement.HasPaymentMethod", "SmartStore.DiscountRules.HasPaymentMethod" },
                { "DiscountRequirement.HasShippingOption", "SmartStore.DiscountRules.HasShippingOption" },
                { "DiscountRequirement.PurchasedAllProducts", "SmartStore.DiscountRules.PurchasedProducts" },
                { "DiscountRequirement.PurchasedOneProduct", "SmartStore.DiscountRules.PurchasedProducts" },
                { "PromotionFeed.Froogle", "SmartStore.GoogleMerchantCenter" },
                { "PromotionFeed.Billiger", "SmartStore.Billiger" },
                { "PromotionFeed.ElmarShopinfo", "SmartStore.ElmarShopinfo" },
                { "PromotionFeed.Guenstiger", "SmartStore.Guenstiger" },
                { "Payments.AccardaKar", "SmartStore.AccardaKar" },
                { "Payments.AmazonPay", "SmartStore.AmazonPay" },
                { "Developer.DevTools", "SmartStore.DevTools" },
                { "ExternalAuth.Facebook", "SmartStore.FacebookAuth" },
                { "ExternalAuth.Twitter", "SmartStore.TwitterAuth" },
                { "SMS.Clickatell", "SmartStore.Clickatell" },
                { "Widgets.GoogleAnalytics", "SmartStore.GoogleAnalytics" },
                { "Misc.DemoShop", "SmartStore.DemoShopControlling" },
                { "Admin.OrderNumberFormatter", "SmartStore.OrderNumberFormatter" },
                { "Admin.Debitoor", "SmartStore.Debitoor" },
                { "Widgets.ETracker", "SmartStore.ETracker" },
                { "Payments.PayPalDirect", "SmartStore.PayPal" },
                { "Payments.PayPalStandard", "SmartStore.PayPal" },
                { "Payments.PayPalExpress", "SmartStore.PayPal" },
                { "Developer.Glimpse", "SmartStore.Glimpse" },
                { "Import.Biz", "SmartStore.BizImporter" },
                { "Payments.Sofortueberweisung", "SmartStore.Sofortueberweisung" },
                { "Payments.PostFinanceECommerce", "SmartStore.PostFinanceECommerce" },
                { "Misc.MailChimp", "SmartStore.MailChimp" },
                { "Mobile.SMS.Verizon", "SmartStore.Verizon" },
                { "Widgets.LivePersonChat", "SmartStore.LivePersonChat" },
                { "Payments.CashOnDelivery", "SmartStore.OfflinePayment" },
                { "Payments.Invoice", "SmartStore.OfflinePayment" },
                { "Payments.PayInStore", "SmartStore.OfflinePayment" },
                { "Payments.Prepayment", "SmartStore.OfflinePayment" },
                { "Payments.IPaymentCreditCard", "SmartStore.IPayment" },
                { "Payments.IPaymentDirectDebit", "SmartStore.IPayment" },
                { "Payments.AuthorizeNet", "SmartStore.AuthorizeNet" },
                { "Shipping.AustraliaPost", "SmartStore.AustraliaPost" },
                { "Shipping.CanadaPost", "SmartStore.CanadaPost" },
                { "Shipping.Fedex", "SmartStore.Fedex" },
                { "Shipping.UPS", "SmartStore.UPS" },
                { "Payments.Manual", "SmartStore.OfflinePayment" },
                { "Shipping.USPS", "SmartStore.USPS" },
                { "Widgets.TrustedShopsSeal", "SmartStore.TrustedShops" },
                { "Widgets.TrustedShopsCustomerReviews", "SmartStore.TrustedShops" },
                { "Widgets.TrustedShopsCustomerProtection", "SmartStore.TrustedShops" },
                { "Shipping.ByWeight", "SmartStore.ShippingByWeight" },
                { "Payments.DirectDebit", "SmartStore.OfflinePayment" },
                { "Tax.FixedRate", "SmartStore.Tax" },
                { "Tax.CountryStateZip", "SmartStore.Tax" },
                { "Shipping.ByTotal", "SmartStore.Shipping" },
                { "Shipping.FixedRate", "SmartStore.Shipping" }
            };

            foreach (var name in installedPlugins)
            {
                if (pluginRenameMap.ContainsKey(name))
                {
                    string newName = pluginRenameMap[name];
                    if (newName != null && !renamedPlugins.Contains(newName))
                    {
                        renamedPlugins.Add(newName);
                    }
                }
                else
                {
                    renamedPlugins.Add(name);
                }
            }

            PluginFileParser.SaveInstalledPluginsFile(renamedPlugins);
        }