public AccelaOpenPermitAdapter(OpenPermitContext context)
        {
            this.agencyAppId = ConfigurationManager.AppSettings["OP.Accela.App.Id"];
            this.agencyAppSecret = ConfigurationManager.AppSettings["OP.Accela.App.Secret"];
            if (this.agencyAppId == null || this.agencyAppSecret == null)
            {
                throw new ConfigurationErrorsException("OP.Accela.App.Id and OP.Accela.App.Secret are required configuration settings.");
            }

            this.context = context;

            // TODO see if it makes sense to provide a default config, otherwise make sure the AccelaConfig is provided
            this.config = JsonConvert.DeserializeObject<AgencyConfiguration>(context.Agency.Configuration);
                
            // TODO using agency app only, should we change this to citizen app?
            this.recApi = new RecordHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig);
            this.inspectionApi = new InspectionHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig);
            this.documentApi = new DocumentHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig);

            this.connection = HttpUtility.ParseQueryString(context.Agency.ConnectionString);
            this.recApi.AgencyId = this.connection["id"];
            this.recApi.Environment = this.connection["env"];
            this.inspectionApi.AgencyId = this.connection["id"];
            this.inspectionApi.Environment = this.connection["env"];
            this.documentApi.AgencyId = this.connection["id"];
            this.documentApi.Environment = this.connection["env"];
        }
        public CustomPropertiesEventsHandler(DocumentHandler docHandler, ISldWorks app, IModelDoc2 model)
        {
            m_DocHandler = docHandler;

            m_App   = app;
            m_Model = model;

            (m_App as SldWorks).CommandCloseNotify += OnCommandCloseNotify;
            (m_App as SldWorks).OnIdleNotify       += OnIdleNotify;

            if (model is PartDoc)
            {
                (model as PartDoc).AddCustomPropertyNotify    += OnAddCustomPropertyNotify;
                (model as PartDoc).DeleteCustomPropertyNotify += OnDeleteCustomPropertyNotify;
                (model as PartDoc).ChangeCustomPropertyNotify += OnChangeCustomPropertyNotify;
            }
            else if (model is AssemblyDoc)
            {
                (model as AssemblyDoc).AddCustomPropertyNotify    += OnAddCustomPropertyNotify;
                (model as AssemblyDoc).DeleteCustomPropertyNotify += OnDeleteCustomPropertyNotify;
                (model as AssemblyDoc).ChangeCustomPropertyNotify += OnChangeCustomPropertyNotify;
            }
            else if (model is DrawingDoc)
            {
                (model as DrawingDoc).AddCustomPropertyNotify    += OnAddCustomPropertyNotify;
                (model as DrawingDoc).DeleteCustomPropertyNotify += OnDeleteCustomPropertyNotify;
                (model as DrawingDoc).ChangeCustomPropertyNotify += OnChangeCustomPropertyNotify;
            }
            else
            {
                throw new NotSupportedException();
            }

            CaptureCurrentProperties();
        }
 public AssemblyProgramViewModel(string fullPath, DocumentHandler documentHandler, TvcStudioSettings settings) : base(fullPath, documentHandler, settings)
 {
     ProgramType           = ProgramType.Assembly;
     OpenListFileCommand   = new RelayCommand(OpenListFile);
     OpenLoaderFileCommand = new RelayCommand(OpenLoaderFile);
     m_Settings            = settings;
 }
예제 #4
0
        public AccelaOpenPermitAdapter(OpenPermitContext context)
        {
            this.agencyAppId     = ConfigurationManager.AppSettings["OP.Accela.App.Id"];
            this.agencyAppSecret = ConfigurationManager.AppSettings["OP.Accela.App.Secret"];
            if (this.agencyAppId == null || this.agencyAppSecret == null)
            {
                throw new ConfigurationErrorsException("OP.Accela.App.Id and OP.Accela.App.Secret are required configuration settings.");
            }

            this.context = context;

            // TODO see if it makes sense to provide a default config, otherwise make sure the AccelaConfig is provided
            this.config = JsonConvert.DeserializeObject <AgencyConfiguration>(context.Agency.Configuration);

            // TODO using agency app only, should we change this to citizen app?
            this.recApi        = new RecordHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig);
            this.inspectionApi = new InspectionHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig);
            this.documentApi   = new DocumentHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig);

            this.connection                = HttpUtility.ParseQueryString(context.Agency.ConnectionString);
            this.recApi.AgencyId           = this.connection["id"];
            this.recApi.Environment        = this.connection["env"];
            this.inspectionApi.AgencyId    = this.connection["id"];
            this.inspectionApi.Environment = this.connection["env"];
            this.documentApi.AgencyId      = this.connection["id"];
            this.documentApi.Environment   = this.connection["env"];
        }
