Reading VCalendar And VCard Using .NET?
Jun 26, 2009
I want to be able to read vCard and vCalendar data using .NET, I have something which does this, and have looked at the specification. For those not familar with the format here is some test data from my current application:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Microsoft Corporation//Windows Calendar 1.0//EN
CALSCALE:GREGORIAN
[Code]....
These are both stored as plain text, filename.ics for vCalendar and filename.vcf for vCard. I currently use line by line parsing, however this seems primitive as iCalendar items can be multi-line could LINQ or similar method be used, such as those that cope with missing or extra elements, including carriage returns in the data? I have the specifications for this, if a similar way is possible for something else then this will be fine, I am using .NET 3.5 and Visual Basic 2008, so can use any .NET feature available that could support this.
View 1 Replies
ADVERTISEMENT
Sep 6, 2009
I have an vCard application that needs to read vCard Data, and have found a RegularExpression which gets the FieldName, Encoding and FieldValue from the file, here it is below:
^(?<FIELDNAME>[w-]{1,})(?:(?:;?)(?:ENCODING=(?<ENC>[^:;]*)|CHARSET=(?<CHARSET>[^:;]*))){0,2}:(?:(?<CONTENT>(?:[^
]*=
){1,}[^
]*)|(?<CONTENT>[^
]*))
This Regular Expression Reads these kind of values fine:
ORG:Company
FN;ENCODING=QUOTED-PRINTABLE;CHARSET=UTF-8:RoguePlanetoid
However I want it to read these values also
TEL;WORK;VOICE:0200 0000000
Without skipping them. How can I modify the RegularExpression so TEL;WORK;VOICE ends up as part of the "FIELDNAME" and 0200 0000000 is part of the "CONTENT".I am unfamiliar with complex RegularExpressions and cannot figure out how to modify it, there is a regular expression that gets these:
^(?:TEL)([^:]*):(?<TEL>[^
]*)
However it only gets the FieldName as "TEL" and I need the whole value for this so I can tell the numbers apart in my application.If possible the Regular Expression would read the WORK and VOICE elements also like the CHARSET and ENCODING in the current regular expression, so they can treated like an Attribute and Type for example, however anything which allows the Regular Expression to read the whole TEL;WORK;VOICE as the FIELDNAME will be fine.
Edit
^(?<FIELDNAME>[^:]{1,})(?:(?:;?)(?:ENCODING=(?<ENC>[^:;]*)|CHARSET=(?<CHARSET>[^:;]*))){0,2}:(?:(?<CONTENT>(?:[^
]*=
){1,}[^
]*)|(?<CONTENT>[^
]*))
Reads up to the first Colon which covers the Whole FieldName, however it would be nice to store each SemiColon Element in a seperate item such as ATTRIBUTE or TYPE.
View 5 Replies
Nov 18, 2009
modify RegularExpression to Parse vCard/vCalendar to allow a particular field type?
View 5 Replies
Jan 2, 2010
I am working on a project in VB 2008 and need it to do this:Read first line from text file (using Openfile)Enter line into textbox on formDo some other codeThen Read second linefrom text fileEnter line into same text boxand loop until we have gone through text fileI am not sure how to read line by line from text file then enter it in textbox. I can open the Openfile and get the filename and everything, but I just am not sure how to read from it or enter that line into the textbox.Here is what I have, its not much but its a start:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim FileReader As StreamReader
[code]....
View 4 Replies
Nov 13, 2009
I have a dictionary object (let's call it _do) I am using to cache some values for use in a multi-threaded program. I have a single controlling parent thread, with a timer function _doTimer() which can kick off child threads with a new instance of class MyThreadObject in each. My parent thread has _do as a property and with each time _doTimer() gets called, it may or may not repopulate _do depending on cacheflag settings. I pass a reference to _do to each instance of MyThreadObject and those threads at some point read the values of _do but DO NOT write to it.
What I want is to ensure that the child threads do not try and read _do whilst the parent thread is writing to it. Same thing but very slightly different -> I also don't want the parent thread to write to _do whilst the child threads are reading from it. However there is no problem with 1 child thread reading the values of _do at the same time as another child thread is reading the values - so ideally I do not want each child thread to completely lock out read access, only locking out Write access.. The code is roughly like this:
[Code]....
View 3 Replies
Apr 18, 2011
Even though the row is there its not allowing me to read the next row. I thought this would have worked but obviously not.
Imports System.Data.OleDb
Public Class formalQuiz
Dim Questions As String
[Code].....
View 11 Replies
Nov 19, 2010
I've been working on this project that lets me read in file "scores.txt" This file has a student name then a grade. ie:
Scubastevie
56
superman
33
There is no limit to amount of data scores should be able to read.
I'm just trying to be able to read in both sets of data and then have it display this way:
Scubastevie 56
Superman 33
I know you use arrays and I have done some code. Here is what i'm trying. I don't want two arrays, just one.
Public Class Form1
Structure ExamGrades
Dim name As String
[]Code].....
View 7 Replies
Feb 14, 2010
I am trying to develop a tool for use with an online game which has XML files available online (not downloads, automatically updated XML website things). Sorry if I'm not too clear as I don't truly understand how they work or anything!Anyway, I am trying to make a vb.net program access the information stored in these online XML pages but am having some difficulty. For a start, I tried the vb.net's help files which didn't help a great deal (well done Microsoft) because of the lack of informative comments on each code sample. It merely said that the output would be this (didn't even say where this output would be.
Next I tried searching the web but although I found a few things, some on this site, most of them were questions where the person already had a good knowledge of XML usage so they didn't put many comments on their code.
View 1 Replies
Jul 30, 2011
I am using following code to read text from a .txt file. But I don't know how to perform search within file and how to read a specific line in the text file, based on search.
Dim vrDisplay = My.Computer.FileSystem.ReadAllText(CurDir() & "keys.txt")
MsgBox(vrDisplay)
For an example, if I want to read the line that contains the word "Start", how to do that?
View 3 Replies
Dec 8, 2010
I have a filename SBSA_UPLD_20101208 and I am interested in reading the Last date part which is 20101208. How can I do it?
View 1 Replies
Mar 30, 2012
I am using the following code to get an XML data from a website of mine:
Dim strUrl As String = "http://www.xxx.net/mobileApp/checker.asp"
Dim reader As XmlTextReader = New XmlTextReader(strUrl)
Do While (reader.Read())
[Code].....
View 2 Replies
Jul 22, 2009
I have an XML file, shown below:
<?xml version="1.0" standalone="no"?>
<!--RISInsight server settings-->
<Configuration>
[Code].....
Is there a way that I can make it continue to read the XML file?
View 4 Replies
Mar 16, 2012
I have this code and I have no idea why it's not working.
Using parser As New Microsoft.VisualBasic.FileIO.TextFieldParser("\server
etlogoncsvsstafflookup.csv")
parser.SetDelimiters(",")
[Code]....
I want it to read the left value in a csv, if it matches the username then the ADGroup sets to the right column (so we have staff name and then year group)
This code seems to be skipping lines though and not going through each one but I don't know why.
View 13 Replies
Nov 13, 2009
I have a vb.net POS application which creates a CSV file (three actually) to store data for later import into a database. All is working well with that part. Details and what I would like to do now follows: A single row of data in one of these files looks like this:
11/4/2009 1:57:50 PM,fg5,1234,21.00,21,0,0,0,0,21.00,12345
There are 11, I will call them columns, in each row, with varying number of rows each day. I need to extract only the information in column 10 from each row and total these numbers. I could do this with a FileOpen(1, <fullpathtofilename>, OpenMode.Input) and an input(1,<variablename>(i)) for each row in a FOR loop. This seems to be cumbersome and a waste of resources especially when the file is very large. Is there a easier, shorter, better, faster (use your own expeditious adjective here) way of doing this? Is there a way to read only the 10th item in each row and for how ever many rows there are? Something like this maybe:
Dim i As Integer
Dim Total as Double
i = 0
[code]....
View 1 Replies
Jan 12, 2010
I am making a browser in vb which can import IE favourites. Here is my code so far:
Dim favespath As String = Environment.GetFolderPath(Environment.SpecialFolder.Favorites)
Dim info As New IO.DirectoryInfo(favespath)
For Each fi In info.GetFiles
[code]....
But my code returns a load of HTML instead of the target of the .url file.
View 6 Replies
Jul 2, 2011
I am looking to right a vb application that will read a cr2 file (cr2 is a images raw file) I want to be able to read the file resize it, save as a jpg, and auto post to my facebook albums (I have the facebook part done)
Someone has posted before [URL]..
View 3 Replies
May 27, 2009
The way this file works is there is a null buffer, then a user check sum then a byte that gives you the user name letter count, then a byte for how many bytes to skip to the next user and a byte for which user file the user keeps their settings in.
the loop with the usersm variable in the IF statement sets up the whole file stream for extraction. However with almost the exact same code the else clause specifically the str.Read(xnl, 0, usn - 1) in the else code appears to be reading the very beginning of the file despite the position of the filestream being set earlier?
this is in vb2005
Private Sub readusersdata(ByVal userdatafile As String)
ListView1.BeginUpdate()
ListView1.Items.Clear()
Using snxl As IO.Stream = IO.File.Open(userdatafile, IO.FileMode.Open)
[code]....
View 1 Replies
Sep 4, 2009
how to read a text file character by character in VB.NET??
View 2 Replies
Apr 6, 2011
I'm trying to read a .txt file line by line, but Visual Studio doesn't like what im doing. Here's my code so far:
Private Sub LoadGenre()
Dim StrApplicationPath As String = Directory.GetCurrentDirectory() & ""
Dim inputStream As StreamReader = File.OpenText(StrApplicationPath & "myfile.txt")
[code]....
View 3 Replies
Mar 30, 2010
I'm trying to read a XML file, but only certain values.So my XML file is built from the result of a SQL query.[code]The probelm is the loop starts with line 1, good start.But then it will go to line one again, then line 2, line 2 again and so on.When it hits line 5, the first value I need to pull, it then stops.And thats how it is written, so that makes sence.I need to loop through this document, grab the certain values I need, and move on.
View 9 Replies
Jun 2, 2009
How would I go about reading this xml file?
<Data>
<Login Username="d" Password="d"/>
<Application Name="1" Key="1" Owner="1"/>
[Code].....
View 1 Replies
Oct 11, 2009
Trying to read and display the text between two re-ocurring characters with a Serial connected device. The beginning of string starts off with "+8" and ends up with "0+". The string displays correctly between the characters, however I do not wish to see these characters. Here is my code that I used from a serial comm chat. P.S. this displays on two lines, the characters that I'm asking about are on the second line.
Private Sub DataReceived(ByVal sender _
As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) _
Handles serialPort.DataReceived
[code]....
View 7 Replies
Sep 30, 2007
I just searched a method to read my CPU Temperature, at first i tried W32_TemperatureProbe, but this didn't work. Now i use: MSAcpi_ThermalZoneTemperatureI found this [Code]
View 4 Replies
Aug 29, 2009
read the cpu temperature in a VB application.i tried to get it using WMI but that isn't supported by my computer.i used code i found on this forum and what i get from the WMI code creator.this is the code created with the WMI code creato
View 10 Replies
Aug 5, 2009
Previously I'm able to read the csv with the format of
Diode,,,
,,,Vf1_FT
TestCond,,,
Spec Min,,,-
[code]....
into 2D array where i can display data(x,y).But with this format below in csv file,
Diode,,,,,,,,,Vf1_FT,,Vf2_FT,TestCond,,,,,,Spec Min,,,-,,-,Spec Max,,,0.715,0.82,DUT#,,Bin#,V,,V,1,P,1,0.217154,P,0.281562,P2,P,1,0.245273,P,0.580057,P,3,P,1,0.8140 7,P,0.279079,P,4,P,1,0.233167,P,0.278402,P,5,1,0.252264,P,0.277499,P,6,P,1,0.231662,P,0.476897,P,7,P ,1,0.910909,P,0.27622,P,8,P,1,0.280232,P,0.775618,P,9,P,1,0.229555,P,0.275167,P,10,P,1,0.279179,P,0. 274715,P
,,,,,,
where there is no new line for each rows, I'm only able to read it in 1D where. Is it a way to read it in 2D way? Where I can read Vf1_FT and Vf2_FT?
View 5 Replies
Jun 10, 2010
I've searched high and low for the proper way to read from a csv file into a two dimensional array. I thought I found the answer but for some reason I'm getting an"IndexOutOfRangeException" was unhandled message.
View 3 Replies
Mar 26, 2012
I've been asked to prepare a proposal for a client for a new development. The finished product will require copying of personal DVDs, e.g. a wedding or christening video, to AVI or similar format.
Is it possible in vb.NET to read data from a DVD and encode it as an AVI file? If so, can you give me some pointers to how I might research this more.
View 10 Replies
Sep 8, 2009
I've created an Event Log Source for my application name during the installation process (the end-users are not local admins) and the app writes any error messages to the Application event log.I now want to retrieve the error from the Application log and display them in a grid in my app.
The issue is that it takes more than 30 seconds to retrieve all of the entries,regardless of any filtering I perform in my WMI query. My query is:
"SELECT * FROM Win32_NTLogEvent Where Logfile = 'Application' And Sourcename = 'myApp' And TimeGenerated > '" + DateTime.Now.AddDays(-14).ToString("yyyyMMdd") + "'"
Initially I only filtered on the SourceName but it took 30+ seconds to retrieve about 100 records from 40,000 in the Application log. I added the TimeGenerated filter thinking it would reduce the query time but it was the same.
I tried using the ReturnImmediately enumerationoption property, which does return quickly, but when iterating through the collection it takes over 30 seconds to display the relevant entries.The benchmark I am working against is the speed at which the Windows Event Viewer opens the Application Log and applies a filter on the SourceName. This takes at most 5 seconds to redisplay the filtered list. However, I note that working on Vista, when I open Event Viewer, UAC prompts for admin elevation whereas my code will be reading from the Application log using standard user rights.
View 2 Replies
Mar 27, 2012
I am trying to build an app that can search column A in an excel document (with textbox control). In column B, I have info about the column A items. When a column A item is searched, I would like a textbox (or similar) to display info about it from column B.
I have never done any Excel related programming, so I don't know what to do, or where to start.
View 6 Replies
Mar 11, 2010
I wanna read from one *.ini file but not clasic read.Here is content of file confing.ini that I wanna read:
[Config]
String0=some text1
String1=some text2
String2=some text3
....
Read that I wanna get is value of String1 for example, in this case some text2.
View 3 Replies