예제 #1
0
        public string FindFileContent(string fileName)
        {
            Ensure.NotNullOrEmpty(fileName, "fileName");
            if (fileName.EndsWith(".log") && SequenceIsolatedFile.Exists(fileName))
            {
                SequenceIsolatedFile file = new SequenceIsolatedFile(fileName);
                return(String.Join(Environment.NewLine, file.Enumerate()));
            }

            return(null);
        }
예제 #2
0
        public IEnumerable <LogModel> GetFileNames()
        {
            Dictionary <string, List <string> > result = new Dictionary <string, List <string> >();

            foreach (string fileName in SequenceIsolatedFile.EnumerateNames("*.log"))
            {
                string[] parts = fileName.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                string   name  = parts[0];
                if (!result.TryGetValue(name, out List <string> items))
                {
                    result[name] = items = new List <string>();
                }

                items.Add(fileName);
            }

            return(result.Select(i => new LogModel(i.Key, i.Value)));
        }
예제 #3
0
        private string FindPath()
        {
            IsolatedStorageFile storage   = SequenceIsolatedFile.GetStorage();
            FieldInfo           fieldInfo = storage.GetType().GetField("m_RootDir", BindingFlags.NonPublic | BindingFlags.Instance);

            if (fieldInfo == null)
            {
                return(null);
            }

            string value = (string)fieldInfo.GetValue(storage);

            if (value == null)
            {
                return(null);
            }

            return(value);
        }