예제 #5
0
        protected override void Nested_LoadDataFromDataSource()
        {
            DocumentHandler h = new DocumentHandler();

            h.GetUserDocuments(_current);;
            _documents = h.BindableResults;
        }
예제 #6
0
        private void commandBar1_DelCommandPressed(object sender, EventArgs e)
        {
            WIN.SCHEDULING_APPLICATION.DOMAIN.Document label = null;
            if (gridView1.FocusedRowHandle >= 0)
            {
                label = gridView1.GetRow(gridView1.FocusedRowHandle) as WIN.SCHEDULING_APPLICATION.DOMAIN.Document;
                if (label == null)
                {
                    return;
                }
            }


            try
            {
                if (XtraMessageBox.Show("Sicuro di voler procedere? ", "Elimina documento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Nested_CheckSecurityForDeletion();

                    DocumentHandler h = new DocumentHandler();
                    h.Delete(_current);

                    IBindingList g = gridView1.DataSource as IBindingList;
                    g.Remove(label);
                }
            }
            catch (AccessDeniedException)
            {
                XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                ErrorHandler.Show(ex);
            }
        }
예제 #7
0
 public BasicProgramViewModel(string fullPath, DocumentHandler documentHandler, TvcStudioSettings settings) : base(fullPath, documentHandler, settings)
 {
     ProgramType           = ProgramType.Basic;
     OpenListFileCommand   = new RelayCommand(o => { }, o => false);
     OpenLoaderFileCommand = new RelayCommand(o => { }, o => false);
     m_Settings            = settings;
 }
예제 #8
0
        public async Task <ActionResult> Get(Guid solutionId, Guid projectId)
        {
            var             collection = this._repository.GetCollection <WorkspaceEntityCollection>();
            WorkspaceEntity?workspace  = collection.Query((entity) => entity.Solution?.Id.Id == solutionId).FirstOrDefault();

            if (workspace == null)
            {
                return(NotFound());
            }

            Project?project = workspace.Solution?.Projects.FirstOrDefault(project => project.Id.Id == projectId);

            if (project == null)
            {
                return(NotFound());
            }

            IEnumerable <Task <DocumentModel> > tasks = project.Documents.Select(async(document) =>
            {
                SourceText text = await document.GetTextAsync();
                IEnumerable <MethodDeclarationSyntax>?methodSyntaxes = await DocumentHandler.GetSyntaxNodes <MethodDeclarationSyntax>(document);
                IEnumerable <MethodSyntaxModel>?methods = methodSyntaxes.Select(method => new MethodSyntaxModel(method.Identifier.ValueText));

                return(new DocumentModel(document.Id.Id, document.Name, document.Folders, text.ToString(), methods));
            });

            await Task.WhenAll(tasks);

            IEnumerable <DocumentModel> documents = tasks.Select(task => task.Result);

            return(Ok(documents));
        }
예제 #9
0
        private bool IndexEBook(BookViewModel bookViewModel, string path)
        {
            bool     success;
            Document document = null;

            string      language = LanguageService.Get(bookViewModel.LanguageId).Name;
            IndexerType type     = AnalyzerService.GetIndexerType(language);

            BookDomainModelBuilder builder = BuilderResolverService.Get <BookDomainModelBuilder, BookViewModel>(bookViewModel);

            Constructor.ConstructDomainModelData(builder);
            BookData book = builder.GetDataModel();

            try
            {
                document = DocumentHandler.GetDocument(book, path);
                if (book.Id != 0)
                {
                    EBookIndexer.DeleteById(book.Id.ToString(), type);
                }

                EBookIndexer.Add(document, type);
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }

            return(success);
        }
        /// <summary>
        /// Join list of password-protected document of known format
        /// </summary>
        /// <param name="fileOne">first source file</param>
        /// <param name="fileTwo">second source file</param>
        public static void JoinDocumentsOfKnownFormat(string fileOne, string fileTwo)
        {
            //ExStart:JoinDocumentsOfKnownFormat
            string sourceFile1 = CommonUtilities.fileOne + fileOne;
            string sourceFile2 = CommonUtilities.fileTwo + fileTwo;

            // Preparing.
            string          password        = "******";
            Stream          openFile1       = new FileStream(sourceFile1, FileMode.Open);
            Stream          openFile2       = new FileStream(sourceFile2, FileMode.Open);
            List <JoinItem> documentStreams = new List <JoinItem>();
            JoinItem        item1           = new JoinItem(openFile1, FileFormat.Docx, password);

            documentStreams.Add(item1);
            JoinItem item2 = new JoinItem(openFile2, FileFormat.Docx, password);

            documentStreams.Add(item2);

            // Main method.
            DocumentResult result         = new DocumentHandler().Join(documentStreams);
            Stream         documentStream = result.Stream;
            var            fileStream     = File.Create(CommonUtilities.outputPath + "OutPut." + FileFormat.Docx);

            documentStream.CopyTo(fileStream);
            documentStream.Close();
            //ExEnd:JoinDocumentsOfKnownFormat
        }
예제 #11
0
        private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e state)
        {
            switch (state)
            {
            case SelectionState_e.UserPreSelect:
                if (!Filter?.Contains(selType) == true)
                {
                    return(false);
                }
                break;

            case SelectionState_e.UserPostSelect:
                var sel = FindLastObjectByMark(Mark);
                if (sel == Selection)
                {
                    sel = null;
                }
                Selection = sel;
                break;

            case SelectionState_e.ClearSelection:
                Selection = null;
                break;
            }

            return(true);
        }
        /// <summary>
        /// Splitting  by page ranges to several documents
        /// </summary>
        /// <param name="fileName">source file</param>
        public static void SplittingByPageRanges(string fileName)
        {
            //ExStart:SplittingByPageRanges
            string sourceFile = CommonUtilities.sourcePath + fileName;
            // Preparing.
            string       password     = "******";
            int          startPage    = 5;
            int          endPage      = 8;
            RangeMode    mode         = RangeMode.EvenPages;
            RangeOptions rangeOptions = new RangeOptions(startPage, endPage, mode);

            rangeOptions.Password   = password;
            rangeOptions.FileFormat = FileFormat.Pdf;
            Stream openFile = new FileStream(sourceFile, FileMode.Open);

            // Main method.
            MultiDocumentResult splitResult = new DocumentHandler().Split(openFile, rangeOptions);

            for (int i = 0; i < splitResult.Documents.Count; i++)
            {
                Stream documentStream = splitResult.Documents[i].Stream;
                //output file
                var fileStream = File.Create(CommonUtilities.outputPath + "OutPut " + i + "." + FileFormat.Pdf);
                documentStream.CopyTo(fileStream);
                documentStream.Close();
            }
            //ExEnd:SplittingByPageRanges
        }
        /// <summary>
        /// Splitting by page numbers to several one page documents
        /// </summary>
        /// <param name="fileName">source file</param>
        public static void SplittingToOnePageDocuments(string fileName)
        {
            //ExStart:SplittingToOnePageDocuments
            string sourceFile = CommonUtilities.sourcePath + fileName;
            // Preparing.
            string     password = "******";
            List <int> pages    = new List <int>();

            pages.Add(3);
            pages.Add(4);
            PagesOptions pagesSplitOptions = new PagesOptions(FileFormat.Pdf, password, pages);
            Stream       openFile          = new FileStream(sourceFile, FileMode.Open);

            // Main method.
            MultiDocumentResult splitResult = new DocumentHandler().Split(openFile, pagesSplitOptions);

            for (int i = 0; i < splitResult.Documents.Count; i++)
            {
                // First document
                Stream documentStream = splitResult.Documents[i].Stream;
                //output file
                var fileStream = File.Create(CommonUtilities.outputPath + "OutPut " + i + "." + FileFormat.Pdf);
                documentStream.CopyTo(fileStream);
                documentStream.Close();
            }
            //ExEnd:SplittingToOnePageDocuments
        }
        /// <summary>
        /// Remove range of pages from password-protected document of known format
        /// </summary>
        /// <param name="fileName">source file</param>
        public static void RemovePagesRangeFromProtectedKnownFormatDoc(string fileName)
        {
            //ExStart:RemovePagesRangeFromProtectedKnownFormatDoc
            string sourceFile = CommonUtilities.sourcePath + fileName;
            // Preparing.
            string       password     = "";
            int          startPage    = 2;
            int          endPage      = 4;
            RangeMode    mode         = RangeMode.AllPages;
            RangeOptions rangeOptions = new RangeOptions(startPage, endPage, mode);

            rangeOptions.Password   = password;
            rangeOptions.FileFormat = FileFormat.Docx;
            Stream openFile = new FileStream(sourceFile, FileMode.Open);

            // Main method.
            DocumentResult result         = new DocumentHandler().RemovePages(openFile, rangeOptions);
            Stream         documentStream = result.Stream;
            //output file
            var fileStream = File.Create(CommonUtilities.outputPath + "OutPut." + FileFormat.Docx);

            documentStream.CopyTo(fileStream);
            documentStream.Close();
            //ExEnd:RemovePagesRangeFromProtectedKnownFormatDoc
        }
