Example #1
0
        private void GroupProfileHandler(GroupProfile profile)
        {
            Profile = profile;

            Invoke(new MethodInvoker(UpdateProfile));

            byte[] j2cdata;
            if (Group.InsigniaID != null)
            {
                j2cdata = Client.Images.RequestImage(Group.InsigniaID);
            }
            else
            {
                // ???
                j2cdata = Client.Images.RequestImage("c77a1c21-e604-7d2c-2c89-5539ce853466");
            }

            byte[] imagedata = JasperWrapper.jasper_decode_j2c_to_tiff(j2cdata);

            //
            MemoryStream imageStream = new MemoryStream(imagedata, false);
            Image        image       = Image.FromStream(imageStream, false, false);

            //

            picInsignia.Image = image;
        }
Example #2
0
        protected void doStuff()
        {
            if (_Put)
            {
                Console.WriteLine("Reading: " + _FileName);

                byte[] j2cdata;

                if (_Rate != 0)
                {
                    j2cdata = KakaduWrap.ReadJ2CData(_FileName, _Rate);
                }
                else
                {
                    j2cdata = KakaduWrap.ReadJ2CData(_FileName);
                }


                _Client.Inventory.DownloadInventory();

                Console.WriteLine("Connecting to your Texture folder...");
                InventoryFolder iFolder = _Client.Inventory.getFolder("Textures");

                Console.WriteLine("Uploading Texture...");
                InventoryImage image = iFolder.NewImage(_FileName, "ImageTool Upload", j2cdata);
                Console.WriteLine("Asset id = " + image.AssetID.ToStringHyphenated());
            }
            else
            {
                foreach (LLUUID ImageID in _ImageIDs)
                {
                    string FileName;
                    if (_ImageIDs.Count > 1)
                    {
                        FileName = ImageID.ToString();
                    }
                    else
                    {
                        FileName = _FileName;
                    }

                    Console.WriteLine("Downloading: " + ImageID);

                    int    start = Environment.TickCount;
                    byte[] j2cdata;

                    try
                    {
                        j2cdata = _Client.Images.RequestImage(ImageID);

                        int end = Environment.TickCount;
                        Console.WriteLine("Elapsed download time, in TickCounts: " + (end - start));

                        Console.WriteLine("Image Data Length :" + j2cdata.Length);

                        Console.WriteLine("Writing to: " + FileName + ".tif");
                        File.WriteAllBytes(FileName + ".tif", JasperWrapper.jasper_decode_j2c_to_tiff(j2cdata));

                        Console.WriteLine("Writing to: " + FileName + ".tga");
                        File.WriteAllBytes(FileName + ".tga", JasperWrapper.jasper_decode_j2c_to_tga(j2cdata));
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("ERROR: Can't download image :: " + e.Message);
                    }
                }
            }

            Console.WriteLine("Done...");
        }
 public void RunMe()
 {
     File.WriteAllBytes(filename, JasperWrapper.jasper_decode_j2c_to_tiff(j2cdata));
 }