Ejemplo n.º 1
0
        public static IVLConfig getInstance()
        {
            try
            {
                if (_ivlConfig == null)
                {
                    try
                    {
                        Type     t        = typeof(IVLConfig);
                        FileInfo filePath = new FileInfo(fileName);
                        {
                            if (filePath.IsReadOnly)
                            {
                                filePath.IsReadOnly = false;
                            }
                        }
                        _ivlConfig = (IVLConfig)XmlConfigUtility.Deserialize(t, fileName);
                    }
                    catch (Exception)
                    {
                        Type t = typeof(IVLConfig);

                        _ivlConfig = new IVLConfig();

                        {
                            // This below code has been changed by darshan on 17-mar-2016 handle the situation when the config file has been corrupted to retrive the data from the backup config file.
                            if (File.Exists(IVLVariables.backupConfigFile))
                            {
                                _ivlConfig = (IVLConfig)XmlConfigUtility.Deserialize(t, IVLVariables.backupConfigFile);
                            }
                            else
                            {
                                XmlConfigUtility.Serialize(_ivlConfig, IVLVariables.backupConfigFile);
                            }
                            XmlConfigUtility.Serialize(_ivlConfig, fileName);
                        }
                    }
                }
                return(_ivlConfig);
            }
            catch (Exception ex)
            {
                Common.ExceptionLogWriter.WriteLog(ex, Exception_Log);
                return(_ivlConfig);
            }
        }
Ejemplo n.º 2
0
 public static void ResetIVLConfig()
 {
     _ivlConfig = null;
 }