예제 #15
0
        static void Main(string[] args)
        {
            try
            {
                //Check Correct Arguments and Log any Warning or Throw Exception for Error
                ArgumentsHandler.IsValidArguments(args);
            }
            catch (ArgumentException argsEx)
            {
                Console.WriteLine(argsEx.Message);
            }

            //Set Variables for Input and Output Directories
            string inputDir  = args[0];
            string outputDir = args[1];

            //Get All Gherkin Scripts Feature Wise : Dictionary{Feature:[gH1,gH2,..],...}
            Dictionary <string, string[]> FeatureTree = DirectoryHandler.GetAllGherkinScripts(inputDir);

            //Loop through the Dict and Generate FS for each Feature
            foreach (var dItem in FeatureTree)
            {
                var doc = DocX.Create(outputDir + dItem.Key + ".docx");

                foreach (string gherkinScript in dItem.Value)
                {
                    var feature = GherkinParserHandler.GetFeature(gherkinScript);

                    DocumentHandler.GenerateFeatureSpecDocument(feature, doc);
                }
            }
        }
예제 #16
0
        /// <summary>
        /// 得到地址
        /// </summary>
        /// <param name="info"></param>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static string GetDownLoadUrl(this BaseEntity info, string fileName)
        {
            var fullFileName = GetFullFileName(info, fileName);
            var url          = DocumentHandler.SignUrl(fullFileName);

            return(url);
        }
 private void FireEvent(DocumentHandler handler)
 {
     if (handler != null)
     {
         DocumentHandler eventHandler = handler;
         handler.Invoke(this, null);
     }
 }
