Пример #1
0
 /// <summary>
 /// Creates the google feed
 /// </summary>
 public static void CreateFeed(bool manualFeedGeneration)
 {
     try
     {
         // ENSURE APP IS INSTALLED
         Store store = GetInstalledStore();
         if (store != null)
         {
             // SEE IF FEED GENERATION IS ENABLED
             ApplicationSettings appConfig = ApplicationSettings.Instance;
             if (appConfig.GoogleFeedInterval > 0 || manualFeedGeneration)
             {
                 // SEE IF THE FEED IS OLD ENOUGH TO BE REGENERATED
                 int      interval       = (int)(60000 * appConfig.GoogleFeedInterval);
                 string   googleBaseFile = HostingEnvironment.MapPath("~/Feeds/GoogleFeedData.txt");
                 FileInfo fileInfo       = new FileInfo(googleBaseFile);
                 if (!fileInfo.Exists || fileInfo.LastWriteTime.AddMilliseconds(interval) < DateTime.Now)
                 {
                     CreateFeed(googleBaseFile, store.Settings.GoogleFeedIncludeAllProducts, store.Settings.GoogleFeedDefaultBrand, store.Settings.GoogleFeedDefaultCategory);
                 }
             }
         }
     }
     catch
     {
     }
     finally
     {
         AbleContext.ReleaseInstance();
     }
 }