用C#实现Fetion2008聊天记录的备份

前面我共享了个备份工具Fetion2008聊天记录的备份,下面是源码;

Read More »

很久没有更新了

实在抱歉,很多留言没有及时回复,年后比较忙,最近刚出差回来。

Silverlight 2 Beta

Silverlight 2 includes a cross-platform, cross-browser version of the .NET Framework, and enables a rich .NET development platform that runs in the browser. Developers can write Silverlight applications using any .NET language (including VB, C#, JavaScript, IronPython and IronRuby). We will ship Visual Studio 2008 and Expression Studio tool support that enables great developer / designer workflow and integration when building Silverlight applications.

Read More »

2008新年快乐!

点击看图片大图。

2008新年快乐!

[转]安装 Sco Unixware 7.1.1

安装UNIXWARE7.1.1在IBM X系列SERVER上过程
(一)、UnixWare7.1.1的安装介质
注:操作系统所带三张软盘不用(由于主机主频大1G)
使用以下介质:
两张是启动盘(主频大1G的机器,需要在UNIX网占上下载boot1、boot2)
一张PTF盘(网上可下载)
HBA1盘(IPS Server Raid 阵列卡,使用机器所带磁盘库导出)
HBA2盘(LSI Ultra320 SCSI,使用机器所带磁盘库导出)
三张光盘
Read More »

SharpOS 0.0.1

The SharpOS project has completed a proof-of-concept implementation of an operating system kernel written in C#; offers basic kernel subsystems as well as interactive diagnostics shell.

SharpOS

More : http://www.sharpos.org/

C#版万年历

首先说明的是这段代码不是我100%原创,部分代码在网上都可以搜到,在使用时感觉内容不是很全面,便对其进行了扩展,加入了星宿、时辰、当前日期前一节气、后一节气等等,个人感觉已经比较全了。欢迎大家在使用时提出意见。

应用时调用DotNetThink.data命名空间。

//只是列出了部分信息的输出,其它输出可以自己选择。
DateTime dt = DateTime.Now;
ChineseCalendar cc = new ChineseCalendar(dt);
Console.WriteLine("阳历:" + cc.DateString);
Console.WriteLine("属相:" + cc.AnimalString);
Console.WriteLine("农历:" + cc.ChineseDateString);
Console.WriteLine("时辰:" + cc.ChineseHour);
Console.WriteLine("节气:" + cc.ChineseTwentyFourDay);
Console.WriteLine("节日:" + cc.DateHoliday);
Console.WriteLine("前一个节气:" + cc.ChineseTwentyFourPrevDay);
Console.WriteLine("后一个节气:" + cc.ChineseTwentyFourNextDay);
Console.WriteLine("干支:" + cc.GanZhiDateString);
Console.WriteLine("星期:" + cc.WeekDayStr);
Console.WriteLine("星宿:" + cc.ChineseConstellation);
Console.WriteLine("星座:" + cc.Constellation);

Read More »

Fetion2008聊天记录的备份

现在飞信2008体验版暂且没有聊天记录的导出、导入功能。从我前面的一篇文章(飞信2008(Fetion)聊天数据的存储)可以看到,只要备份三个表的数据就行了,即:Player,MessageBody,Message。

我用C#写的一个简单的聊天记录备份、导入小工具。

fetion.jpg

飞信备份工具下载(解压密码:dotnetthink.com)

C#里取系统的环境变量

用C#可以很简单就得到系统的环境变量及其值,取环境变量时用到这个命名空间:System.Collections。

IDictionary environment = Environment.GetEnvironmentVariables();
foreach (string environmentKey in environment.Keys)
{
    Console.WriteLine(string.Format("{0}:{1}",environmentKey,environment[environmentKey].ToString()));
}

基于Base64编码,标准Gzip压缩的两个函数

xml文件操作时挺有用,可以压缩减少文件尺寸。

压缩:

public static string Compress(string code_type, string text)
{
    byte[] buffer = Encoding.GetEncoding(code_type).GetBytes(text);
    MemoryStream ms = new MemoryStream();
    using (GZipStream zip = new GZipStream(ms, CompressionMode.Compress, true))
    {
        zip.Write(buffer, 0, buffer.Length);
    }

    ms.Position = 0;
    MemoryStream outStream = new MemoryStream();

    byte[] compressed = new byte[ms.Length];
    ms.Read(compressed, 0, compressed.Length);

    byte[] gzBuffer = new byte[compressed.Length];
    System.Buffer.BlockCopy(compressed, 0, gzBuffer, 0, compressed.Length);
 
    return Convert.ToBase64String(gzBuffer);
}

Read More »