Beispiel #1
0
        public void LoadAvailableTheme(string themeId)
        {
            string themePhysicalRoot = WebAppSettings.ApplicationBuiltinThemesPath + "\\theme-" + themeId + "\\";

            if (!Directory.Exists(themePhysicalRoot))
            {
                return;
            }

            _Info = new ThemeInfo();
            if (File.Exists(Path.Combine(themePhysicalRoot, "bvtheme.xml")))
            {
                _Info.LoadFromString(File.ReadAllText(Path.Combine(themePhysicalRoot, "bvtheme.xml")));
            }

            if (File.Exists(Path.Combine(themePhysicalRoot, ".customized")))
            {
                _IsCustomized = true;
            }
            else
            {
                _IsCustomized = false;
            }

            if (File.Exists(Path.Combine(themePhysicalRoot, "preview.png")))
            {
                _PreviewImageUrl = "/content/themes/theme-" + themeId + "/preview.png";
            }
            else
            {
                _PreviewImageUrl = string.Empty;
            }
        }
Beispiel #2
0
        public void LoadInstalledTheme(MerchantTribeApplication app, string themeId)
        {
            long storeId = app.CurrentStore.Id;
            string themePhysicalRoot = Storage.DiskStorage.BaseStoreThemePhysicalPath(storeId, themeId);

            if (!Directory.Exists(themePhysicalRoot))
            {
                return;
            }

            _Info = new ThemeInfo();
            if (File.Exists(Path.Combine(themePhysicalRoot,"bvtheme.xml")) )
            {
                _Info.LoadFromString(File.ReadAllText(Path.Combine(themePhysicalRoot,"bvtheme.xml")));
            }

            if (File.Exists(Path.Combine(themePhysicalRoot,".customized")))
            {
                _IsCustomized = true;
            }
            else
            {
                _IsCustomized = false;  
            }

            if (File.Exists(Path.Combine(themePhysicalRoot,"preview.png")))
            {
                _PreviewImageUrl = Storage.DiskStorage.BaseUrlForStoreTheme(app, themeId, true) + "preview.png";
            }
            else
            {
                _PreviewImageUrl = string.Empty;
            }
        }
Beispiel #3
0
        public void LoadAvailableTheme(string themeId)
        {
            string themePhysicalRoot = WebAppSettings.ApplicationBuiltinThemesPath + "\\theme-" + themeId + "\\";

            if (!Directory.Exists(themePhysicalRoot))
            {
                return;
            }

            _Info = new ThemeInfo();
            if (File.Exists(Path.Combine(themePhysicalRoot, "bvtheme.xml")))
            {
                _Info.LoadFromString(File.ReadAllText(Path.Combine(themePhysicalRoot, "bvtheme.xml")));
            }

            if (File.Exists(Path.Combine(themePhysicalRoot, ".customized")))
            {
                _IsCustomized = true;
            }
            else
            {
                _IsCustomized = false;
            }

            if (File.Exists(Path.Combine(themePhysicalRoot, "preview.png")))
            {
                _PreviewImageUrl = "/content/themes/theme-" + themeId + "/preview.png";
            }
            else
            {
                _PreviewImageUrl = string.Empty;
            }
        }
Beispiel #4
0
        public void LoadInstalledTheme(MerchantTribeApplication app, string themeId)
        {
            long   storeId           = app.CurrentStore.Id;
            string themePhysicalRoot = Storage.DiskStorage.BaseStoreThemePhysicalPath(storeId, themeId);

            if (!Directory.Exists(themePhysicalRoot))
            {
                return;
            }

            _Info = new ThemeInfo();
            if (File.Exists(Path.Combine(themePhysicalRoot, "bvtheme.xml")))
            {
                _Info.LoadFromString(File.ReadAllText(Path.Combine(themePhysicalRoot, "bvtheme.xml")));
            }

            if (File.Exists(Path.Combine(themePhysicalRoot, ".customized")))
            {
                _IsCustomized = true;
            }
            else
            {
                _IsCustomized = false;
            }

            if (File.Exists(Path.Combine(themePhysicalRoot, "preview.png")))
            {
                _PreviewImageUrl = Storage.DiskStorage.BaseUrlForStoreTheme(app, themeId, true) + "preview.png";
            }
            else
            {
                _PreviewImageUrl = string.Empty;
            }
        }
        public ThemeInfo GetThemeInfo(string themeId)
        {
            string    newInfoXml = Storage.DiskStorage.ReadThemeFile(MTApp.CurrentStore.Id, themeId, "bvtheme.xml");
            ThemeInfo newInfo    = new ThemeInfo();

            newInfo.LoadFromString(newInfoXml);
            return(newInfo);
        }
Beispiel #6
0
		public static ThemeInfo ReadFromXml(string fileName)
		{
			ThemeInfo result = new ThemeInfo();

			try {
				if (File.Exists(fileName)) {
					string xmlData = File.ReadAllText(fileName);
					result.LoadFromString(xmlData);
				}
			}
			catch {
				// surpress errors
			}

			return result;
		}
Beispiel #7
0
        public static ThemeInfo ReadFromXml(string fileName)
        {
            ThemeInfo result = new ThemeInfo();

            try {
                if (File.Exists(fileName))
                {
                    string xmlData = File.ReadAllText(fileName);
                    result.LoadFromString(xmlData);
                }
            }
            catch {
                // surpress errors
            }

            return(result);
        }
        public bool DuplicateTheme(string themeId)
        {
            // Generate a new ID for the copy
            string newThemeId = System.Guid.NewGuid().ToString().ToLower();

            // Create the new folder
            Storage.FileHelper.CreateAndCheckDirectory(Storage.DiskStorage.BaseStoreThemePhysicalPath(MTApp.CurrentStore.Id, newThemeId));

            if (Storage.FileHelper.CopyAllFiles(Storage.DiskStorage.BaseStoreThemePhysicalPath(MTApp.CurrentStore.Id, themeId),
                                                Storage.DiskStorage.BaseStoreThemePhysicalPath(MTApp.CurrentStore.Id, newThemeId)))
            {
                ThemeInfo newInfo = GetThemeInfo(newThemeId);
                newInfo.Title    = "Copy of " + newInfo.Title;
                newInfo.UniqueId = newThemeId;
                SaveThemeInfo(newThemeId, newInfo);
                return(true);
            }

            return(false);
        }
Beispiel #9
0
 public bool SaveThemeInfo(string themeId, ThemeInfo info)
 {
     Storage.DiskStorage.WriteThemeFile(MTApp.CurrentStore.Id, themeId, "bvtheme.xml", info.WriteToXmlString());
     return true;
 }
Beispiel #10
0
 public ThemeInfo GetThemeInfo(string themeId)
 {
     string newInfoXml = Storage.DiskStorage.ReadThemeFile(MTApp.CurrentStore.Id, themeId, "bvtheme.xml");
     ThemeInfo newInfo = new ThemeInfo();
     newInfo.LoadFromString(newInfoXml);
     return newInfo;            
 }
Beispiel #11
0
 public bool SaveThemeInfo(string themeId, ThemeInfo info)
 {
     Storage.DiskStorage.WriteThemeFile(MTApp.CurrentStore.Id, themeId, "bvtheme.xml", info.WriteToXmlString());
     return(true);
 }