Bladeren bron

还没有调整好,semaphore还缺几步骤

shenjian Office PC 7 jaren geleden
bovenliggende
commit
55e3a3c401

+ 0 - 63
ConsoleApplication1/ConsoleApplication1.csproj

@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
-    <ProductVersion>8.0.30703</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{A2C0587F-AA17-4E71-81C7-E2F07524D1CE}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>ConsoleApplication1</RootNamespace>
-    <AssemblyName>ConsoleApplication1</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
-    <PlatformTarget>x86</PlatformTarget>
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
-    <PlatformTarget>x86</PlatformTarget>
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Program.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\Gets\Gets.csproj">
-      <Project>{9262F4C4-2D81-41AB-A444-57D3A21CEA9B}</Project>
-      <Name>Gets</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 0 - 23
ConsoleApplication1/Program.cs

@@ -1,23 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace ConsoleApplication1
-{
-    class Program
-    {
-        static void Main(string[] args)
-        {
-            Gets.Url_kat_cr cr = new Gets.Url_kat_cr();
-            
-            Console.WriteLine(cr.gogogo("art"));
-
-
-            Gets.MyWebClient wc = new Gets.MyWebClient();
-            var ddddd = wc.GetHTML(new Uri("http://kat.cr/usearch/art"));
-
-            Console.WriteLine(ddddd);
-        }
-    }
-}

+ 0 - 36
ConsoleApplication1/Properties/AssemblyInfo.cs

@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 有关程序集的常规信息通过以下
-// 特性集控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("ConsoleApplication1")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("ConsoleApplication1")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// 将 ComVisible 设置为 false 使此程序集中的类型
-// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
-// 则将该类型上的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("4c120e79-c78e-4321-909d-d5148cf1e531")]
-
-// 程序集的版本信息由下面四个值组成:
-//
-//      主版本
-//      次版本 
-//      内部版本号
-//      修订号
-//
-// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]

+ 5 - 0
Entity/SearchItem.cs

@@ -202,6 +202,7 @@ namespace AVSORTER
                 //this.MovieBasicList = Getor.Query(SeedString);
                 Func<string, List<MovieBasic>> fuc = new Func<string, List<MovieBasic>>(Getor.Query);
                 fuc.BeginInvoke(SeedString, queryFinishCallBack, fuc);
+
                 RaiseStatusChangeEvent(QStatus.未开始, QStatus.查询中, "");
             }
             else
@@ -239,6 +240,10 @@ namespace AVSORTER
                 this.MovieBasicList = null;
                 this.chooseIndex = -1;
             }
+            finally
+            {
+                RaiseStatusChangeEvent(QStatus.准备好移动文件, QStatus.准备好移动文件, "Release1");
+            }
 
         }
 

+ 8 - 0
Entity/obj/Debug/Entity.csproj.FileListAbsolute.txt

@@ -55,3 +55,11 @@ D:\avsorter\Entity\obj\Debug\AVSORTER.Properties.Resources.resources
 D:\avsorter\Entity\obj\Debug\Entity.dll
 D:\avsorter\Entity\obj\Debug\Entity.pdb
 D:\avsorter\Entity\obj\Debug\Entity.csproj.GenerateResource.Cache
+E:\AVSorter\Entity\bin\Debug\DB\AVDB.accdb
+E:\AVSorter\Entity\bin\Debug\Entity.dll
+E:\AVSorter\Entity\bin\Debug\Entity.pdb
+E:\AVSorter\Entity\obj\Debug\Entity.csprojResolveAssemblyReference.cache
+E:\AVSorter\Entity\obj\Debug\AVSORTER.Properties.Resources.resources
+E:\AVSorter\Entity\obj\Debug\Entity.csproj.GenerateResource.Cache
+E:\AVSorter\Entity\obj\Debug\Entity.dll
+E:\AVSorter\Entity\obj\Debug\Entity.pdb

+ 47 - 47
PicSo/Form1.Designer.cs

@@ -60,12 +60,14 @@
             this.label2 = new System.Windows.Forms.Label();
             this.txt_sub = new System.Windows.Forms.TextBox();
             this.label1 = new System.Windows.Forms.Label();
