예제 #1
0
        protected override void InternalProcessRecord()
        {
            try
            {
                ShouldProcessReason reason;
                bool whatIf = false;
                if (!base.ShouldProcess(null, null, null, out reason))
                {
                    if (reason == ShouldProcessReason.WhatIf)
                    {
                        whatIf         = true;
                        Logger.Verbose = true;
                    }
                }
                Logger.Write("Start Time: {0}", DateTime.Now.ToString());

                ImportTerms import = new ImportTerms(_xml, whatIf);

                switch (ParameterSetName)
                {
                case "TaxonomySession":
                    import.Import(TaxonomySession.Read());
                    break;

                case "TermStore":
                    import.Import(ParentTermStore.Read());
                    break;

                case "Group":
                    import.Import(ParentGroup.Read());
                    break;

                case "TermSet":
                    import.Import(ParentTermSet.Read());
                    break;

                case "Term":
                    import.Import(ParentTerm.Read());
                    break;
                }
            }
            finally
            {
                Logger.Write("Finish Time: {0}", DateTime.Now.ToString());
            }
        }
예제 #2
0
        protected override void InternalProcessRecord()
        {
            ExportTerms export = new ExportTerms();
            XmlDocument xml    = null;

            switch (ParameterSetName)
            {
            case "TaxonomySession":
                xml = export.Export(TaxonomySession.Read());
                break;

            case "TermStore":
                xml = export.Export(TermStore.Read());
                break;

            case "Group":
                xml = export.Export(Group.Read());
                break;

            case "TermSet":
                xml = export.Export(TermSet.Read());
                break;

            case "Term":
                xml = export.Export(Term.Read());
                break;
            }
            if (xml == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(OutputFile))
            {
                xml.Save(OutputFile);
            }
            else
            {
                WriteResult(xml);
            }
        }