예제 #18
0
 public void addDocumentHandler(DocumentHandler handler)
 {
     documentHandlers.Add(handler);
     if (DocumentHandlerAdded != null)
     {
         DocumentHandlerAdded.Invoke(this);
     }
 }
예제 #19
0
 private void OnIssuesDocDestroyed(DocumentHandler docHandler)
 {
     //destroying last document
     if (App.IFrameObject().GetModelWindowCount() == 1)
     {
         m_IssuesControl.DataContext = null;
     }
 }
예제 #20
0
 private void OnCustomPropertyModified(DocumentHandler docHandler, CustomPropertyModifyData[] modifications)
 {
     foreach (var mod in modifications)
     {
         App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' custom property '{mod.Name}' changed ({mod.Action}) in '{mod.Configuration}' to '{mod.Value}'",
                            (int)swMessageBoxIcon_e.swMbInformation, (int)swMessageBoxBtn_e.swMbOk);
     }
 }
예제 #21
0
        //private async Task<Microsoft.Graph.DriveItem> doUpload(string filePath, string fileName, string accessToken)
        //{
        //	string token = await getToken();

        //	var graphServiceClient = getClient(token);

        //	using (var file = System.IO.File.OpenRead(filePath))
        //	{
        //		MemoryStream stream = new MemoryStream();
        //		file.CopyTo(stream);


        //		autoOpen(stream);

        //		var documentFolder = await ODataHelper.PostFolder<OneDriveItem>(GraphApiHelper.GetOneDriveChildrenUrl(), token);


        //		var uploadSession = await graphServiceClient.Drives[documentFolder.ParentReference.DriveId].Items[documentFolder.Id].ItemWithPath(fileName).CreateUploadSession().Request().PostAsync();

        //		string ul = uploadSession.UploadUrl += "&$select=Id,ParentReference,WebUrl,WebDavUrl";

        //		var maxChunkSize = (320 * 1024) * 10; // 5000 KB - Change this to your chunk size. 5MB is the default.
        //		var provider = new ChunkedUploadProvider(uploadSession, graphServiceClient, stream, maxChunkSize);


        //		// Setup the chunk request necessities
        //		var chunkRequests = provider.GetUploadChunkRequests();
        //		var readBuffer = new byte[maxChunkSize];
        //		var trackedExceptions = new List<Exception>();
        //		DriveItem itemResult = null;

        //		//upload the chunks
        //		foreach (var request in chunkRequests)
        //		{
        //			// Do your updates here: update progress bar, etc.
        //			// ...
        //			// Send chunk request
        //			var result = await provider.GetChunkRequestResponseAsync(request, readBuffer, trackedExceptions);

        //			if (result.UploadSucceeded)
        //			{
        //				itemResult = result.ItemResponse;
        //			}
        //		}

        //		// Check that upload succeeded
        //		if (itemResult != null)
        //		{
        //			return itemResult;
        //		}
        //	}
        //	throw new ApplicationException("Upload failed.");
        //}



        public async Task <object> Post(OpenFile request)
        {
            string token = await getToken();

            //var formData = this.Request.FormData;
            //var cultureName = this.Request.FormData["cultureName"];
            //var client = this.Request.FormData["client"];
            //var domainHint = this.Request.FormData["domainHint"];
            //var userId = this.Request.FormData["userId"];
            //var appId = this.Request.FormData["appdId"];

            long uri = await getUriFromLinkFile(token);

            //var items = this.Request.FormData["items"];
            ////string token = await getToken();

            //var itemsArray = JArray.Parse(items);
            ////var itemsArray = (string[])Newtonsoft.Json.JsonConvert.DeserializeObject(items);


            //string response = await doOpenFromFileHandler(itemsArray.First().ToString(), token);

            //long uri = 0;
            //foreach (string line in response.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries))
            //{
            //	int idx = line.IndexOf("Uri=");

            //	if (idx > -1)
            //	{
            //		uri = Convert.ToInt64(line.Substring(idx + 4));
            //		break;
            //	}
            //}


            //if (uri == 0)
            //{
            //	throw new ApplicationException("Invalid request.");


            //	//	return documentResponse;
            //}
            //	else
            //{
            DocumentHandler documentHandler  = new DocumentHandler(this.Database, this.ServiceDefaults.UploadBasePath, uri);
            var             oneDrivedocument = await documentHandler.GetDocument(token);

            return(new HttpResult(HttpStatusCode.Redirect, "open document")
            {
                ContentType = "text/html",
                Headers =
                {
                    { HttpHeaders.Location, oneDrivedocument.WebUrl }
                },
            });

            //	}
        }
