From 4846f02027bb01dc7c66ebee00514515ff0bb5f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9A=93=E6=9C=88?= <353374337@qq.com> Date: Fri, 5 Oct 2018 23:55:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=B1=BB=E8=8A=82=E7=9B=AE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 63 ++++++++++ HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml | 17 +++ .../HaoYue.CQTVShow.Hub/App.xaml.cs | 16 +++ .../HaoYue.CQTVShow.Hub.csproj | 107 ++++++++++++++++ .../HaoYue.CQTVShow.Hub/HtmlDoIt.cs | 65 ++++++++++ .../HaoYue.CQTVShow.Hub/MainWindow.xaml | 44 +++++++ .../HaoYue.CQTVShow.Hub/MainWindow.xaml.cs | 46 +++++++ .../Properties/AssemblyInfo.cs | 55 ++++++++ .../Properties/Resources.Designer.cs | 71 +++++++++++ .../Properties/Resources.resx | 117 ++++++++++++++++++ .../Properties/Settings.Designer.cs | 30 +++++ .../Properties/Settings.settings | 7 ++ .../HaoYue.CQTVShow.Hub/StaticClass.cs | 25 ++++ .../HaoYue.CQTVShow.Hub/packages.config | 6 + HaoYue.CQTVShow/HaoYue.CQTVShow.sln | 22 ++++ 15 files changed, 691 insertions(+) create mode 100644 .gitattributes create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/AssemblyInfo.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.Designer.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.resx create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.Designer.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.settings create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/StaticClass.cs create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/packages.config create mode 100644 HaoYue.CQTVShow/HaoYue.CQTVShow.sln diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml new file mode 100644 index 0000000..aaa36c5 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml.cs new file mode 100644 index 0000000..8004fae --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace HaoYue.CQTVShow.Hub +{ + /// + /// App.xaml 的交互逻辑 + /// + public partial class App : Application + { + } +} diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj new file mode 100644 index 0000000..78509c1 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HaoYue.CQTVShow.Hub.csproj @@ -0,0 +1,107 @@ + + + + + Debug + AnyCPU + {DC07A137-8937-49E4-B980-374E83CBE9B8} + WinExe + HaoYue.CQTVShow.Hub + HaoYue.CQTVShow.Hub + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\ControlzEx.3.0.2.4\lib\net40\ControlzEx.dll + + + ..\packages\HtmlAgilityPack.1.8.9\lib\Net40\HtmlAgilityPack.dll + + + ..\packages\MahApps.Metro.1.6.5\lib\net40\MahApps.Metro.dll + + + + + ..\packages\ControlzEx.3.0.2.4\lib\net40\System.Windows.Interactivity.dll + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + \ No newline at end of file diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs new file mode 100644 index 0000000..95d1dd6 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/HtmlDoIt.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using HtmlAgilityPack; + +namespace HaoYue.CQTVShow.Hub +{ + public static class HtmlDoIt + { + public static string GetShowList(int type,int pageindex) + { + string url = ""; + if (type == 0) + { + //生活麻辣烫 + url = "http://qjcq.cbg.cn/shmlt/"; + } + else if(type == 1) + { + //冷暖人生 + url = "http://qjcq.cbg.cn/lnrs/"; + } + else if (type == 2) + { + //麻辣故事会 + url = "http://qjcq.cbg.cn/mlgsh/"; + } + + if (pageindex > 1) + { + url += pageindex + ".shtml"; + } + + HtmlWeb htmlweb = new HtmlWeb(); + HtmlDocument htmldoc = htmlweb.Load(url); + HtmlNodeCollection hnc = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li"); + + StaticClass.StaticShowList = new List(); + //这个下标貌似是从1开始的 + for (int i = 1; i <= hnc.Count; i++) + { + + if (htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]") != null) + { + StaticShow ss = new StaticShow(); + ss.Title = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a")[0].Attributes["Title"].Value; + + ss.ToPath = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a")[0].Attributes["href"].Value; + //取值 + ss.Time = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a/div/span")[0].InnerHtml; + //读取img标签的src + ss.ImageSrc = htmldoc.DocumentNode.SelectNodes("//div[@class='main']/ul/li[" + i + "]/a/div/img")[0].Attributes["src"].Value; + + StaticClass.StaticShowList.Add(ss); + } + + } + + return ""; + } + + } +} diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml new file mode 100644 index 0000000..63925da --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml.cs new file mode 100644 index 0000000..b8d2c35 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/MainWindow.xaml.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +//引用 +using MahApps.Metro.Controls; + +namespace HaoYue.CQTVShow.Hub +{ + /// + /// MainWindow.xaml 的交互逻辑 + /// + public partial class MainWindow : MetroWindow + { + public MainWindow() + { + InitializeComponent(); + } + + int frist = 1; + + private void MeunTabSelect(object sender, SelectionChangedEventArgs e) + { + if (frist == 1) + { + frist = 0; + return; + } + + this.TabMeun.IsEnabled = false; + HtmlDoIt.GetShowList(this.TabMeun.SelectedIndex, 1); + this.TabMeun.IsEnabled = true; + this.ListBoxShow.ItemsSource = StaticClass.StaticShowList; + } + } +} diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/AssemblyInfo.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..01446bd --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("HaoYue.CQTVShow.Hub")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("HaoYue.CQTVShow.Hub")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// 将 ComVisible 设置为 false 会使此程序集中的类型 +//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +//若要开始生成可本地化的应用程序,请设置 +//.csproj 文件中的 CultureYouAreCodingWith +//例如,如果您在源文件中使用的是美国英语, +//使用的是美国英语,请将 设置为 en-US。 然后取消 +//对以下 NeutralResourceLanguage 特性的注释。 更新 +//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。 + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //主题特定资源词典所处位置 + //(未在页面中找到资源时使用, + //或应用程序资源字典中找到时使用) + ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 + //(未在页面中找到资源时使用, + //、应用程序或任何主题专用资源字典中找到时使用) +)] + + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号 +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.Designer.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.Designer.cs new file mode 100644 index 0000000..12118ac --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本: 4.0.30319.42000 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// +//------------------------------------------------------------------------------ + +namespace HaoYue.CQTVShow.Hub.Properties +{ + + + /// + /// 强类型资源类,用于查找本地化字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// 返回此类使用的缓存 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("HaoYue.CQTVShow.Hub.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 覆盖当前线程的 CurrentUICulture 属性 + /// 使用此强类型的资源类的资源查找。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.resx b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.Designer.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.Designer.cs new file mode 100644 index 0000000..399a44a --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace HaoYue.CQTVShow.Hub.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.settings b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/StaticClass.cs b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/StaticClass.cs new file mode 100644 index 0000000..23b0073 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/StaticClass.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace HaoYue.CQTVShow.Hub +{ + public class StaticClass + { + public static List StaticShowList = new List(); + + } + + + /// + /// 节目列表 + /// + public class StaticShow + { + public string Title { get; set; } + public string ToPath { get; set; } + public string Time { get; set; } + public string ImageSrc { get; set; } + } +} diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/packages.config b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/packages.config new file mode 100644 index 0000000..e8f4bec --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.Hub/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/HaoYue.CQTVShow/HaoYue.CQTVShow.sln b/HaoYue.CQTVShow/HaoYue.CQTVShow.sln new file mode 100644 index 0000000..2dda848 --- /dev/null +++ b/HaoYue.CQTVShow/HaoYue.CQTVShow.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HaoYue.CQTVShow.Hub", "HaoYue.CQTVShow.Hub\HaoYue.CQTVShow.Hub.csproj", "{DC07A137-8937-49E4-B980-374E83CBE9B8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DC07A137-8937-49E4-B980-374E83CBE9B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC07A137-8937-49E4-B980-374E83CBE9B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC07A137-8937-49E4-B980-374E83CBE9B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC07A137-8937-49E4-B980-374E83CBE9B8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal