Reading embedded file

I included couple text files in my C# app by going to Tools | Projects, going to the Resources tab, clicking on "Add Resource" and selected "Add Existing File" and selected two existing text files.  In addition to showing
in the Resources pane, the files are also listed in the Resources folder in the Solution Explorer pane.
But, I'm unable to retrieve the files.  I found this code sample:
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
using (System.IO.Stream stream = assembly.GetManifestResourceStream(fileName))
using (System.IO.StreamReader reader = new System.IO.StreamReader(stream))
textFile = reader.ReadToEnd();
but, the file wasn't found.  After the GetExecutingAssembly statement, I added this statement:
string[] f = assembly.GetManifestResourceNames();
In examining the contents of f, the embedded text files are not listed.  There are 5 entries in f, 3 of them related to my EF model.  The other two entries are "TestPgm.g.resources" and "TestPgm.Properties.Resources.resources". 
(TestPgm is name of my project)
So, why aren't my embedded text files listed?
Anyone have any ideas of why I'm not able to access my embedded text files?
Thanks,
Richard

You should use the designer-generated Resources class to access your resources. It hides the details from you.  You only need to work with ResourceManager in cases where you don't have strongly typed access to a resource.
When you insert a resource the name of the resource is determined by taking the default namespace of the project (at the time of insertion) and appending that to the file name.  Once it is set it persists.  If you change the project default namespace
then the resource file is not changed.  This can cause resources to "disappear".  You can use a disassembler like JustDecompile to view the resources in your assembly and their names to help you get the correct name if needed.  But
prefer the Resources-generated class for general access.
Michael Taylor
http://blogs.msmvps.com/p3net

