示例#1
0
    static void drawTree(double centerX, double centerY, double length, double depth)
    {
        var center = new HTree(centerX, centerY, length, depth);

        // recurse until depth reaches final
        visitNode(center);
    }
示例#2
0
        private static void CreateVersionDbWindow()
        {
            CreateDialog dlg = new CreateDialog(null, "files", "versiondb");

            dlg.ShowDialogEx();
            HTree.CallRefreshRoot();
        }
示例#3
0
    static void visitNode(HTree current)
    {
        if (current.Depth <= 0)
        {
            return;
        }

        drawHLines(current);
        visitNode(new HTree(current.VerticalLineLeft.P1.X, current.VerticalLineLeft.P1.Y, current.Length / 2, current.Depth - 1));
        visitNode(new HTree(current.VerticalLineLeft.P2.X, current.VerticalLineLeft.P2.Y, current.Length / 2, current.Depth - 1));
        visitNode(new HTree(current.VerticalLineRight.P1.X, current.VerticalLineRight.P1.Y, current.Length / 2, current.Depth - 1));
        visitNode(new HTree(current.VerticalLineRight.P2.X, current.VerticalLineRight.P2.Y, current.Length / 2, current.Depth - 1));
    }
示例#4
0
            public DecodeInfo(string input)
            {
                Decoder = new HTree();
                string decompressedInput = "";

                for (int i = 0; i < input.Length; i++)
                {
                    string bits = Convert.ToString((int)input[i], 2);
                    while (bits.Length < 16 && i != input.Length - 1)
                    {
                        bits = "0" + bits;
                    }
                    //while (bits[0] != '1')
                    //    bits.Remove(0, 1);
                    decompressedInput += bits;
                }
                value = Decoder.Decode(decompressedInput);
            }
示例#5
0
            public CodeInfo(string input)
            {
                Coder = new HTree();
                string bits = Coder.Code(input);

                value = bits;
                string CompressInput = "";

                while (bits.Length >= 16)
                {
                    CompressInput += (char)Convert.ToInt32(bits.Substring(0, 16), 2);
                    bits           = bits.Substring(16);
                }
                if (bits.Length != 0)
                {
                    CompressInput += (char)Convert.ToInt32(bits, 2);
                }
                CompressedValue = CompressInput;
            }
示例#6
0
 public override bool SaveAs()
 {
     if (!Directory.Exists(Core.ChartsDirectory))
     {
         Directory.CreateDirectory(Core.ChartsDirectory);
     }
     saveFileDialog1.InitialDirectory = Core.ChartsDirectory;
     saveFileDialog1.CustomPlaces.Add(Core.ChartsDirectory);
     if (saveFileDialog1.ShowDialogEx() == DialogResult.OK)
     {
         m_file = new DiskFile(saveFileDialog1.FileName);
         ChangedWinId();
         Save();
         UpdateTitle();
         m_modified = false;
         if (!IOTool.RelativePathTo(Core.ScriptsDirectory, saveFileDialog1.FileName).StartsWith(".."))
         {
             HTree.CallRefreshRoot();
         }
         return(true);
     }
     return(false);
 }
示例#7
0
 static void drawHLines(HTree ht)
 {
     drawLine(ht.Depth, ht.HorizontalLine.P1, ht.HorizontalLine.P2);
     drawLine(ht.Depth, ht.VerticalLineLeft.P1, ht.VerticalLineLeft.P2);
     drawLine(ht.Depth, ht.VerticalLineRight.P1, ht.VerticalLineRight.P2);
 }