예제 #22
0
        /// <summary>
        /// Creates a new handler for SAX parser
        /// that can be used to parse embedded XML archives
        /// created by the {@code XMLEncoder} class.
        ///
        /// The {@code owner} should be used if parsed XML document contains
        /// the method call within context of the &lt;java&gt; element.
        /// The {@code null} value may cause illegal parsing in such case.
        /// The same problem may occur, if the {@code owner} class
        /// does not contain expected method to call. See details <a
        /// href="http://java.sun.com/products/jfc/tsc/articles/persistence3/">here</a>.
        /// </summary>
        /// <param name="owner">  the owner of the default handler
        ///               that can be used as a value of &lt;java&gt; element </param>
        /// <param name="el">     the exception handler for the parser,
        ///               or {@code null} to use the default exception handler </param>
        /// <param name="cl">     the class loader used for instantiating objects,
        ///               or {@code null} to use the default class loader </param>
        /// <returns> an instance of {@code DefaultHandler} for SAX parser
        ///
        /// @since 1.7 </returns>
        public static DefaultHandler CreateHandler(Object owner, ExceptionListener el, ClassLoader cl)
        {
            DocumentHandler handler = new DocumentHandler();

            handler.Owner             = owner;
            handler.ExceptionListener = el;
            handler.ClassLoader       = cl;
            return(handler);
        }
예제 #23
0
        private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e state)
        {
            if (state == SelectionState_e.NewSelection)
            {
                InvokeTrigger(Triggers_e.NewSelection);
            }

            return(true);
        }
        private void OpenLoaderFile(object obj)
        {
            if (!File.Exists(BuildSettings.LoaderPath))
            {
                TraceEngine.TraceError($"A file {BuildSettings.LoaderPath} nem található!");
                return;
            }

            DocumentHandler.OpenReadonlyDocument(BuildSettings.LoaderPath);
        }
