Example #1
0
        public static IONAPIFile LoadIONAPI(string aPath)
        {
            IONAPIFile result = new IONAPIFile();

            try
            {
                result.Load(aPath);
            }
            catch (Exception ex)
            {
                result = null;
            }

            return(result);
        }
Example #2
0
        public IONAPIFile Load(string aPath)
        {
            IONAPIFile result = null;

            using (StreamReader sr = new StreamReader(aPath))
            {
                string fileContents = sr.ReadToEnd();

                if (null != fileContents && fileContents.Length > 0)
                {
                    try
                    {
                        JsonConvert.PopulateObject(fileContents, this);
                        result = this;
                    }
                    catch (Exception ex)
                    {
                        ErrorException = ex;
                    }
                }
                sr.Close();
            }
            return(result);
        }