Chuck's Blog

技术、读书与思考

概述

最近研究了ASP.NET,发现一个问题,比方说在页面里面有个Button,要点击以后要打开新窗口,而且新窗口的URL是根据用户选择结果动态产生的。LinkButton的代码这样写:

protected void ServiceManHistoryButton_Click(object sender, EventArgs e)
{
Response.Write("<script>window.open('EquipmentHistory.aspxeid="+ServiceManDropDownList.SelectedValue + "');</script>");
}
阅读全文 »

概述

1、合并file1.dll、file2.dll到destination.dll
ILmerge /ndebug /target:dll /out:C:\destination.dll /log C:\file1.dll C:\file2.dll
2、合并file1.dll、file2.dll以及myApp.exe到newApp.exe
ILmerge /ndebug /target:winexe /out:C:\newApp.exe /log C:\myapp.exe C:\file1.dll C:\file2.dll

详细内容

阅读全文 »

概述

近几天研究了有关验证码识别的一些问题,后来先选取了校内比较简单的验证码来开刀了。。。

详细内容

阅读全文 »

概述

自己写的哦所以共享出来了

using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.Globalization;
using System.IO;

## 详细内容

namespace what

{
    class DES    {
        // 创建Key
        public string GenerateKey()
        {
            DESCryptoServiceProvider desCrypto = (DESCryptoServiceProvider)

DESCryptoServiceProvider.Create();
            return ASCIIEncoding.ASCII.GetString(desCrypto.Key);
        }
        // 加密字符串
        public string EncryptString(string sInputString, string sKey)
        {
            byte[] data = Encoding.UTF8.GetBytes(sInputString);
            DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
            DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
            DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
            ICryptoTransform desencrypt = DES.CreateEncryptor();
            byte[] result = desencrypt.TransformFinalBlock(data, 0, data.Length);
            return BitConverter.ToString(result);
        }
        // 解密字符串
        public string DecryptString(string sInputString, string sKey)
        {
            string[] sInput = sInputString.Split("-".ToCharArray());
            byte[] data = new byte[sInput.Length];
            for (int i = 0; i < sInput.Length; i++)
            {
                data[i] = byte.Parse(sInput[i], NumberStyles.HexNumber);
            }
            DESCryptoServiceProvider DES = new DESCryptoServiceProvider();
            DES.Key = ASCIIEncoding.ASCII.GetBytes(sKey);
            DES.IV = ASCIIEncoding.ASCII.GetBytes(sKey);
            ICryptoTransform desencrypt = DES.CreateDecryptor();
            byte[] result = desencrypt.TransformFinalBlock(data, 0, data.Length);
            return Encoding.UTF8.GetString(result);
        }

}

}
阅读全文 »

概述

上节说到生成了C#的API函数进行调用,那么下面我们就来调用试试吧~哈

 LASReader lasreader = new LASReader(fname);
                    LASPoint laspoint;

## 详细内容

LASHeader lasheader = lasreader.GetHeader();
                     int point_no = 0;
                    StreamWriter sw = new StreamWriter(savefname);
                    sw.WriteLine("File Name: " + fname);
                     while (lasreader.GetNextPoint())
                      {
                            point_no += 1;
                            laspoint = lasreader.GetPoint();
                            sw.WriteLine("Point NO." + point_no + " X=" + laspoint.X + ", Y=" + laspoint.Y + ", Z=" + laspoint.Z + " Intensity=" + laspoint.Intensity.ToString()
                                + " ReturnNumber=" + laspoint.ReturnNumber + " NumberofReturns=" + laspoint.NumberOfReturns + " ScanDirectionFlag=" + laspoint.ScanDirection
                                + " EdgeofFlightLine=" + laspoint.FlightLineEdge + " Classification=" + laspoint.Classification + " ScanAngleRank=" + laspoint.ScanAngleRank
                                + " UserData=" + laspoint.UserData);
                       }
阅读全文 »

概述

上节说到读取点的全部信息,那么头文件的信息呢?

LASReader lasreader = new LASReader(fname);
LASPoint laspoint;
LASHeader lasheader = lasreader.GetHeader();

## 详细内容

double x_max = lasheader.GetMaxX();
double x_min = lasheader.GetMinX();
double y_max = lasheader.GetMaxY();
double y_min = lasheader.GetMinY();
double z_max = lasheader.GetMaxZ();
double z_min = lasheader.GetMinZ();
string filesignature = lasheader.FileSignature;
string softwareid = lasheader.SoftwareId;
string version = lasheader.VersionMajor.ToString() + "." + lasheader.VersionMinor.ToString();
int headersize = lasheader.HeaderSize;
string createyear = lasheader.CreationYear.ToString();
double x_offset = lasheader.GetOffsetX();
double y_offset = lasheader.GetOffsetY();
double z_offset = lasheader.GetOffsetZ();

txt_info.AppendText("LAS Info");
txt_info.AppendText("\r\n");
txt_info.AppendText("File name:" + fname);
txt_info.AppendText("\r\n");
txt_info.AppendText("Version: " + version);
txt_info.AppendText("\r\n");
txt_info.AppendText("Create Year: " + createyear);
txt_info.AppendText("\r\n");
txt_info.AppendText("Header Size: " + headersize);
txt_info.AppendText("\r\n");
txt_info.AppendText("ProjectId: " + lasheader.ProjectId);
txt_info.AppendText("\r\n");
txt_info.AppendText("Number of Points: " + lasheader.PointRecordsCount.ToString());          txt_info.AppendText("\r\n");
txt_info.AppendText("Number of Points by Return1: " + lasheader.GetPointRecordsByReturnCount(0));
txt_info.AppendText("\r\n");
txt_info.AppendText("Number of Points by Return2: " + lasheader.GetPointRecordsByReturnCount(1));
txt_info.AppendText("\r\n");
txt_info.AppendText("Number of Points by Return3: " + lasheader.GetPointRecordsByReturnCount(2));
txt_info.AppendText("\r\n");
txt_info.AppendText("Number of Points by Return4: " + lasheader.GetPointRecordsByReturnCount(3));
txt_info.AppendText("\r\n");
txt_info.AppendText("Number of Points by Return5: " + lasheader.GetPointRecordsByReturnCount(4));
txt_info.AppendText("\r\n");
txt_info.AppendText("X Min: " + x_min);
txt_info.AppendText("\r\n");
txt_info.AppendText("X Max: " + x_max);
txt_info.AppendText("\r\n");
txt_info.AppendText("Y Min: " + y_min);
txt_info.AppendText("\r\n");
txt_info.AppendText("Y Max: " + y_max);
txt_info.AppendText("\r\n");
txt_info.AppendText("Z Min: " + z_min);
txt_info.AppendText("\r\n");              
txt_info.AppendText("Z Max: " + z_max);
txt_info.AppendText("\r\n");
txt_info.AppendText("X Offset: " + x_offset);
txt_info.AppendText("\r\n");
txt_info.AppendText("Y Offset: " + y_offset);
txt_info.AppendText("\r\n");
txt_info.AppendText("Z Offset: " + z_offset);
txt_info.AppendText("\r\n");
txt_info.AppendText("X Scale Factor: " + lasheader.GetScaleX().ToString());
txt_info.AppendText("\r\n");
txt_info.AppendText("Y Scale Factor: " + lasheader.GetScaleY().ToString());
txt_info.AppendText("\r\n");
txt_info.AppendText("Z Scale Factor: " + lasheader.GetScaleZ().ToString());
txt_info.AppendText("\r\n");
阅读全文 »