コード例 #1
0
        private static string FixupHardPath(string path, string currentShow)
        {
            // if image was collected on a different server
            // server hard path is invalid, replace with current
            // hard path just in case

            int start = path.IndexOf(currentShow, StringComparison.Ordinal) + currentShow.Length;
            int stop  = path.Length - start;

            var finalPath = path.Substring(start, stop);

            return(ContestLocation.PathToShow(currentShow) + finalPath);
        }
コード例 #2
0
        private void GetEntries(string currentShow)
        {
            int Count = 0;

            string path = ContestLocation.PathToShow(currentShow);


            //  string path = Path.Combine( Server.MapPath("/"), "Themes", _storeName, _repository ,currentShow);


            if (Directory.Exists(path))
            {
                string[] dirs = Directory.GetDirectories(path, "*");


                foreach (string entry in dirs)
                {
                    var directoryFiles = Directory.GetFiles(entry);

                    foreach (string filename in directoryFiles)
                    {
                        if (System.IO.File.Exists(filename) && Path.GetExtension(filename) == ".xml")
                        {
                            try
                            {
                                XmlDocument xmlDoc = new XmlDocument();
                                xmlDoc.Load(filename);
                                if (xmlDoc.FirstChild == null || !xmlDoc.FirstChild.HasChildNodes)
                                {
                                    continue;
                                }

                                BuildModel(xmlDoc.FirstChild, currentShow, Count++);
                            }
                            catch (Exception)
                            {
                                continue;
                            }
                        }
                    }
                }
            }
        }