bool Load(string filePath)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(doc));

            try
            {
                using (var fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read))
                {
                    XmlDoc = serializer.Deserialize(fs) as doc;
                    return(XmlDoc != null);
                }
            }
            catch (Exception ex) when(ex is ArgumentException || ex is System.IO.IOException || ex is System.Security.SecurityException)
            {
                Trace.TraceWarning("Cannot locate the doc xml of the assembly: " + ex.ToString());
                return(false);
            }
        }
Example #2
0
        bool Load(string filePath)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(doc));
            try
            {
                using (var fs = new System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read))
                {
                    XmlDoc = serializer.Deserialize(fs) as doc;
                    System.Diagnostics.Debug.Assert(XmlDoc != null);
                    return true;
                }

            }
            catch (Exception ex) when (ex is ArgumentException || ex is System.IO.IOException || ex is System.Security.SecurityException)
            {
                Trace.TraceError(ex.ToString());
                return false;
            }
        }