Example #1
0
 protected override void OnMouseDown(int x, int y, MouseButtonType button)
 {
     if (button == MouseButtonType.Left)
     {
         if (IsEditable)
         {
             SetKeyboardFocus();
         }
         if (!NoSelection)
         {
             _leftWasDown = true;
         }
         if (_focusPage >= 0 && _focusPage < _pageCoords.GetLength(0))
         {
             if (_focusPage % 2 == 0)
             {
                 x -= RIGHT_X + _gump.X;
             }
             else
             {
                 x -= LEFT_X + _gump.X;
             }
             y += _pageCoords[_focusPage, 0] - (UPPER_MARGIN + _gump.Y);
         }
         Stb.Click(x, y);
         UpdateCaretScreenPosition();
         _caretPage = GetCaretPage();
     }
 }
Example #2
0
    static int Main(string[] args)
    {
        Console.WriteLine("SoftEther VPN Project");
        Console.WriteLine("STB File Multilanguage Full-Mesh Consistency Checker");
        Console.WriteLine("");

        if (args.Length != 1)
        {
            Console.WriteLine("Usage: dotnet run [hamcore_dir]");
            return(-1);
        }
        else
        {
            string hamcore_dir = args[0];

            string[] stb_files = Directory.GetFiles(hamcore_dir, "*.stb", SearchOption.TopDirectoryOnly);

            if (stb_files.Length == 0)
            {
                Console.WriteLine("Error: There are no .stb files in the directory '" + hamcore_dir + "'.");
                return(-1);
            }

            int total_num = 0;

            for (int i = 0; i < stb_files.Length; i++)
            {
                for (int j = 0; j < stb_files.Length; j++)
                {
                    if (i != j)
                    {
                        Console.WriteLine("---\nComparing '{1}' to '{0}'...", Path.GetFileName(stb_files[i]), Path.GetFileName(stb_files[j]));

                        total_num += Stb.Compare(stb_files[i], stb_files[j]);
                    }
                }
            }

            Console.WriteLine("--- Results ---");
            if (total_num == 0)
            {
                Console.WriteLine("OK: Excellent! There are no errors between multilanguage stb files.");
                Console.WriteLine();
                Console.WriteLine("   - In Jurassic Park: \"It's a UNIX system! I know this!\"");
                return(0);
            }
            else
            {
                Console.WriteLine($"ERROR: There are {total_num} errors on multilanguage stb files. Please kindly correct them before submitting us Pull Requests.");
                return(-3);
            }
        }
    }
Example #3
0
        static int StbChecker(ConsoleService c, string cmdName, string str)
        {
            ConsoleParam[] args =
            {
                new ConsoleParam("[dir]"),
            };
            ConsoleParamValueList vl = c.ParseCommandList(cmdName, str, args);

            string hamcore_dir = vl.DefaultParam.StrValue;

            if (Str.IsEmptyStr(hamcore_dir))
            {
                hamcore_dir = Path.Combine(Paths.UltraBinDirName, "hamcore");
            }

            string[] stb_files = Directory.GetFiles(hamcore_dir, "*.stb", SearchOption.TopDirectoryOnly);

            if (stb_files.Length == 0)
            {
                Console.WriteLine("Error: There are no .stb files in the directory '" + hamcore_dir + "'.");
                return(-1);
            }

            int total_num = 0;

            for (int i = 0; i < stb_files.Length; i++)
            {
                for (int j = 0; j < stb_files.Length; j++)
                {
                    if (i != j)
                    {
                        Console.WriteLine("---\nComparing '{1}' to '{0}'...", Path.GetFileName(stb_files[i]), Path.GetFileName(stb_files[j]));

                        total_num += Stb.Compare(stb_files[i], stb_files[j]);
                    }
                }
            }

            Console.WriteLine("--- Results ---");
            if (total_num == 0)
            {
                Console.WriteLine("OK: Excellent! There are no errors between multilanguage stb files.");
                Console.WriteLine();
                Console.WriteLine("   - In Jurassic Park: \"It's a UNIX system! I know this!\"");
                return(0);
            }
            else
            {
                Console.WriteLine($"ERROR: There are {total_num} errors on multilanguage stb files.");
                return(-3);
            }
        }