예제 #25
0
 private void OnConfigurationChange(DocumentHandler docHandler, ConfigurationChangeState_e state, string confName)
 {
     if (state == ConfigurationChangeState_e.PostActivate)
     {
         if (docHandler.Model == m_App.IActiveDoc2)
         {
             InvokeTrigger(Triggers_e.ConfigurationChange);
         }
     }
 }
예제 #26
0
        public string MenuUrl()
        {
            var menu = new DocumentHandler(_context, "system").GetAll(DocCategory.Menu);

            if (menu != null && menu.Any())
            {
                return(menu.OrderByDescending(x => x.LastModified).First().Location);
            }
            return(string.Empty);
        }
예제 #27
0
        public async Task <Response> MergeFile(string fileName, string folderName, string sortOrder)
        {
            string logMsg  = "ControllerName: GroupDocsMergerController FileName: " + fileName + " FolderName: " + folderName;
            string fileExt = Path.GetExtension(fileName).Substring(1).ToLower();

            try
            {
                return(await ProcessTask(fileName, folderName, "." + fileExt, false, "", delegate(string inFilePath, string outPath, string zipOutFolder)
                {
                    if (!Directory.Exists(zipOutFolder))
                    {
                        Directory.CreateDirectory(zipOutFolder);
                    }
                    if (System.IO.File.Exists(outPath))
                    {
                        System.IO.File.Delete(outPath);
                    }

                    DirectoryInfo dir = System.IO.Directory.GetParent(inFilePath);
                    FileInfo[] files = dir.GetFiles().OrderBy(p => p.Name).ToArray();
                    List <Stream> documentStreams = new List <Stream>();

                    try
                    {
                        string[] arSortOrder = sortOrder.Split(',');
                        for (int i = 0; i < (arSortOrder.Length - 1); i++)
                        {
                            documentStreams.Add(new MemoryStream(System.IO.File.ReadAllBytes(files[Int32.Parse(arSortOrder[i]) - 1].FullName)));
                        }

                        DocumentResult result = new DocumentHandler().Join(documentStreams);
                        using (Stream documentStream = result.Stream)
                        {
                            using (var fileStream = System.IO.File.Create(outPath))
                            {
                                documentStream.CopyTo(fileStream);
                            }
                        }
                    }
                    finally
                    {
                        foreach (Stream stream in documentStreams)
                        {
                            stream.Dispose();
                        }
                    }
                }));
            }
            catch (Exception exc)
            {
                return(new Response {
                    FileName = fileName, FolderName = folderName, OutputType = fileExt, Status = exc.Message, StatusCode = 500, Text = exc.ToString()
                });
            }
        }
예제 #28
0
        internal EventsHandler(DocumentHandler docHandler)
        {
            if (!typeof(Delegate).IsAssignableFrom(typeof(TDel)))
            {
                throw new InvalidCastException($"{typeof(TDel).FullName} is not a delegate");
            }

            m_DocHandler = docHandler;

            m_IsSubscribed = false;
        }
예제 #29
0
        public static void GetSupportedFormats()
        {
            //ExStart:GetSupportedFormats
            Dictionary <string, FileFormat> documentFormatsContainer = new DocumentHandler().GetSupportedFormats();

            foreach (KeyValuePair <string, FileFormat> item in documentFormatsContainer)
            {
                Console.WriteLine("Key: {0}, format: {1}", item.Key, item.Value);
            }
            //ExEnd:GetSupportedFormats
        }
예제 #30
0
        private bool OnSave(DocumentHandler docHandler, string fileName, SaveState_e state)
        {
            if (state == SaveState_e.PreSave)
            {
                if (docHandler.Model == m_App.IActiveDoc2)
                {
                    InvokeTrigger(Triggers_e.DocumentSave);
                }
            }

            return(true);
        }
예제 #31
0
        private bool OnRebuild(DocumentHandler docHandler, RebuildState_e state)
        {
            if (state == RebuildState_e.PostRebuild)
            {
                if (docHandler.Model == m_App.IActiveDoc2)
                {
                    InvokeTrigger(Triggers_e.Rebuild);
                }
            }

            return(true);
        }
예제 #32
0
 /**
  * Register the SAX1 document event handler.
  *
  * <p>Note that the SAX1 document handler has no Namespace
  * support.</p>
  *
  * @param handler The new SAX1 document event handler.
  * @see org.xml.sax.Parser#setDocumentHandler
  */
 public void setDocumentHandler(DocumentHandler handler)
 {
     documentHandler = handler;
 }
예제 #33
0
 public DocumentBase()
 {
     Handler = new DocumentHandler();
 }