Exemplo n.º 1
0
        public TVEpisodeMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection)
            : base(html, request, response, id, genreCollection)
        {
            AirDate = new ParsedInfo<DateTime>(html, parseDate);
            Episode = new ParsedInfo<int>(html, parseEpisode);
            Season = new ParsedInfo<int>(html, parseSeason);
            this.EpisodeTitle = new ParsedInfo<string>(html, parseEpisodeTitle);
            this.SeriesTitle = new ParsedInfo<string>(html, parseSeriesTitle);

            seriesID = parseSeries(html);
        }
Exemplo n.º 2
0
        public static bool ParserInfoOracle(string path, ref List <ParsedInfo> infoLists, ref string tableName)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.XmlResolver = null;//this忽略 DTD
                doc.Load(path);

                XmlNode    xn  = doc.SelectSingleNode("hibernate-mapping");
                XmlNode    xn1 = xn.ChildNodes[0];
                XmlElement xe1 = (XmlElement)xn1;
                tableName = xe1.GetAttribute("table").ToString().ToUpper();


                XmlNodeList xnlist = xn1.ChildNodes;

                foreach (XmlNode xn2 in xnlist)
                {
                    ParsedInfo info = new ParsedInfo();
                    XmlElement xe   = (XmlElement)xn2;
                    info.Name = xe.GetAttribute("name").ToString();
                    string type = xe.GetAttribute("type").ToString().Split(new char[] { '.' })[2];
                    info.TypeInfo = MappingTool.JavaToOracle(type);
                    info.Column   = xe.GetAttribute("column").ToString();
                    infoLists.Add(info);
                }

                if (infoLists == null || tableName == null)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "XML解析失败,请重新尝试!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
Exemplo n.º 3
0
        public ParsedInfo ParseStream(Stream stream)
        {
            if (!FatFileSystem.Detect(stream))
            {
                return(null);
            }

            try {
                using (var fileSystem = new FatFileSystem(stream)) {
                    var seagments  = GetSeagmentsByFatFileSystem(fileSystem);
                    var parsedInfo = new ParsedInfo(seagments);
                    parsedInfo.ParsedType = fileSystem.FatVariant.ToString();

                    return(parsedInfo);
                }
            }
            catch (Exception ex) {
                LoggerService.WriteException(ex);
                return(null);
            }
        }
Exemplo n.º 4
0
 public TVSeriesMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection)
     : base(html, request, response, id, genreCollection)
 {
     LastYear = new ParsedInfo<int>(html, parseYear);
 }
Exemplo n.º 5
0
 protected override void InitStartInfo(ParsedInfo info)
 {
     base.InitStartInfo(info);
     startInfo.UseShellExecute = false;
 }
Exemplo n.º 6
0
 public SetEnvHandler(ParsedInfo info) : base(info)
 {
 }
Exemplo n.º 7
0
 public RunAsHandler(ParsedInfo info) : base(info)
 {
 }
Exemplo n.º 8
0
    public ParsedInfo ParseTxt(string file, int year, int roll, bool txt)
    {
        //for roll
        //high = 1
        //avg = 2
        //low = 3


        int lineNumData;                    //line to parse data values such as stats and skills and feats from
        int lineNumFlavor;                  //line to parse flavor text from

        lineNumData   = (year - 1) * 6 + 1; //accounts for year
        lineNumData  += (2 * roll) - 1;     //acounts for roll
        lineNumFlavor = lineNumData - 1;    // go up 1 line for flavor text

        //grabs relevant strings from file.
        string[] lines      = file.Split('\n');
        string   lineFlavor = lines[lineNumFlavor - 1]; //must -1 because index shift from start 1 to start index 0
        string   lineData   = lines[lineNumData - 1];   //same as above

        //Flavor line is fine as is at this point
        // must now indentify skills/stats/feats/ and values

        string[] data = lineData.Split(','); // this seperates the skills, and stats into stuff like "athletics=1"

        //now seperate the data into its respective label and values
        //assume the value can not be greater than 9. <---------------------------------------------VERY IMPORTANT!!!!
        //for this approach to work, you need it to be one digit.


        //if txt == false. then get values as ints, else get everything as string
        if (txt == true)
        {
            string[] dataLabel = new string[data.Length];
            string[] dataValue = new string[data.Length];
            for (int i = 0; i < data.Length; i++)
            {
                dataLabel[i] = data[i].Substring(0, data[i].Length - 2);              // ignores =# and puts rest into array.
                dataValue[i] = data[i].Substring(data[i].Length - 1, data[i].Length); //grabs # as string
            }
            //now you have an array of datalabels and datavalues, that correspond to each other based off index.

            ParsedInfo info = new ParsedInfo(lineFlavor, dataLabel, dataValue);

            return(info);
        }
        else //when txt == false. we return actual int values
        {
            string[] dataLabel = new string[data.Length];
            int[]    dataValue = new int[data.Length];
            for (int i = 0; i < data.Length; i++)
            {
                dataLabel[i] = data[i].Substring(0, data[i].Length - 2);                           // ignores =# and puts rest into array.
                dataValue[i] = Int32.Parse(data[i].Substring(data[i].Length - 1, data[i].Length)); //grabs #
            }
            //now you have an array of datalabels and datavalues, that correspond to each other based off index.

            ParsedInfo info = new ParsedInfo(lineFlavor, dataLabel, dataValue);

            return(info);
        }
    }