Exemplo n.º 1
0
        private AddinAppData()
        {
            var fullFileName = string.Empty;

            try
            {
                var appDataFolder = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), COMPANY_FOLDER);
                appDataFolder = Path.Combine(appDataFolder, DATA_FILE_NAME);
                fullFileName  = appDataFolder;

                _addinDataStoreFile = new FileInfo(fullFileName);
                _addInProperties    = new AddinProperties();
                if (_addinDataStoreFile.Exists)
                {
                    var serializer = new XmlSerializer(typeof(AddinProperties));
                    var tr         = new StreamReader(_addinDataStoreFile.FullName);
                    _addInProperties = (AddinProperties)serializer.Deserialize(tr);
                    tr.Close();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Filename: " + fullFileName, ex);
            }
        }
Exemplo n.º 2
0
        private AddinAppData()
        {
            var fullFileName = string.Empty;
            try
            {
                var appDataFolder = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), COMPANY_FOLDER);
                appDataFolder = Path.Combine(appDataFolder, DATA_FILE_NAME);
                fullFileName = appDataFolder;

                _addinDataStoreFile = new FileInfo(fullFileName);
                _addInProperties = new AddinProperties();
                if (_addinDataStoreFile.Exists)
                {
                    var serializer = new XmlSerializer(typeof (AddinProperties));
                    var tr = new StreamReader(_addinDataStoreFile.FullName);
                    _addInProperties = (AddinProperties) serializer.Deserialize(tr);
                    tr.Close();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Filename: " + fullFileName, ex);
            }
        }