Пример #1
0
        /// <summary>
        /// Jonathan Sanborn
        ///
        /// Saves the passed in Problem set to the XML
        /// </summary>
        /// <param name="problemSet">The Problem set to save</param>
        public void SaveNewProblemSet(ProblemSet problemSet)
        {
            string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

            try
            {
                XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                if (problemSetFile != null)
                {
                    problemSetFile.Element("ProblemSets").Add(problemSet.GetXMLNode());
                    problemSetFile.Save(fileName);
                }
            }
            catch (FileNotFoundException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
        }
Пример #2
0
            /// <summary>
            /// Jonathan Sanborn
            /// 
            /// Updates the XML of the passed in problem Set
            /// </summary>
            /// <param name="problemSet">The problem set to update</param>
            public void UpdateProblemSet(ProblemSet problemSet)
            {
                string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

                try
                {
                    XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                    if (problemSetFile != null)
                    {
                        try
                        {
                            problemSetFile.Descendants("ProblemSet").First(s => s.Element("ID").Value == problemSet.ID).ReplaceWith(problemSet.GetXMLNode());
                            problemSetFile.Save(fileName);
                        }
                        catch (ArgumentNullException ex)
                        {
                            System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed null referance.\n" + ex.Message);
                        }
                        catch (InvalidOperationException ex)
                        {
                            System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed Invalid Operation.\n" + ex.Message);
                        }
                    }

                }
                catch (FileNotFoundException ex)
                {
                    System.Diagnostics.Debug.Write(ex.Message);
                }
            }
Пример #3
0
            /// <summary>
            /// Jonathan Sanborn
            /// 
            /// Saves the passed in Problem set to the XML
            /// </summary>
            /// <param name="problemSet">The Problem set to save</param>
            public void SaveNewProblemSet(ProblemSet problemSet)
            {
                string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

                try
                {
                    XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                    if (problemSetFile != null)
                    {
                        problemSetFile.Element("ProblemSets").Add(problemSet.GetXMLNode());
                        problemSetFile.Save(fileName);
                    }
                }
                catch (FileNotFoundException ex)
                {
                    System.Diagnostics.Debug.Write(ex.Message);
                }
            
            }
Пример #4
0
        /// <summary>
        /// Jonathan Sanborn
        ///
        /// Updates the XML of the passed in problem Set
        /// </summary>
        /// <param name="problemSet">The problem set to update</param>
        public void UpdateProblemSet(ProblemSet problemSet)
        {
            string fileName = Path.Combine(filePath, Properties.Settings.Default.problemSetsFilename);

            try
            {
                XDocument problemSetFile = OpenFile(fileName, MMFileType.ProblemSet);

                if (problemSetFile != null)
                {
                    try
                    {
                        problemSetFile.Descendants("ProblemSet").First(s => s.Element("ID").Value == problemSet.ID).ReplaceWith(problemSet.GetXMLNode());
                        problemSetFile.Save(fileName);
                    }
                    catch (ArgumentNullException ex)
                    {
                        System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed null referance.\n" + ex.Message);
                    }
                    catch (InvalidOperationException ex)
                    {
                        System.Diagnostics.Debug.Write(DateTime.Now.ToString() + " UpdateUser failed Invalid Operation.\n" + ex.Message);
                    }
                }
            }
            catch (FileNotFoundException ex)
            {
                System.Diagnostics.Debug.Write(ex.Message);
            }
        }