Similar Messages

  • How to read .xml file from embedded .swf(flash output) in captivate

    I have been trying to read .xml file from the .swf (Flash output) that is embedded within the captivate file but no luck yet . Please if anyone got any clue on how get this thing done using Action script 3.0 then let me know. I am using Adobe Captivate 5.5 at present and Flash CS 5.5.
    I am well aware about how to read .xml file through action script 3.0 in flash but when insert the same flash in captivate and publish nothing comes in captivate output. I would higly appreciate if anyone could help me out with that.
    Here is is graphical demonstration of my query :
    Message was edited by: captainmkv

    Hi Captainmkv,
    Does the information in this post cover what you're trying to do: http://forums.adobe.com/message/5081928#5081928
    Tristan,

  • Non reading embeded audio file

    Unable to read embeded audio file (mp3) in Windows seven with reader x (10.1.3) when I clickon it pdf file close immediately.
    Video files are read ok.
    Thnks in advance for answer.

    Would it be possible for you to share any such file.

  • Still cant open embedded files with Adobe Reader 10.0.1

    Hi!
    In the first version of Adobe Reader X you had to disable the Protection Mode in order to open PDF-files on a network drive or that are embedded in a i.e Word document.
    I have now upgraded my version to 10.0.1.
    The first issue seems to be solved (open files on a network drive). But I still cant open PDF files embedded in another file??
    I get the error message: The Program used to create this object is AcroExch. That program is either not installed on your computer or it is not responding. To edit this object, install AcroExch or ensure that any dialog boxes in AcroExch are closed.
    And if I try to embedd a PDF-file myself into a document I get the same result.
    As soon as I turn of the Protection Mode it works...
    Is there a way to keep the PM on and still be able to open documents???
    Regards Daniel

    I'm not sure why Adobe hasn't looked into this.  One description elsewhere in the forum seems to suggest that if the computer has had older versions of the reader installed, it will work -- somehow the embedded file needs an older registry key.  I have yet to try installing older versions of reader onto my machine.  This machine has only had reader 10 installed on it.
    I tried the recommendation that is given in another thread.  Turn off running reader in protected mode.  The first time I did it, it didn't work.  The second time I unchecked the "use in protected mode" box, I closed and then reopened reader.  Now I can open embedded pdfs in word.

  • Reasons why Reader couldn't open Embedded file?

    Installed the Writter in my computer. With file attachment tool, I embedded a file into a pdf file and send this pdf file to a colleague with only Reader installed in the computer. But he couldn't open the embedded file, why?

    In other words: your file associations are messed up.  See http://windows.microsoft.com/en-us/windows/change-file-open-program#1TC=windows-8

  • Problem with Embedded Files/Collections

    I have written a Pdf file (fragments below) to act a container to other pdf's. Initialy it all looks good, however when I click on the embedded file inside Acrobat Reader instead of displaying the contents I get a thumbnail of the acrobat logo with the Open and Save options underneath. If I click open it opens a new Reader window with the container file displayed again, not the embedded file. However if I click save it saves the embedded file down to disk correctly.
    How can I make it so that when the file is clicked in the attachments window it opens directly into the main reader window?
    5 0 obj
    <<
    /Params <<
    /Size 5298
    /ModDate (D:20081002163423+01)
    /CreationDate (D:20081002163423+01)
    >>
    /Length 5298
    /Type /EmbeddedFile
    /Subtype /application#2Fpdf
    >>
    stream
    endstream
    endobj
    6 0 obj
    <<
    /Type /Filespec
    /EF <<
    /F 5 0 R
    >>
    /F (Options Report.pdf)
    /Desc (Options Report)
    >>
    endobj
    7 0 obj
    <<
    /Type /Catalog
    /Pages 8 0 R
    /OpenAction[4 0 R /Fit]
    /Names << /EmbeddedFiles 9 0 R >>
    /Collection <</Type /Collection /View /T>>
    >>
    endobj
    9 0 obj
    << /Names [ (Options Report) 6 0 R ]
    >>
    endobj

    Leonard, I have uploaded the completed file to http://forum.planetpdf.com/webboard/wbpx.dll/~planetpdfforum/read?167447,3
    I could not see how to upload files to this forum.
    As stated above the file opens in Acrobat Reader v7 to the cover page, and allows the embedded files to be opened in seperate application windows, as it does in version 9. However under Acrobat Reader v8 when an embedded document is opened it just re-opens at the package level, not the embedded doc.
    Thank you in advance if you can look at this.

  • Extract All Embedded Files in All Folders and Save Each? Copy/Paste from PDF to Word?

    I have most of what I need here, but I’m missing 2 important pieces. 
    #1)  I want to copy/paste from all PDF files in a folder and paste the copied data into a single Word file. 
    It works fine if I have ONLY Word docs in my folder.  When I have PDF files and Word files, the contents of the Word files are copied in fine, but the contents of the PDF files seem to come in as Chinese, and there is no Chinese in
    the PDF, so I have no idea where that’s coming from.
    #2)  I want to extract all embedded files (in all my Word files) and save the extracted/opened file into the folder.  Some embedded files are PDFs and some are Excel files.
    Here the code that I’m working with now.
    Sub Foo()
    Dim i As Long
    Dim MyName As String, MyPath As String
    Application.ScreenUpdating = False
    Documents.Add
    MyPath = "C:\Users\001\Desktop\Test\" ' <= change this as necessary
    MyName = Dir$(MyPath & "*.*") ' not *.* if you just want doc files
    On Error Resume Next
    Do While MyName <> ""
    If InStr(MyName, "~") = 0 Then
    Selection.InsertFile _
    FileName:="""" & MyPath & MyName & """", _
    ConfirmConversions:=False, Link:=False, _
    Attachment:=False
    Dim Myshape As InlineShape
    Dim IndexCount As Integer
    IndexCount = 1
    For Each Myshape In ActiveDocument.InlineShapes
    If Myshape.AlternativeText = PDFname Then
    ActiveDocument.InlineShapes(IndexCount).OLEFormat.Activate
    End If
    IndexCount = IndexCount + 1
    Next
    Selection.InsertBreak Type:=wdPageBreak
    End If
    On Error Resume Next
    Debug.Print MyName
    MyName = Dir ' gets the next doc file in the directory
    Loop
    End Sub
    If this has to be done using 2 Macros, that’s fine. 
    If I can do it in 1, that’s great too.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Hi ryguy72,
    >>When I have PDF files and Word files, the contents of the Word files are copied in fine, but the contents of the PDF files seem to come in as Chinese, and there is no Chinese in the PDF, so I have no idea where that’s coming from.<<
    Based on the code, you were insert the file via the code Selection.InsertFile. I am trying to reproduce this issue however failed. I suggest that you insert the PDF file manually to see whether this issue relative to the specific file. You can insert PDF
    file via Insert->Text->Object->Text from file.
    If this issue also could reproduced manually, I would suggest that you reopen a new thread in forum to narrow down whether this issue relative to the specific PDF file or Word application.
    >> I want to extract all embedded files (in all my Word files) and save the extracted/opened file into the folder.  Some embedded files are PDFs and some are Excel files.<<
    We can save the embedded spreadsheet via Excel object model. Here is an example that check the whether the inlineshape is an embedded workbook and save it to the disk for you reference:
    If Application.ActiveDocument.InlineShapes(1).OLEFormat.ClassType = "Excel.Sheet.12" Then
    Application.ActiveDocument.InlineShapes(1).OLEFormat.DoVerb xlPrimary
    Application.ActiveDocument.InlineShapes(1).OLEFormat.Object.SaveAs "C:\workbook1.xlsx"
    Application.ActiveDocument.InlineShapes(1).OLEFormat.Object.Close
    End If
    And since the Word object model doesn't provide API to save the embedded PDF, I would suggest that you get more effective response from PDF support forum to see whether it supports automation. If yes, we can export the PDF as embedded spreadsheet like code
    absolve.
    Hope it is helpful.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • MacBook Air with Mavericks: how do I download a web based Word doc with embedded Word files. At moment I cannot access the embedded files on the web (NHS mail) but can on a PC.  Help please.

    MacBook Air with Mavericks.  I need to download agendas with embedded files. This is through an encrypted email account. My Mac is blocked from even opening the embedded files on line and I can't save any of this to my laptop.  It works fine on my PC laptop.  Help please.  I know this is a problem for other people too, but would love the solution!

    Gee, Pat, this is a  real big help.
    Nobody could possibly think anyone would ask for help without first trying to fix the issue oneself. Or maybe you do. I have opened the file and looked under security. I have changed it to owner-notebook (which is what the techs called me) and clicked accept but geepers it didn't work.
    Maybe someone else has an idea.
    Take Ownership of a File or Folder
    The above should be a link. At least I copied and pasted the link. I did what was stated in there. It isn't like brain surgery. But it is not working. I ended up being able to open some pdf files after transferring them from one partition category to another. I wish it was that easy as you seem to think.
    Thanks for the help. Have a great year.

  • Embedding files into a .pdf file

    How do I embed files into a .pdf file?  It worked in word but when I converted to .pdf format, I lost the ability to open the embedded file with a click...

    Challenge no. 2 below Pat.  Thanks!
    Dave Janzow
    Director, Business Development, Life Sciences
    UNITRANS INTERNATIONAL CORPORATION
    peace of mind > every time
    [private information removed by moderator]
    All business transactions are based on Unitrans Intl Corporation's terms and conditions, available on request.
    Unitrans Intl Corp. is a certified member of C-TPAT (Customs Trade Partnership against Terrorism).
    Our SVI number for Customs House Brokerage is: unibro00850.
    Please refer to our website for further information on the C-TPAT program.

  • FB 4.7 publish in flashIDE workers not sending/receiving + FB 4.7 access to embedded files

    Alright, this have been a painful day trying to solve this and I am pulling my hair out.
    So I decided to download the FB4.7 trial for some test with AIR13, and after an indecent amount of hours trying to install the latest player and android sdk (why the hell isn't it like in the IDE?), I have 2 major issues and so far not impressed at all by FB4.7.
    I have developped a project using the Flash IDE. Everything works perfectly BUT the workers. I don't get any error message, and my app doesn't trace the messages I'm supposed to receive from a worker. To be sure I coded that properly, I created a test project in FB4.7, copied pasted my code and my worker is working and I can trace messages sent and received from the worker to my main app. Why don't i see these traces when I fire my app from the IDE ? If i can't test workers in the IDE, this is a major issue. It doesn't even throw any error, just doesn't trace anything.
    Sooooo because It wouldn't work in the IDE, I copied my files to another location, created a project in FB4.7. If I run/debug in FB4.7 the worker works, but now I am unable to access embedded files in the app. In Flash IDE, I embed a folder that contains a bunch of files, and can access the file with 'app:/folder/file', which was very usefull because I have a ton of assets and this is the softest solution not to have a stupid class with 200 [Embed.. ] ******** hardcoded lines.
    So question 1 : how to have worker working in Flash IDE ?
    And question 2, if question 1 is a no go : since I do not want to modify my working code (in the IDE), how can I have the same behavior debugging from FB4.7 when it comes to using 'app:/' ?
    Also, just a notice about this sketchy forums, If I go back to my own post, the view count increment (lol). Let me know if this is coded in CF cause it looks like someone doesn't know about sessions

    Did you find a solution for this?

  • Is there a way to view embedded files in a Word doc that you have PDF'd?

    We embed as objects different types of files (i.e, pdf, excel, etc.) into our word documents.  When those documents are PDF'd, you cannot open the files as they become pictures.  Is there anyway I can have the embedded files open in PDF as they do in the Word document?

    You can embed PDF file in word document by converting PDF to Doc, for this conversion you need PDF to Doc converter.
    Or you can also embed PDF file in word as image by convert PDF to Image and attach image of PDF page in Doc, for this conversion you need PDF to Image converter.
    There are many PDF converter available on web that can perform this conversion like Adobe Acrobat, Nitro and Classic PDF etc. I am using classic PDF, it can easily perform both of above conversion along with many other features. It is reliable and afordable PDF software.
    If you have any question feel free to ask.

  • InDesign asking for location of embedded files

    I embedded two links in an InDesign document before I sent them to another designer, so I would only have to send one file and not 3. However, the designer called to say InDesign was asking him to locate the embedded files or something, and he couldn't work with the document. Does anyone know why InDesign would ask to locate the files even though they've been embedded?

    I didn't have any problems when I saved the file to another folder and reopened it from there. I'm sure I didn't copy/paste the files - they were originally linked, before i right-clicked on them in the links panel and chose 'embed file'. The icons beside the files in the links panel indicate that the files are embedded. I also checked my sent emails and opened the file that I had sent them, which had the files embedded and not linked.
    I still don't know why this happened - maybe the other designers were trying to unembed the files and didn't understand the message that pops up when you attempt to do so... but even then you can choose to extract the embedded files from the InDesign doc to a specified location; you don't have to link to the originals.
    Thanks for everyone's help, though. I ended up getting around the issue by just zipping the files.

  • Reading .chm files

    I recently took the plunge and purchased a Macbook Pro and yes it is a dream!
    That said I had problems reading .chm files to which one of the discussion forum users alerted me to something called a .chmox reader.
    Whilst the chmox viewer serves my immediate needs i.e. allows me to view my .chm application; this application has files/application icons/objects embedded in it e.g. .xls, .doc & .ppt files which on my windows PC I was able to click on and open.
    My problem now is that it is a viewer which means that I can see these objects but cannot launch them.
    Does anyone have any ideas as to how I can solve this problem?
    Leo.

    Are you using this reader? http://chomx.sourceforge.net/
    To view XLS, DOC and PPT files you will need MS Office or one of the open source office suites like OpenOffice.org or, its cousin, NeoOffice.

  • Color space of embedded files

    Is there a way to determine the color space of a file that is embedded in Illustrator?

    Usually an embedded file is the same color space as the AI file.
    Only when you open a PDF generated elsewhere this might also be something like multichannel.

  • Embedded files 'disappear' when viewing signed version of a document

    Hello,
    We've just come across a weird issue when viewing signed documents containing embedded files in Adobe Reader. If we use the 'Click to view this version' link in the Signatures panel, the embedded files are not shown in the Attachments panel, even though they are covered by the signature.
    I've uploaded a sample document that illustrates the issue to Google Drive, here is the link: https://drive.google.com/file/d/0B1wk9toh5e7AZVBIb2V6a2lDMWM/view?usp=sharing
    Thanks,
    Ken

    "View this version" comes with a disclaimer in the top bar that most functions are disabled in this view. If attachments are shown in the "Attachments" panel, then they can be opened
    (otherwise what's the point to show them at all), and Acrobat uses a default app for this MIME type (i.e. Notepad for .txt files) to open it and has no control what the user could do there. User could definitely copy this file to a different location and this is akin to copying some of he PDF's content which is a prohibited operation in this view.
    You can treat the disclaimer in the top bar as the Adobe official statement along with my read on what it means with respect to annotations.
    IMO to "View this version" for the last signature when there are no changes after the file was signed is meaningless because both versions are identical. It is only when some changes were made after a signature that you may want/need to view the signed version.

Maybe you are looking for

  • Does new 30 GB iPod have longer battery life than original 5th gen 30

    The claim from Apple is that the new 30 GB iPod has a brighter screen and that the battery life during video playback is 3.5 hours. The original 5th generation 30 GB ipod only claimed to have 2 hour battery life during video playback. Does anyone kno

  • Publish options stay grey?

    Hi, I successfully launched two sites, I have built a third that is ready to launch but the publish and visit option buttons are greyed out, the same applies for the drop down menu, I also have a blue dot next to each of the first two sites in the si

  • ESB SOA FTP adapter

    Can someone please explain to me the following error? Designtime cache has not been initialized Please look in logs for following signs of failure. Fix them and restart. (a) Database access errors (b) ESB Bootstrap errors (c) OC4J class load errors (

  • Business to Authority Manager Error - Efiling

    Hi, We are running the EOY and later went to B2A manager and found the following error description. No answer from Government Gateway received Error during XML=>ABAP conversion:Response Message;CX_ST Match element in line 2371 system expected the ele

  • Airport Express can only extend network, not create new one. Why?

    I am sharing a flat with some friends. The shared broadband router is placed in the living room. To strengthen the signal and make it easier for me to manage, I bought an Airport Express, connected it to the shared router with an ethernet cable and s