Example #1
0
        public void ParseFile(string file)
        {
            string    name;
            iCalToken token = new iCalToken(), temp;

            if (System.IO.File.Exists(file))
            {
                foreach (string line in System.IO.File.ReadAllLines(file))
                {
                    if (line.StartsWith("BEGIN:"))
                    {
                        name = line.Split(':')[1];
                        if (token[name] != null)
                        {
                            if (token[name].GetType() != typeof(iCalListToken))
                            {
                                temp        = token[name];
                                token[name] = new iCalListToken(token);
                                ((iCalListToken)token[name]).Add(temp);
                            }
                            ((iCalListToken)token[name]).Add(new iCalToken(token[name]));
                            token = ((iCalListToken)token[name])[((iCalListToken)token[name]).Count - 1];
                        }
                        else
                        {
                            token[name] = new iCalToken(token);
                            token       = token[name];
                        }
                    }
                    else if (line.StartsWith("END:"))
                    {
                        token = token.Parent;
                        if (token.GetType() == typeof(iCalListToken))
                        {
                            token = token.Parent;
                        }
                    }
                    else
                    {
                        name        = line.Split(':')[0];
                        token[name] = new iCalPropertyToken(token, line.Split(':')[1]);
                    }
                }
            }
            Root = token;
        }
Example #2
0
 public iCalToken(iCalToken Parent)
 {
     this.Parent = Parent;
 }
Example #3
0
 public iCalPropertyToken(iCalToken Parent, string Value)
 {
     this.Parent = Parent;
     this.Value  = Value;
 }
Example #4
0
 public void Add(iCalToken Token)
 {
     this.childs.Add(Token);
 }