c# - How can I upload and read a file on a raspberry pi running Windows 10 IoT -
i have built app read config file , load dictionary based on xml. want not need add file program. instead want able upload pi3 , tell program refresh , read file uploaded. loads file included code obscure folder.
how can upload , specify path in code folder easier to.
thanks in advance
use windows.storage namespace , following below code creating,accessing , other operations these in folder , files on uwp.
//get installation folder current application storagefolder rootfolder = applicationdata.current.localfolder; //create folder in root folder of app if not exist , open if exist. storagefolder folder = await rootfolder.createfolderasync(yourfoldername, creationcollisionoption.openifexists); //craete file in folder if not exist , replace new file if exist storagefile samplefile = await folder.createfileasync("samplefile.xml", creationcollisionoption.replaceexisting); //create text , write on configuaration file string yourtext = "your sample text or configuration"; await windows.storage.fileio.writetextasync(samplefile, yourtext);
after can access file again read configuration value form readtextasync method.
//read data file await windows.storage.fileio.readtextasync(samplefile);
Comments
Post a Comment