+            this.bc = new AVSORTER.BasicContainer();
             this.tabControl1 = new System.Windows.Forms.TabControl();
             this.tabPage2 = new System.Windows.Forms.TabPage();
             this.listBox1 = new System.Windows.Forms.ListBox();
             this.cb_AutoCorrect = new System.Windows.Forms.CheckBox();
             this.btn_LocalSearch = new System.Windows.Forms.Button();
             this.txt_LocalSearchKeyWord = new System.Windows.Forms.TextBox();
+            this.movieContainer1 = new PicSo.MovieContainer();
             this.tabPage3 = new System.Windows.Forms.TabPage();
             this.label3 = new System.Windows.Forms.Label();
             this.nud_ActorLessThan = new System.Windows.Forms.NumericUpDown();
@@ -73,6 +75,8 @@
             this.btnFind = new System.Windows.Forms.Button();
             this.txt_url = new System.Windows.Forms.TextBox();
             this.tabPage4 = new System.Windows.Forms.TabPage();
+            this.lbl_p4_status = new System.Windows.Forms.Label();
+            this.btn_p4_Go1_paste = new System.Windows.Forms.Button();
             this.btn_p4_Clear = new System.Windows.Forms.Button();
             this.lv_p4_result = new System.Windows.Forms.ListView();
             this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -83,10 +87,6 @@
             this.btn_p4_Go1 = new System.Windows.Forms.Button();
             this.label4 = new System.Windows.Forms.Label();
             this.txt_p4_keyword = new System.Windows.Forms.TextBox();
-            this.btn_p4_Go1_paste = new System.Windows.Forms.Button();
-            this.bc = new AVSORTER.BasicContainer();
-            this.movieContainer1 = new PicSo.MovieContainer();
-            this.lbl_p4_status = new System.Windows.Forms.Label();
             this.contextMenuStrip1.SuspendLayout();
             this.tabPage1.SuspendLayout();
             this.groupBox2.SuspendLayout();
@@ -315,7 +315,7 @@
             this.btn_GO.Name = "btn_GO";
             this.btn_GO.Size = new System.Drawing.Size(110, 50);
             this.btn_GO.TabIndex = 15;
-            this.btn_GO.Text = "Go!";
+            this.btn_GO.Text = "DownloadInfo";
             this.btn_GO.UseVisualStyleBackColor = true;
             this.btn_GO.Click += new System.EventHandler(this.btn_GO_Click);
             // 
@@ -404,6 +404,18 @@
             this.label1.TabIndex = 12;
             this.label1.Text = "目标路径";
             // 
+            // bc
+            // 
+            this.bc.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.bc.IsShowPic = false;
+            this.bc.ListMovieBasic = null;
+            this.bc.Location = new System.Drawing.Point(6, 341);
+            this.bc.MovieB = null;
+            this.bc.Name = "bc";
+            this.bc.Size = new System.Drawing.Size(411, 180);
+            this.bc.TabIndex = 7;
+            this.bc.Load += new System.EventHandler(this.bc_Load);
+            // 
             // tabControl1
             // 
             this.tabControl1.Controls.Add(this.tabPage1);
@@ -471,6 +483,16 @@
             this.txt_LocalSearchKeyWord.TabIndex = 0;
             this.txt_LocalSearchKeyWord.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txt_LocalSearchKeyWord_KeyPress);
             // 
+            // movieContainer1
+            // 
+            this.movieContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+            this.movieContainer1.Location = new System.Drawing.Point(6, 176);
+            this.movieContainer1.Movie = null;
+            this.movieContainer1.MovieList = null;
+            this.movieContainer1.Name = "movieContainer1";
+            this.movieContainer1.Size = new System.Drawing.Size(913, 375);
+            this.movieContainer1.TabIndex = 2;
+            // 
             // tabPage3
             // 
             this.tabPage3.Controls.Add(this.label3);
@@ -550,6 +572,26 @@
             this.tabPage4.Text = "下载地址搜索";
             this.tabPage4.UseVisualStyleBackColor = true;
             // 
