コード例 #1
0
ファイル: Program.cs プロジェクト: essences/studying
    static void Main()
    {/*
      * test();
      * var t = BoolList.ToBoolArray(0x12);
      * for(int i = 0 ; i < 8 ; i++ )
      *     Console.WriteLine(t[i]);
      *
      *
      * var a = new BoolList();
      * var b = new BoolList();
      * a.Add(false);
      * a.Add(false);
      * a.Add(false);
      * a.Add(true);
      * b.Add(false);
      * b.Add(true);
      *
      * Console.WriteLine(a.GetHashCode());
      * Console.WriteLine(b.GetHashCode());
      * Console.WriteLine(a==b);
      * Console.WriteLine(a+b);
      *
      * var dict = new Dictionary<BoolList,int>();
      *
      * //dict.Add(a,1);
      * //dict.Add(b,1);
      *
      * foreach(var k in dict.Keys)
      *     Console.WriteLine(dict[k]);
      *
      * return;
      */
        Console.WriteLine("1. zip");
        Console.WriteLine("2. unzip");

        var bdata = new BinaryData();
        var zip   = new ZipData();
        var png   = new PngData();


        if (int.Parse(Console.ReadLine()) == 1)
        {
            Console.WriteLine("Input original file path >>");

            // 情報源として読み取る
            bdata.Load(Console.ReadLine());
            // ハフマン符号化して読み取る
            zip.Load(bdata);
            // PNGデータとして読みとる
            png.Load(zip);

            Console.WriteLine("Input output file path >>");
            png.Save(Console.ReadLine());
        }
        else
        {
            Console.WriteLine("Input PNG file path >>");

            // PNGデータとして読みとる
            png.Load(Console.ReadLine());
            // ハフマン符号化して読み取る
            zip.Load(png);
            // 情報源として読み取る
            bdata.Load(zip);
            bdata.Save();
        }
    }