Logging

いらない自作アプリ(個人用)苦笑交じり(´・ω・`)

いらない自作アプリをVC#で作りました(´・ω・`)。 殆どの人がいらないと思うアプリですが 自分にとっては、結構重宝するアプリだったりします。 ちなみにプロセスの管理とかしていないので エラーで落ちちゃう恐れとかあります。 そこはご愛嬌でよろしくお願いします。 中身のコードは少し他人のコードを コピペで使わさせてもらっている所ありです。 また、解像度によりうまく表示されない事もあります。 まさに、自分だけのためのアプリなのです。 (そんな場合は最大化www) これで何が出来るのかといえば・・・ httpd.confのバーチャルホスト設定のファイル作成を 自動で吐き出してくれます。ついでにhostsファイルも 吐き出します。 コードはこんな感じ。 DLしたい奇特な方用:https://zip358.com/tool/httpconf.zip
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace httpdconf
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void make_btn_Click(object sender, EventArgs e)
        {
            Boolean flg_1;
            Boolean flg_2;
            Boolean flg_3;
            string conf_str;
            string stCurrentDir = System.Environment.CurrentDirectory;
            flg_1 = chk_text(host_name.Text);
            flg_2 = chk_text(ip_address.Text);
            flg_3 = chk_text(dc_root.Text);
            if (flg_1 && flg_2 && flg_3) {
                conf_str = @"
<VirtualHost *:80>
DocumentRoot " + dc_root.Text + host_name.Text + @"
ServerName " + host_name.Text + @"
" + option_text.Text + @"
ErrorLog logs/virtual.host-" + host_name.Text + @"-error_log
CustomLog logs/virtual.host-access-" + host_name.Text + @"_log combined
</VirtualHost>";
                midashi.Text = conf_str;
                IPAD.Text = ip_address.Text + " " + host_name.Text;
                wte(stCurrentDir, "/vhost-" + host_name.Text, midashi, "conf");
                wte(stCurrentDir, "/hosts_win_" + host_name.Text, IPAD, "txt");
                System.Diagnostics.Process.Start(stCurrentDir);
            }
        }
        public Boolean chk_text(string str) {
            if (str == "") {
                return (false);
            }
            return (true);
        }
        public void wte(string dir, string fname, TextBox txt_str, string ext)
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(
                dir + fname + "." + ext,
                false,
                System.Text.Encoding.GetEncoding("utf-8"));
            foreach (string line in txt_str.Lines)
            {
                sw.Write(line + sw.NewLine);
            }
            sw.Close();
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            linkLabel1.LinkVisited = true;
            System.Diagnostics.Process.Start("https://twitter.com/zip358com");
        }
    }
}
動作画面







    映画、秘密THE TOP SECRETを観てきましたので #映画レビュー #秘密前のページ

    高知県では上映されない映画だけど観てみたい映画。次のページ

    関連記事

    1. Logging

      空メールでゴニョゴニョしてって頼まれた。

      むかし勤めてたとある会社で指定メールに空メールを送ると会員になるとい…

    2. Logging

      ベイマクッス観てきましたのでレビュー(´Д⊂グスンと言うより。

      ベイマクッス字幕版を観てきましたのでレビューなんか書いときます。仕事…

    3. Logging

      南海トラフ地震はタイムプレディクタブルモデルで大体分かる!?

      昨日は自転車で高知県の高須にある宮脇書店に行ってきました、行きより帰…

    4. Logging

      猫でもできるjsでゴリゴリ

      有言実行ということで、ゴリゴリJSのサンプル書いてみました。と言っ…

    5. Logging

      映画:チャーリー・モルデカイ:華麗なる名画の秘密{ちょびヒゲ美術商人}

      2015年2月上映予定の映画、チャーリー・モルデカイ:華麗なる名画の…

    6. Logging

      文字化けがモヤモヤした件:Unicodeめ!!とか機種依存文字とかの話。

      文字化けがモヤモヤした件:Unicodeめ!!とか機種依存文…

    2016年8月
    1234567
    891011121314
    15161718192021
    22232425262728
    293031  

    カテゴリー

    アーカイブ

    PAGE TOP