+            // lbl_p4_status
+            // 
+            this.lbl_p4_status.AutoSize = true;
+            this.lbl_p4_status.Location = new System.Drawing.Point(330, 13);
+            this.lbl_p4_status.Name = "lbl_p4_status";
+            this.lbl_p4_status.Size = new System.Drawing.Size(77, 12);
+            this.lbl_p4_status.TabIndex = 7;
+            this.lbl_p4_status.Text = "正在搜索……";
+            this.lbl_p4_status.Visible = false;
+            // 
+            // btn_p4_Go1_paste
+            // 
+            this.btn_p4_Go1_paste.Location = new System.Drawing.Point(249, 8);
+            this.btn_p4_Go1_paste.Name = "btn_p4_Go1_paste";
+            this.btn_p4_Go1_paste.Size = new System.Drawing.Size(75, 23);
+            this.btn_p4_Go1_paste.TabIndex = 6;
+            this.btn_p4_Go1_paste.Text = "粘贴搜索";
+            this.btn_p4_Go1_paste.UseVisualStyleBackColor = true;
+            this.btn_p4_Go1_paste.Click += new System.EventHandler(this.btn_p4_Go1_paste_Click);
+            // 
             // btn_p4_Clear
             // 
             this.btn_p4_Clear.Location = new System.Drawing.Point(17, 528);
@@ -630,48 +672,6 @@
             this.txt_p4_keyword.Size = new System.Drawing.Size(100, 21);
             this.txt_p4_keyword.TabIndex = 0;
             // 
-            // btn_p4_Go1_paste
-            // 
-            this.btn_p4_Go1_paste.Location = new System.Drawing.Point(249, 8);
-            this.btn_p4_Go1_paste.Name = "btn_p4_Go1_paste";
-            this.btn_p4_Go1_paste.Size = new System.Drawing.Size(75, 23);
-            this.btn_p4_Go1_paste.TabIndex = 6;
-            this.btn_p4_Go1_paste.Text = "粘贴搜索";
-            this.btn_p4_Go1_paste.UseVisualStyleBackColor = true;
-            this.btn_p4_Go1_paste.Click += new System.EventHandler(this.btn_p4_Go1_paste_Click);
-            // 
-            // bc
-            // 
-            this.bc.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.bc.IsShowPic = false;
-            this.bc.ListMovieBasic = null;
-            this.bc.Location = new System.Drawing.Point(6, 341);
-            this.bc.MovieB = null;
-            this.bc.Name = "bc";
-            this.bc.Size = new System.Drawing.Size(411, 180);
-            this.bc.TabIndex = 7;
-            this.bc.Load += new System.EventHandler(this.bc_Load);
-            // 
-            // movieContainer1
-            // 
-            this.movieContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
-            this.movieContainer1.Location = new System.Drawing.Point(6, 176);
-            this.movieContainer1.Movie = null;
-            this.movieContainer1.MovieList = null;
-            this.movieContainer1.Name = "movieContainer1";
-            this.movieContainer1.Size = new System.Drawing.Size(913, 375);
-            this.movieContainer1.TabIndex = 2;
-            // 
-            // lbl_p4_status
-            // 
-            this.lbl_p4_status.AutoSize = true;
-            this.lbl_p4_status.Location = new System.Drawing.Point(330, 13);
-            this.lbl_p4_status.Name = "lbl_p4_status";
-            this.lbl_p4_status.Size = new System.Drawing.Size(77, 12);
-            this.lbl_p4_status.TabIndex = 7;
-            this.lbl_p4_status.Text = "正在搜索……";
-            this.lbl_p4_status.Visible = false;
-            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);

+ 9 - 39
PicSo/Form1.cs

@@ -8,6 +8,7 @@ using System.Text;
 using System.Windows.Forms;
 using System.IO;
 using System.Threading;
+using System.Threading.Tasks;
 
 namespace PicSo
 {
@@ -58,38 +59,6 @@ namespace PicSo
             }
         }
 
