예제 #1
0
        static void Main(string[] args)
        {
            if ((File.Exists("libjasper.dll") == false))
            {
                Console.WriteLine("You need a copy of libjasper.dll, it can be found in SVN in the main trunk inside libjaspernet");
                return;
            }

            if (args.Length < 5)
            {
                ImageTool.Usage();
                return;
            }


            List <LLUUID> uuidList = new List <LLUUID>();
            string        filename = "";
            bool          put      = false;
            double        rate     = 0;

            if (args[3].ToLower().Equals("put"))
            {
                put = true;
                if (args.Length == 6)
                {
                    double.TryParse(args[4], out rate);
                    filename = args[5];
                }
                else
                {
                    filename = args[4];
                }
            }
            else if (args[3].ToLower().Equals("getfile"))
            {
                if (args.Length < 5)
                {
                    ImageTool.Usage();
                    return;
                }

                foreach (string id in File.ReadAllLines(args[4]))
                {
                    uuidList.Add(id);
                }
            }
            else
            {
                if (args.Length < 6)
                {
                    ImageTool.Usage();
                    return;
                }

                uuidList = new List <LLUUID>();
                uuidList.Add(new LLUUID(args[4]));
                if (args.Length == 6)
                {
                    filename = args[5];
                }
                else if (!args[4].ToLower().EndsWith(".j2c"))
                {
                    filename = args[4] + ".j2c";
                }
            }

            ImageTool it = new ImageTool(uuidList, filename, put, rate);


            if (it.Connect(args[0], args[1], args[2]))
            {
                if (it.ConnectedSignal.WaitOne(TimeSpan.FromMinutes(1), false))
                {
                    it.doStuff();

                    it.Disconnect();
                }
            }
        }
예제 #2
0
        static new void Main(string[] args)
        {
            if ((File.Exists("libjasper.dll") == false))
            {
                Console.WriteLine("You need a copy of libjasper.dll, it can be found in SVN in the main trunk inside libjaspernet");
                return;
            }

            if (args.Length < 5)
            {
                ImageTool.Usage();
                return;
            }


            List <LLUUID> uuidList = new List <LLUUID>();
            string        filename = "";
            bool          put      = false;
            double        rate     = 0;

            if (args[3].ToLower().Equals("put"))
            {
                put = true;
                if (args.Length == 6)
                {
                    double.TryParse(args[4], out rate);
                    filename = args[5];
                }
                else
                {
                    filename = args[4];
                }
            }
            else if (args[3].ToLower().Equals("getfile"))
            {
                if (args.Length < 5)
                {
                    ImageTool.Usage();
                    return;
                }

                foreach (string id in File.ReadAllLines(args[4]))
                {
                    uuidList.Add(id);
                }
            }
            else
            {
                if (args.Length < 6)
                {
                    ImageTool.Usage();
                    return;
                }

                uuidList = new List <LLUUID>();
                uuidList.Add(new LLUUID(args[4]));
                if (args.Length == 6)
                {
                    filename = args[5];
                }
                else if (!args[4].ToLower().EndsWith(".j2c"))
                {
                    filename = args[4] + ".j2c";
                }
            }

            ImageTool it = new ImageTool(uuidList, filename, put, rate);

            // Only download the inventory tree if we're planning on putting/uploading files.
            it.DownloadInventoryOnConnect = put;

            if (it.Connect(args[0], args[1], args[2]))
            {
                it.doStuff();
                it.Disconnect();

                System.Threading.Thread.Sleep(500);

                Console.WriteLine("Done logging out.");
            }
        }