Esempio n. 1
0
        /// <summary>
        /// The method that is asynchronously called by the UI when a button is pressed.
        /// </summary>
        /// <param name="dfirRoot">The <see cref="IDfirRoot"/> provided by the DfirExport tool.</param>
        public void AcceptDfirRoot(IDfirRoot dfirRoot)
        {
            // Open a file
            if (!Directory.Exists(folderName))
            {
                Directory.CreateDirectory(folderName);
            }
            var writer = new StreamWriter(Path.Combine(folderName, dfirRoot.Name + ".xml"));

            //  Call the XML generator with the top level block diagram
            // This is recursively call itself to print out the various structures found.
            IDiagram diag = dfirRoot.BlockDiagram;

            writer.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
            xg(0, writer, (dynamic)diag, "");

            // Close the file handle
            writer.Close();
        }
Esempio n. 2
0
        /// <summary>
        /// The method that is asynchronously called by the UI when a button is pressed.
        /// </summary>
        /// <param name="dfirRoot">The <see cref="IDfirRoot"/> provided by the DfirExport tool.</param>
        public void AcceptDfirRoot(IDfirRoot dfirRoot)
        {
            // Open a file
            const string folderName = @"C:\MYFiles";

            if (!Directory.Exists(folderName))
            {
                Directory.CreateDirectory(folderName);
            }
            var writer = new StreamWriter(Path.Combine(folderName, dfirRoot.Name + ".dot"));

            // Write the dotstring to the file
            writer.Write(dfirRoot.DotString);

            // Close the file
            writer.Close();

            // Open a new Windows Explorer window with the foldername as the current directory.
            // Process.Start(folderName);
        }