Example #1
0
        protected new void doStuff()
        {
            InventoryFolder iFolder = AgentInventory.getFolder("Textures");

            iFolder = iFolder.CreateFolder(Helpers.GetUnixTime().ToString());

            Console.WriteLine("Uploading images:");

            string[] files = Directory.GetFiles(ImageDirectory, "*.tif");

            int filesUploaded = 0;

            foreach (string file in files)
            {
                byte[] j2cdata = null;
                try
                {
                    j2cdata = KakaduWrap.ReadJ2CData(file);
                } catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
                if (j2cdata != null)
                {
                    Console.WriteLine(file);
                    iFolder.NewImage(Path.GetFileName(file), "ImageTool Upload", j2cdata);

                    if (++filesUploaded >= 20)
                    {
                        break;
                    }
                }
            }
        }
Example #2
0
        private void mkdir(string[] cmdLine)
        {
            if (cmdLine.Length < 2)
            {
                Console.WriteLine("Usage: mkdir [directory]");
                Console.WriteLine("Example: mkdir SubDir");
                return;
            }

            string targetDir = combineCmdArg(cmdLine);

            InventoryFolder iFolder = AgentInventory.getFolder(curDirectory);

            InventoryFolder newFolder = iFolder.CreateFolder(targetDir);

            if (newFolder != null)
            {
                Console.WriteLine("Directory created: " + targetDir);
            }
            else
            {
                Console.WriteLine("Error creating directory: " + targetDir);
            }
        }