Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

recsidfile.cpp

Go to the documentation of this file.
00001 
00011 #include "recsidfile.h"
00012 #include <e32svr.h>
00013 #include <s32file.h>
00014 #include <f32file.h>
00015 #include <apaid.h>
00016 #include <apacmdln.h>
00017 #include <apgcli.h>
00018 
00019 
00025 #ifdef _UNICODE
00026 const TUid KUidSidPlayer = {0x10009a97}; // unicode
00027 #else
00028 const TUid KUidSidPlayer = {0x10009a96}; // narrow
00029 #endif
00030 
00031 _LIT8(KRecSidSignature, "PSID");
00032 
00033 
00034 CApaFileRecognizerType::TRecognizedType CRecSidFile::DoRecognizeFileL(RFs& aFs, TUidType /*aType*/)
00038         {
00039         iRecognizedType = ENotRecognized;
00040 
00041         // SID files are recognized by contents, not by extension!
00042         RFile file;
00043         if(file.Open(aFs, *iFullFileName, EFileShareReadersOnly) != KErrNone)
00044                 return iRecognizedType;
00045         TBuf8<1024> buf;
00046         TInt err = file.Read(buf);
00047         file.Close();
00048         if (err!=KErrNone)
00049                 return iRecognizedType;
00050         if (buf.FindF(KRecSidSignature) != KErrNotFound)
00051                 {
00052                 iRecognizedType = EDoc;
00053                 iAppUid = KUidSidPlayer;
00054                 return iRecognizedType;
00055                 }
00056         return iRecognizedType;
00057         }
00058 
00059 
00060 TThreadId CRecSidFile::RunL(TApaCommand aCommand, const TDesC* aDocFileName, const TDesC8* aTailEnd) const
00061         {
00062         CApaCommandLine* commandLine = CApaCommandLine::NewLC();
00063         commandLine->SetCommandL(aCommand);
00064         if(iRecognizedType == EDoc)
00065                 {
00066                 // We've recognised a doc so we need to scan for its associated app
00067                 TApaAppEntry appEntry;
00068                 User::LeaveIfError(iFileRecognizer->AppLocator()->GetAppEntryByUid(appEntry,iAppUid));
00069                 commandLine->SetLibraryNameL(appEntry.iFullName);
00070                 if(aDocFileName)
00071                         commandLine->SetDocumentNameL(*iFullFileName);
00072                 }
00073         else
00074                 User::Leave(KErrNotSupported);
00075 
00076 //      if (aTailEnd)
00077 //              commandLine->SetTailEndL(*aTailEnd);
00078         TThreadId id = AppRunL(*commandLine);
00079         CleanupStack::PopAndDestroy(); // commandLine
00080         return id;
00081         }
00082 
00083 
00084 EXPORT_C CApaFileRecognizerType* CreateRecognizer()
00092         {
00093         return new CRecSidFile();
00094         }
00095 
00096 
00097 GLDEF_C TInt E32Dll(TDllReason /*aReason*/)
00101         {
00102         return KErrNone;
00103         }
00104 
00105 
00106 // EOF - recsidfile.cpp

Generated on Tue Feb 8 04:13:59 2005 for Esidplay by doxygen 1.3.3