Ejemplo n.º 1
0
        protected override void initTheme() {

            if (ContentTheme.IdHasError( base.themeId )) {
                logger.Error( "theme id error, id=" + base.themeId );
                return;
            }

            this.xapp = ContentTheme.GetByThemeId( base.themeId );

            if (this.xapp == null) throw new Exception( "没有有效的主题数据, themeId=" + base.themeId );
        }
Ejemplo n.º 2
0
        protected override void initTheme()
        {
            if (base.themeId <= 0) return;

            ContentTheme x = cdb.findById<ContentTheme>( base.themeId );
            if (x == null) return;

            String jsonStr = file.Read( x.GetFileAbsPath() );
            xapp = Json.Deserialize<XApp>( jsonStr );

            if (xapp == null) throw new Exception( "没有有效的主题数据, name=" + x.Name + ", path=" + x.GetFileAbsPath() );
        }
Ejemplo n.º 3
0
 private void replaceIdToClass( XApp xapp, String id, String cls )
 {
     xapp.Style = xapp.Style.Replace( id, cls );
     xapp.SkinStyle = xapp.SkinStyle.Replace( id, cls );
 }
Ejemplo n.º 4
0
        private void processCssId( XApp xapp, List<ContentSection> sectionList )
        {
            foreach (ContentSection s in sectionList) {

                XSection xSection = getXSection( xapp.SectionList, s );

                replaceIdToClass( xapp, "#section" + s.Id, xSection.CssPath + " " );
                replaceIdToClass( xapp, "#sectionTitle" + s.Id, xSection.CssPath + " .sectionTitle " );
                replaceIdToClass( xapp, "#sectionContent" + s.Id, xSection.CssPath + " .sectionContent " );
                replaceIdToClass( xapp, "#sectionContentText" + s.Id, xSection.CssPath + " .sectionContentText " );
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 将安装包保存到磁盘
 /// </summary>
 /// <param name="xapp"></param>
 private void exportToDisk( XApp xapp, ContentTheme theme )
 {
     String jsonString = Json.ToString( xapp );
     theme.Insert( jsonString );
 }
Ejemplo n.º 6
0
 private XApp exportApp( ContentApp app )
 {
     XApp x = new XApp();
     x.Style = app.Style;
     x.Layout = app.Layout;
     x.SkinStyle = app.SkinStyle;
     return x;
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 将安装包保存到磁盘
        /// </summary>
        /// <param name="xapp"></param>
        private void exportToDisk( XApp xapp, ContentTheme theme )
        {
            String jsonString = Json.ToString( xapp );

            String fileName = Guid.NewGuid().ToString() + ".config";
            String savedPath = ContentTheme.GetFileAbsDir();

            if (Directory.Exists( savedPath ) == false) {
                Directory.CreateDirectory( savedPath );
            }

            file.Write( Path.Combine( savedPath, fileName ), jsonString );

            theme.FileName = fileName;
            theme.insert();
        }