コード例 #1
0
        public static TextDemoSettings RecallSettings()
        {
            TextDemoSettings settings    = new TextDemoSettings();
            string           applDataDir = TextDemoSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "TextDemoSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (File.Exists(applStatePath) == true)
            {
                try
                {
                    using (XmlTextReader tr = new XmlTextReader(applStatePath))
                    {
                        settings.ReadXml(tr);
                    }
                }
                catch (Exception)
                {
                    settings = new TextDemoSettings();
                }
            }

            return(settings);
        }
コード例 #2
0
        public static ClientSettings RecallSettings()
        {
            ClientSettings settings    = new ClientSettings();
            string         applDataDir = ClientSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "ClientSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (System.IO.File.Exists(applStatePath) == true)
            {
                try
                {
                    using (XmlTextReader tr = new XmlTextReader(applStatePath))
                    {
                        settings.ReadXml(tr);
                    }
                }
                catch (Exception excp)
                {
                    Debug.Print(excp.ToString());
                    throw excp;
                }
            }

            return(settings);
        }
コード例 #3
0
        public static CopyPasteList RecallCopyPasteList()
        {
            CopyPasteList copyPasteList = null;
            string        applDataDir   = CopyPasteList.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "CopyPasteList.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (File.Exists(applStatePath) == true)
            {
                try
                {
                    using (var tr = new XmlTextReader(applStatePath))
                    {
                        copyPasteList = CopyPasteList.FromXml(tr);
                    }
                }
                catch (Exception excp)
                {
                    Debug.Print(excp.ToString());
                    throw excp;
                }
            }
            return(copyPasteList);
        }
コード例 #4
0
        /// <summary>
        /// check that settings exist for the appl.
        /// </summary>
        /// <returns></returns>
        public static bool SettingsExist()
        {
            TextDemoSettings settings    = new TextDemoSettings();
            string           applDataDir = TextDemoSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "TextDemoSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (File.Exists(applStatePath) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        /// <summary>
        /// check that settings exist for the appl.
        /// </summary>
        /// <returns></returns>
        public static bool SettingsExist()
        {
            ClientSettings settings    = new ClientSettings();
            string         applDataDir = ClientSettings.BuildApplDataDir();

            Pather.AssureDirectoryExists(applDataDir);
            string applStateFileName = "ClientSettings.xml";
            string applStatePath     = Path.Combine(applDataDir, applStateFileName);

            if (System.IO.File.Exists(applStatePath) == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        public static void WriteCaptureDoc(
            this PresentationSpace Space, string CaptureFolderPath, string LongName, string WindowText)
        {
            var xe = Space.ToXElement("PresentationSpace");

            XDocument xdoc = new XDocument(
                new XDeclaration("1.0", "utf-8", "yes"),
                new XComment("display session presentation space"),
                new XElement("ScreenCapture",
                             xe,
                             new XElement("LongName", LongName),
                             new XElement("WindowText", WindowText))
                );

            // setup the capture file name.
            var    nowDate  = DateTime.Now;
            string fullPath = CaptureFolderPath;

            // year name.
            {
                string yearName = nowDate.ToString("yyyy");
                fullPath = System.IO.Path.Combine(fullPath, yearName);
                Pather.AssureDirectoryExists(fullPath);
            }

            // month name.
            {
                string monthName = nowDate.ToString("MMMM");
                fullPath = System.IO.Path.Combine(fullPath, monthName);
                Pather.AssureDirectoryExists(fullPath);
            }

            // day name.
            {
                string dayName = nowDate.ToString("dd");
                fullPath = System.IO.Path.Combine(fullPath, dayName);
                Pather.AssureDirectoryExists(fullPath);
            }

            // hour name.
            {
                string hourName = nowDate.ToString("hh");
                fullPath = System.IO.Path.Combine(fullPath, hourName);
                Pather.AssureDirectoryExists(fullPath);
            }

            // session name.
            {
                fullPath = System.IO.Path.Combine(fullPath, LongName);
                Pather.AssureDirectoryExists(fullPath);
            }

            // file name.
            {
                string fileName = "Capture_" + LongName + "_" + nowDate.ToString("HH.mm.ss") + ".xml";
                fullPath = System.IO.Path.Combine(fullPath, fileName);
            }

            // save the document
            xdoc.Save(fullPath);
        }