Ejemplo n.º 1
0
        public CodeCampService(string baseUrl, string campKey)
        {
            // ideally each app would just send in its folder path or helper instead of doing it this way
            // including this as a example of how to use compiler directives in shared layers
            #if WINDOWS_PHONE
            _fileHelper = new IsolatedStorageFileSystemHelper();
            #elif __ANDROID__
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../cache");
            _fileHelper = new StandardFileSystemHelper(folderPath);
            #else
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../Library/Caches");
            _fileHelper = new StandardFileSystemHelper(folderPath);
            #endif

            _fileName = campKey + ".xml";
            Repository = new CodeCampRepository(null);
            _client = new CodeCampDataClient(baseUrl, campKey);

            if (!_fileHelper.FileExists(_fileName))
            {
                downloadNewXmlFile();
            }
            else
            {
                Repository = new CodeCampRepository(_fileHelper.ReadFile(_fileName));
            }
        }
Ejemplo n.º 2
0
        public CodeCampService(string baseUrl, string campKey)
        {
            // ideally each app would just send in its folder path or helper instead of doing it this way
            // including this as a example of how to use compiler directives in shared layers
#if WINDOWS_PHONE
            _fileHelper = new IsolatedStorageFileSystemHelper();
#elif __ANDROID__
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../cache");
            _fileHelper = new StandardFileSystemHelper(folderPath);
#else
            string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                             "../Library/Caches");
            _fileHelper = new StandardFileSystemHelper(folderPath);
#endif

            _fileName  = campKey + ".xml";
            Repository = new CodeCampRepository(null);
            _client    = new CodeCampDataClient(baseUrl, campKey);

            if (!_fileHelper.FileExists(_fileName))
            {
                downloadNewXmlFile();
            }
            else
            {
                Repository = new CodeCampRepository(_fileHelper.ReadFile(_fileName));
            }
        }
Ejemplo n.º 3
0
        public IFileConverter ParseFile(string path)
        {
            if (!_fileSystemHelper.FileExists(path))
            {
                return(null);
            }

            if (path.EndsWith(".m6raw", StringComparison.InvariantCultureIgnoreCase))
            {
                return(new RawFloatPCMFileConverter(path, _fileSystemHelper));
            }

            if (path.EndsWith(".raw", StringComparison.InvariantCultureIgnoreCase))
            {
                return(new RawPCMFileConverter(path, _fileSystemHelper));
            }

            else if (path.EndsWith(".mp3", StringComparison.InvariantCultureIgnoreCase))
            {
                return(new MP3FileConverter(path, _fileSystemHelper));
            }

            else
            {
                return(null);
            }
        }