public void Upload_simple_html()
        {
            const string taskFolder = @"c:\temp\dsqueue";

            DocumentImportData data = _docs.CreateDocumentImportData(
                Guid.NewGuid(),
                TestConfig.PathToSimpleHtmlFile,
                Path.GetFileName(TestConfig.PathToSimpleHtmlFile),
                DocumentHandle.FromString("simple-html-file"));

            data.DeleteAfterImport = false;
            var docsFile = Path.Combine(taskFolder, "doc_simple-html-file_" + DateTime.Now.Ticks);

            _docs.QueueDocumentImport(data, docsFile);
        }
Esempio n. 2
0
        public void QueueDocumentImport(DocumentImportData did, string pathToFile)
        {
            string fileName = pathToFile + ".dsimport";
            string folder   = Path.GetDirectoryName(fileName);

            if (folder == null)
            {
                throw new Exception("Invalid folder");
            }

            string json = JsonConvert.SerializeObject(did, Formatting.Indented);

            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }
            File.WriteAllText(fileName, json);
        }