Пример #1
0
        private string GetSettingsPath()
        {
            string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string fullSettingsFilePath = assemblyFolder + "\\" + settingsFileName;

            if (!File.Exists(fullSettingsFilePath))
            {
                fullSettingsFilePath = GetApplicationPath() + "Cache\\" + settingsFileName;

                if (!File.Exists(fullSettingsFilePath))
                {
                    return(null);
                }
            }
            else
            {
                string cacheFolder = CustomDataManager.GetApplicationPath() + "Cache\\";

                if (!File.Exists(cacheFolder))
                {
                    Directory.CreateDirectory(cacheFolder);
                }

                string newFile = cacheFolder + settingsFileName;

                File.Copy(fullSettingsFilePath, newFile, true);
            }

            return(fullSettingsFilePath);
        }
Пример #2
0
        private string GetCacheFile(string fileName)
        {
            string fullFileName = CustomDataManager.GetApplicationPath() + "Cache\\" + fileName;

            if (!File.Exists(fullFileName))
            {
                return(null);
            }

            return(fullFileName);
        }
Пример #3
0
        /// <summary>
        /// Save file to cache for using when public storage is unassessable.
        /// </summary>
        /// <param name="fileName"></param>
        private void SaveFileToCache(string fileName)
        {
            try
            {
                string cacheFileName = Path.GetFileName(fileName);

                string cacheFolder = CustomDataManager.GetApplicationPath() + "Cache\\";

                string newFile = cacheFolder + cacheFileName;

                if (!File.Exists(cacheFolder))
                {
                    Directory.CreateDirectory(cacheFolder);
                }

                File.Copy(fileName, newFile, true);
            }
            catch (Exception ex)
            {
            }
        }
Пример #4
0
        /// <summary>
        /// Constructor of class
        /// </summary>
        public LocalOperator()
        {
            storagePath = CustomDataManager.GetApplicationPath();

            stringParameterFileExtention = CustomDataManager.settings.localStorageFileExtention;
        }