Example #4
0
        public static Texture2D FromStream(Stream stream)
        {
            if (DDS.StreamIsDDS(stream))
            {
                return((Texture2D)DDS.FromStream(stream));
            }
            else
            {
                /* Read full stream */
                int    len = (int)stream.Length;
                byte[] b   = new byte[len];
                int    pos = 0;
                int    r   = 0;
                while ((r = stream.Read(b, pos, len - pos)) > 0)
                {
                    pos += r;
                }
                /* stb_image it */
                int x, y, comp;
                Stb.stbi_set_flip_vertically_on_load(1);
                var data = Stb.stbi_load_from_memory(b, out x, out y, out comp, Stb.STBI_rgb_alpha);
                unsafe
                {
                    fixed(byte *d = data)
                    {
                        int j = 0;

                        for (int i = 0; i < data.Length; i += 4)
                        {
                            var R = d[i];
                            var G = d[i + 1];
                            var B = d[i + 2];
                            var A = d[i + 3];
                            d[j++] = B;
                            d[j++] = G;
                            d[j++] = R;
                            d[j++] = A;
                        }
                    }
                }
                var t = new Texture2D(x, y, false, SurfaceFormat.Color);
                t.SetData(data);
                return(t);
            }
        }
Example #5
0
 protected override void OnMouseOver(int x, int y)
 {
     if (_leftWasDown)
     {
         if (_focusPage >= 0 && _focusPage < _pageCoords.GetLength(0))
         {
             if (_focusPage % 2 == 0)
             {
                 x -= RIGHT_X + _gump.X;
             }
             else
             {
                 x -= LEFT_X + _gump.X;
             }
             y += _pageCoords[_focusPage, 0] - (UPPER_MARGIN + _gump.Y);
         }
         Stb.Drag(x, y);
     }
 }
Example #6
0
        /// <summary>
        /// Load a Texture2 from a file.
        /// </summary>
        /// <returns>The Texture2D.</returns>
        /// <param name="path">Path to the texture.</param>
        /// <param name = "config">The texture configuration.</param>
        public static Texture2D FromFile(string path, TextureConfiguration config)
        {
            // Throw if the file doesn't exist
            if (!File.Exists(path))
            {
                LogExtensions.ThrowStatic("Could not find file '{0}'", path);
            }

            Texture2D tex;

            // Load the image
            int x = -1, y = -1, n = -1;
            var data = Stb.Load(path, ref x, ref y, ref n, 4);

            tex = new Texture2D(config, x, y);
            tex.SetData(data, null);
            Stb.Free(data);
            // Return the texture
            return(tex);
        }
Example #7
0
    public static int Compare(string file1, string file2)
    {
        Stb stb1 = new Stb(file1, "File1");
        Stb stb2 = new Stb(file2, "File2");
        int num  = 0;

        string file1_fn = Path.GetFileName(file1);
        string file2_fn = Path.GetFileName(file2);

        foreach (string name1 in stb1.tableList.Keys)
        {
            if (name1.Equals("DEFAULT_FONT_WIN7", StringComparison.InvariantCultureIgnoreCase) ||
                name1.Equals("DEFAULT_FONT_HIGHDPI", StringComparison.InvariantCultureIgnoreCase))
            {
                continue;
            }

            StbTable t1 = stb1.tableList[name1];

            if (stb2.tableList.ContainsKey(name1) == false)
            {
                ShowError(stb2.name, string.Format("Missing '{0}'", t1.Name));
                num++;
            }
            else
            {
                StbTable t2 = stb2.tableList[name1];

                if (StbTable.CompareTagList(t1.TagList, t2.TagList) == false)
                {
                    ShowError(stb2.name, string.Format("Difference printf-style parameters '{0}'", t1.Name));
                    num++;
                }
            }
        }

        Console.WriteLine("\nThere are {0} errors.\n\n{1}\n", num,
                          (num == 0 ? "Good work! No problem!" : "You must correct them!"));

        return(num);
    }
