Exemplo n.º 1
0
 /// <summary>
 /// Deserializes xml markup from file into an XPath object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output XPath object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out XPath obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(XPath);
     try {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (System.Exception ex) {
         exception = ex;
         return(false);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Deserializes workflow markup into an XPath object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output XPath object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out XPath obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(XPath);
     try {
         obj = Deserialize(xml);
         return(true);
     }
     catch (System.Exception ex) {
         exception = ex;
         return(false);
     }
 }
Exemplo n.º 3
0
        public static bool TryGetRomLocation(RomVersion input, out string path)
        {
            var   key   = input.UniqueKey;
            XPath rPath = settings.Rom.SingleOrDefault(x => x.key == key);

            if (rPath == null)
            {
                path = "";
                return(false);
            }

            path = rPath.Value;
            return(File.Exists(path));
        }
Exemplo n.º 4
0
        public static void SetRomLocation(RomVersion version, string path)
        {
            var   key     = version.UniqueKey;
            XPath romPath = settings.Rom.SingleOrDefault(x => x.key == key);

            if (romPath == null)
            {
                romPath = new XPath
                {
                    key = key
                };
                settings.Rom.Add(romPath);
            }
            romPath.Value = path;
            settings.SaveToFile(XML_NAME);
        }
Exemplo n.º 5
0
        public static void SetRomLocation(string key, RomVersion version, string path)
        {
            XPath romPath;

            romPath = settings.Rom.SingleOrDefault(x => x.key == key);

            if (romPath == null)
            {
                romPath = new XPath
                {
                    key     = key,
                    game    = version.Game.ToString(),
                    version = version.ToString()
                };
                settings.Rom.Add(romPath);
            }
            romPath.Value = path;
            settings.SaveToFile(XML_NAME);
        }
Exemplo n.º 6
0
 public static bool LoadFromFile(string fileName, out XPath obj)
 {
     System.Exception exception = null;
     return(LoadFromFile(fileName, out obj, out exception));
 }
Exemplo n.º 7
0
 public static bool Deserialize(string xml, out XPath obj)
 {
     System.Exception exception = null;
     return(Deserialize(xml, out obj, out exception));
 }