Skip to content

Commit 1311483

Browse files
author
sett4
committed
second commit
0 parents  commit 1311483

14 files changed

+179
-0
lines changed

App.config

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
<add key="url" value="http://twitter.com/statuses/update.xml" />
5+
<add key="username" value="ゆーざーめい" />
6+
<add key="password" value="ぱすわーど" />
7+
</appSettings>
8+
</configuration>

Twi.cs

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Web;
5+
using System.Net;
6+
7+
namespace potwitter
8+
{
9+
static class Twi
10+
{
11+
/// <summary>
12+
/// アプリケーションのメイン エントリ ポイントです。
13+
/// </summary>
14+
[STAThread]
15+
static void Main(string[] args)
16+
{
17+
if (args.Length < 1)
18+
{
19+
return;
20+
}
21+
22+
string username = System.Configuration.ConfigurationManager.AppSettings["username"];
23+
string password = System.Configuration.ConfigurationManager.AppSettings["password"];
24+
string url = System.Configuration.ConfigurationManager.AppSettings["url"];
25+
26+
Encoding enc = Encoding.UTF8;
27+
28+
StringBuilder sb = new StringBuilder();
29+
sb.Append("status=");
30+
sb.Append(HttpUtility.UrlEncode(String.Join(" ", args), enc));
31+
byte[] data = Encoding.ASCII.GetBytes(sb.ToString());
32+
33+
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
34+
req.Credentials = new System.Net.NetworkCredential(username, password);
35+
req.Method = "POST";
36+
req.ContentType = "application/x-www-form-urlencoded";
37+
System.IO.Stream stream = req.GetRequestStream();
38+
stream.Write(data, 0, data.Length);
39+
stream.Close();
40+
41+
WebResponse res = req.GetResponse();
42+
System.IO.Stream resStream = res.GetResponseStream();
43+
System.IO.StreamReader sr = new System.IO.StreamReader(resStream, enc);
44+
string html = sr.ReadToEnd();
45+
sr.Close();
46+
47+
resStream.Close();
48+
}
49+
}
50+
}

bin/Debug/README.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
twi.exe.configにtwitterユーザー名とパスワードを指定してください。
2+
あとは、
3+
twi.exe ほげほげメッセージ
4+
と打つと、Twitterに書き込みます。

bin/Debug/twi.exe

20 KB
Binary file not shown.

bin/Debug/twi.exe.config

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
<add key="url" value="http://twitter.com/statuses/update.xml" />
5+
<add key="username" value="ゆーざーめい" />
6+
<add key="password" value="ぱすわーど" />
7+
</appSettings>
8+
</configuration>

bin/Debug/twi.pdb

17.5 KB
Binary file not shown.

bin/Debug/twi.vshost.exe

5.5 KB
Binary file not shown.

bin/Debug/twi.vshost.exe.config

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
<add key="url" value="http://twitter.com/statuses/update.xml" />
5+
<add key="username" value="ゆーざーめい" />
6+
<add key="password" value="ぱすわーど" />
7+
</appSettings>
8+
</configuration>

bin/Release/README.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
twi.exe.configにtwitterユーザー名とパスワードを指定してください。
2+
あとは、
3+
twi.exe ほげほげメッセージ
4+
と打つと、Twitterに書き込みます。

bin/Release/twi.exe

20 KB
Binary file not shown.

bin/Release/twi.exe.config

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<appSettings>
4+
<add key="url" value="http://twitter.com/statuses/update.xml" />
5+
<add key="username" value="ゆーざーめい" />
6+
<add key="password" value="ぱすわーど" />
7+
</appSettings>
8+
</configuration>

bin/Release/twi.pdb

17.5 KB
Binary file not shown.

twi.csproj

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<PropertyGroup>
3+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
4+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
5+
<ProductVersion>8.0.50727</ProductVersion>
6+
<SchemaVersion>2.0</SchemaVersion>
7+
<ProjectGuid>{4ADC6B45-D2E1-4E7A-96F3-B304E742630D}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>potwitter</RootNamespace>
11+
<AssemblyName>twi</AssemblyName>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>full</DebugType>
16+
<Optimize>false</Optimize>
17+
<OutputPath>bin\Debug\</OutputPath>
18+
<DefineConstants>DEBUG;TRACE</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
23+
<DebugType>pdbonly</DebugType>
24+
<Optimize>true</Optimize>
25+
<OutputPath>bin\Release\</OutputPath>
26+
<DefineConstants>TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<ItemGroup>
31+
<Reference Include="System" />
32+
<Reference Include="System.configuration" />
33+
<Reference Include="System.Data" />
34+
<Reference Include="System.Web" />
35+
<Reference Include="System.Windows.Forms" />
36+
<Reference Include="System.Xml" />
37+
</ItemGroup>
38+
<ItemGroup>
39+
<Compile Include="Twi.cs" />
40+
<Compile Include="Properties\AssemblyInfo.cs" />
41+
<EmbeddedResource Include="Properties\Resources.resx">
42+
<Generator>ResXFileCodeGenerator</Generator>
43+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
44+
<SubType>Designer</SubType>
45+
</EmbeddedResource>
46+
<Compile Include="Properties\Resources.Designer.cs">
47+
<AutoGen>True</AutoGen>
48+
<DependentUpon>Resources.resx</DependentUpon>
49+
</Compile>
50+
<None Include="App.config" />
51+
<None Include="Properties\Settings.settings">
52+
<Generator>SettingsSingleFileGenerator</Generator>
53+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
54+
</None>
55+
<Compile Include="Properties\Settings.Designer.cs">
56+
<AutoGen>True</AutoGen>
57+
<DependentUpon>Settings.settings</DependentUpon>
58+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
59+
</Compile>
60+
</ItemGroup>
61+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
62+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
63+
Other similar extension points exist, see Microsoft.Common.targets.
64+
<Target Name="BeforeBuild">
65+
</Target>
66+
<Target Name="AfterBuild">
67+
</Target>
68+
-->
69+
</Project>

twi.sln

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 9.00
3+
# Visual C# Express 2005
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "twi", "twi.csproj", "{4ADC6B45-D2E1-4E7A-96F3-B304E742630D}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{4ADC6B45-D2E1-4E7A-96F3-B304E742630D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{4ADC6B45-D2E1-4E7A-96F3-B304E742630D}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{4ADC6B45-D2E1-4E7A-96F3-B304E742630D}.Release|Any CPU.ActiveCfg = Release|Any CPU
15+
{4ADC6B45-D2E1-4E7A-96F3-B304E742630D}.Release|Any CPU.Build.0 = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(SolutionProperties) = preSolution
18+
HideSolutionNode = FALSE
19+
EndGlobalSection
20+
EndGlobal

0 commit comments

Comments
 (0)