示例#1
0
        private static void LogExportFooter(ExportContext context)
        {
            Logger.LogMessage("--------------------------------------------------------------");
            Logger.LogMessage("Outer references:");
            var outerRefs = context.GetOuterReferences();

            if (outerRefs.Count == 0)
            {
                Logger.LogMessage("All references are exported.");
            }
            else
            {
                foreach (var item in outerRefs)
                {
                    Logger.LogMessage(item);
                }
            }
        }
示例#2
0
        private static void Export(string repositoryPath, string fsPath, string queryPath)
        {
            try
            {
                //-- check fs folder
                DirectoryInfo dirInfo = new DirectoryInfo(fsPath);
                if (!dirInfo.Exists)
                {
                    LogWrite("Creating target directory: ", fsPath, " ... ");
                    Directory.CreateDirectory(fsPath);
                    LogWriteLine("Ok");
                }
                else
                {
                    LogWriteLine("Target directory exists: ", fsPath, ". Exported contents will override existing subelements.");
                }

                //-- load export root
                Content root = Content.Load(repositoryPath);
                if (root == null)
                {
                    LogWriteLine();
                    LogWriteLine("Content does not exist: ", repositoryPath);
                }
                else
                {
                    LogWriteLine();
                    LogWriteLine("=========================== Export ===========================");
                    LogWriteLine("From: ", repositoryPath);
                    LogWriteLine("To:   ", fsPath);
                    if (queryPath != null)
                    {
                        LogWriteLine("Filter: ", queryPath);
                    }
                    LogWriteLine("==============================================================");
                    var context = new ExportContext(repositoryPath, fsPath);
                    if (queryPath != null)
                    {
                        ExportByFilter(root, context, fsPath, queryPath);
                    }
                    else
                    {
                        ExportContentTree(root, context, fsPath, "");
                    }
                    LogWriteLine("--------------------------------------------------------------");
                    LogWriteLine("Outer references:");
                    var outerRefs = context.GetOuterReferences();
                    if (outerRefs.Count == 0)
                    {
                        LogWriteLine("All references are exported.");
                    }
                    else
                    {
                        foreach (var item in outerRefs)
                        {
                            LogWriteLine(item);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                PrintException(e, fsPath);
            }

            LogWriteLine("==============================================================");
            if (exceptions == 0)
            {
                LogWriteLine("Export is successfully finished.");
            }
            else
            {
                LogWriteLine("Export is finished with ", exceptions, " errors.");
            }
            LogWriteLine("Read log file: ", _logFilePath);
        }