Example #8
0
        public unsafe Image CreateResized(int newWidth, int newHeight)
        {
            var result = new Image
            {
                Comp       = Comp,
                SourceComp = SourceComp,
                Data       = new byte[newWidth * newHeight * Comp],
                Width      = newWidth,
                Height     = newHeight
            };

            fixed(byte *input = Data)
            {
                fixed(byte *output = result.Data)
                {
                    Stb.stbir_resize_uint8(input, Width, Height, Width * Comp, output, newWidth, newHeight, newWidth * Comp, Comp);
                }
            }

            return(result);
        }
Example #9
0
        //kendi toollarımızıda formun constructorunda initialize ettim aslında bunu partial class ta da yapabilirdim daha temiz olurdu fakat design file ının bozulmaması için burada yaptım.
        public Form1()
        {
            InitializeComponent();
            Ktn      ktn      = new Ktn();
            Lcw      lcw      = new Lcw();
            Stb      stb      = new Stb();
            Bgr      bgr      = new Bgr();
            Elevator elevator = new Elevator();
            Stairs   stairs   = new Stairs();
            Kiosk    kiosk1   = new Kiosk(1);
            Kiosk    kiosk2   = new Kiosk(2);
            Kiosk    kiosk3   = new Kiosk(3);

            ways.Add(ktn);
            ways.Add(lcw);
            ways.Add(stb);
            ways.Add(bgr);
            ways.Add(elevator);
            ways.Add(stairs);
            ways.Add(kiosk1);
            ways.Add(kiosk2);
            ways.Add(kiosk3);

            comboBox.Location = new Point(panel1.Width * 3 / 2 - 25, 100);
            comboBox.Items.Add(kiosk1);
            comboBox.Items.Add(kiosk2);
            comboBox.Items.Add(kiosk3);
            comboBox.SelectedIndex = 0;
            panel1.Controls.Add(comboBox);

            comboBox2.Location = new Point(panel1.Width * 3 / 2 - 25, 200);
            comboBox2.Items.Add(ktn);
            comboBox2.Items.Add(lcw);
            comboBox2.Items.Add(stb);
            comboBox2.Items.Add(bgr);
            comboBox2.SelectedIndex = 0;
            panel1.Controls.Add(comboBox2);

            button.Location = new Point(panel1.Width * 3 / 2, 250);
            button.Size     = new Size(75, 75);
            button.Text     = "YOLU GÖSTER";
            button.Click   += Button_Click;
            panel1.Controls.Add(button);

            bFloor1.Location = new Point(panel1.Width * 3 / 2 - 200, 200);
            bFloor1.Size     = new Size(75, 75);
            bFloor1.Text     = "1.KAT";
            bFloor1.Click   += BFloor1_Click;
            panel1.Controls.Add(bFloor1);

            bFloor2.Location = new Point(panel1.Width * 3 / 2 - 200, 100);
            bFloor2.Size     = new Size(75, 75);
            bFloor2.Text     = "2.KAT";
            bFloor2.Click   += BFloor2_Click;
            panel1.Controls.Add(bFloor2);


            label.Location = new Point(panel1.Width * 3 / 2 - 25, 350);
            label.AutoSize = true;
            panel1.Controls.Add(label);
        }
 public string ChangedLine()
 {//zapis lini według założonej kolejności
     NewLine = Number + " " + X.ToString("F3") + " " + Y.ToString("F3") + " " + H.ToString() + " " + Zrd.ToString() + " " + Bpp.ToString() + " " + Stb.ToString() + " " + Rzg.ToString();
     return(NewLine);
 }