-        //void Go()
-        //{
-        //    try
-        //    {
-        //        for (int i = 0; i < this.listView1.Items.Count; i++)
-        //        {
-        //            this.listView1.Items[i].SubItems.Add("查询品番...");
-        //            var mbs = arzon.Query(this.listView1.Items[i].SubItems[1].Text);
-        //            if (mbs.Count == 1)
-        //            {
-        //                this.bc.MovieB = mbs[0];
-        //                this.listView1.Items[i].SubItems[2].Text = "下载封面...";
-        //                var mv = arzon.GetMovie(this.bc.MovieB);
-        //                arzon.GetCover(mv);
-        //                this.listView1.Items[i].SubItems[2].Text = "完成";
-
-        //                f.MakeMove(mv, listView1.Items[i].Text);
-
-        //            }
-        //            else
-        //            {
-        //                this.listView1.Items[i].SubItems[2].Text = "未找到";
-        //            }
-        //        }
-        //    }
-        //    finally
-        //    {
-        //        f.WriteLog();
-        //    }
-
-        //}
-
 
         private void textBox2_TextChanged(object sender, EventArgs e)
         {
@@ -144,12 +113,15 @@ namespace PicSo
             }
         }
 
+        Semaphore sem = new Semaphore(2, 2);
+
         private void btn_GO_Click(object sender, EventArgs e)
         {
             foreach (ListViewItem item in listView1.Items)
             {
+                sem.WaitOne();//现在这个Semaphore是可以正常工作的。但是放在这里会阻塞主进程,弄2个semaphore,再弄2个事件。在SearchItem里专门控制
+                //下载信息的进程,以及下载图片的进程数量,是比较好的方法。
                 var fi = new AVSORTER.SearchItem(item.SubItems[1].Text, arzon.Clone() as AVSORTER.IGetable);
-
                 item.Tag = fi;
                 fi.OnStatusChange += fi_OnStatusChange;
                 fi.Tag = item;
@@ -162,9 +134,10 @@ namespace PicSo
         void fi_OnStatusChange(object sender, AVSORTER.SearchItem.StatusChangeEventArgs e)
         {
             ((sender as AVSORTER.SearchItem).Tag as ListViewItem).SubItems[2].Text = e.After.ToString();
-
-
-
+            if (e.Message=="Release1")
+            {
+                sem.Release();
+            }
         }
 
         private void UIParamChange(object sender, EventArgs e)
@@ -381,9 +354,6 @@ namespace PicSo
                     {
                         item.SubItems[2].Text = "未动";
                     }
-
-
-
                 }
                 else
                 {

BIN
PicSo/bin/Debug/PicSo.vshost.exe


BIN
PicSo/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache


BIN
PicSo/obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 18 - 0
PicSo/obj/x86/Debug/PicSo.csproj.FileListAbsolute.txt

@@ -71,3 +71,21 @@ D:\avsorter\PicSo\obj\x86\Debug\PicSo.exe
 D:\avsorter\PicSo\obj\x86\Debug\PicSo.pdb
 D:\avsorter\PicSo\obj\x86\Debug\PicSo.csprojResolveAssemblyReference.cache
 D:\avsorter\PicSo\obj\x86\Debug\PicSo.csproj.GenerateResource.Cache
+E:\AVSorter\PicSo\bin\Debug\PicSo.exe.config
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.csprojResolveAssemblyReference.cache
+E:\AVSorter\PicSo\obj\x86\Debug\AVSORTER.BasicContainer.resources
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.Form1.resources
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.InputBox.resources
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.MovieContainer.resources
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.Properties.Resources.resources
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.csproj.GenerateResource.Cache
+E:\AVSorter\PicSo\bin\Debug\DB\AVDB.accdb
+E:\AVSorter\PicSo\bin\Debug\PicSo.exe
+E:\AVSorter\PicSo\bin\Debug\PicSo.pdb
+E:\AVSorter\PicSo\bin\Debug\Entity.dll
+E:\AVSorter\PicSo\bin\Debug\Gets.dll
+E:\AVSorter\PicSo\bin\Debug\HtmlAgilityPack.dll
+E:\AVSorter\PicSo\bin\Debug\Gets.pdb
+E:\AVSorter\PicSo\bin\Debug\Entity.pdb
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.exe
+E:\AVSorter\PicSo\obj\x86\Debug\PicSo.pdb

+ 2 - 2
readme.md

@@ -1,3 +1,3 @@
-AVSorter
-Html reader for arzon.jp.
+# AVSorter
+This is a Html reader for arzon.jp.
 Search Japanese AV using a key-word and geting detail information.If you already have the Video file, it could move the file to some (new) folder by the video's actor,procuder etc. and save the video info at local database in order to query some time.