Esempio n. 1
0
        private static void BackupContentAsXML(Repository repository)
        {
            ITextContentProvider textContentProvider = Providers.DefaultProviderFactory.GetProvider <ITextContentProvider>();
            ISchemaProvider      schemaProvider      = Providers.DefaultProviderFactory.GetProvider <ISchemaProvider>();

            if (!(textContentProvider is TextContentProvider))
            {
                ITextContentProvider xmlTextContentProvider = new TextContentProvider();

                foreach (var schema in schemaProvider.All(repository))
                {
                    xmlTextContentProvider.ImportSchemaData(schema, textContentProvider.ExportSchemaData(schema));
                }

                xmlTextContentProvider.ImportCategoryData(repository, textContentProvider.ExportCategoryData(repository));
            }
        }
Esempio n. 2
0
        //private void AdjustContentValue(Repository repository)
        //{
        //    ISchemaProvider xmlSchemaProvider = new SchemaProvider();
        //    foreach (var schema in xmlSchemaProvider.All(repository))
        //    {
        //        ReplaceContentFileVirtualPath(repository, schema);
        //    }
        //}
        //private void ReplaceContentFileVirtualPath(Repository repository, Schema schema)
        //{
        //    var schemaDataFile = schema.GetContentFile();
        //    if (File.Exists(schemaDataFile))
        //    {
        //        var replaceVirtualPathRegex = new Regex(RepositoryPath.BaseVirtualPath.TrimStart('~') + "/[^/]+/", RegexOptions.Compiled | RegexOptions.IgnoreCase);
        //        string virtualPathFormat = RepositoryPath.BaseVirtualPath.TrimStart('~') + "/{0}/";
        //        string data = IOUtility.ReadAsString(schemaDataFile);
        //        string newData = replaceVirtualPathRegex.Replace(data, string.Format(virtualPathFormat, repository));
        //        IOUtility.SaveStringToFile(schemaDataFile, newData);
        //    }
        //}

        public virtual void Initialize(Repository repository)
        {
            ITextContentProvider textContentProvider = Providers.DefaultProviderFactory.GetProvider <ITextContentProvider>();

            Providers.DefaultProviderFactory.GetProvider <IMediaContentProvider>().InitializeMediaContents(repository);
            ISchemaProvider schemaProvider = Providers.DefaultProviderFactory.GetProvider <ISchemaProvider>();

            //if (!(textContentProvider is TextContentProvider))
            //{
            ISchemaProvider      xmlSchemaProvider  = new SchemaProvider();
            ITextContentProvider xmlContentProvider = new TextContentProvider();

            foreach (var schema in xmlSchemaProvider.All(repository))
            {
                schemaProvider.Initialize(schema);

                textContentProvider.ImportSchemaData(schema, xmlContentProvider.ExportSchemaData(schema));
            }

            textContentProvider.ImportCategoryData(repository, xmlContentProvider.ExportCategoryData(repository));
            //}
        }