コード例 #1
0
        private Dictionary <string, List <TimeEntry> > ReadTimes()
        {
            Dictionary <string, List <TimeEntry> > retVal = new Dictionary <string, List <TimeEntry> >();
            string path = Application.LocalUserAppDataPath + "\\TimeEntries.TALog";

            if (!File.Exists(path))
            {
                return(retVal);
            }

            string[] timeStrings = File.ReadAllLines(path);

            foreach (string timeString in timeStrings)
            {
                string keyStr   = timeString.Substring(0, timeString.IndexOf('>'));
                string valueStr = timeString.Substring(timeString.IndexOf('>') + 1);
                retVal.Add(keyStr, new List <TimeEntry>());

                foreach (string value in valueStr.Split('>'))
                {
                    if (value != "")
                    {
                        retVal[keyStr].Add(TimeEntry.Parse(value));
                    }
                }
            }

            return(retVal);
        }
コード例 #2
0
        public static Log Parse(string str)
        {
            Log retVal = new Log();

            int lastIndex = str.Substring(str.IndexOf("$#LIL#$") + 7).IndexOf("$#LIL#$");

            retVal.Time    = TimeEntry.Parse(str.Substring(0, str.IndexOf("$#LIL#$")));
            retVal.Project = str.Substring(str.IndexOf("$#LIL#$") + 7, lastIndex);
            retVal.Text    = str.Substring(str.IndexOf("$#LIL#$") + lastIndex + 14);

            return(retVal);
        }