Beispiel #1
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("The program has started.");
            if (args.Length == 3)
            {
                url      = args[0];
                username = args[1];
                password = args[2];
            }
            else if (debug == false)
            {
                url      = "http://www.stuntyleeg.com/";
                username = "******";
                password = "******";
                uploadzip uploadZip1 = new uploadzip();
                uploadZip1.Filename = "C:\\Documents and Settings\\username\\My Documents\\BloodBowl\\Match_2010-07-13_20-12-45.zip";
                uploadZip1.Password = password;
                uploadZip1.Url      = url;
                uploadZip1.Username = username;
                uploadZip1.Page     = page;
                uploadZip1.start();
                Console.ReadKey(true);
                Environment.Exit(1);
            }
            else
            {
                System.Console.WriteLine("This program accepts 3 arguments: url, username, and password.");
                System.Console.WriteLine("Please use the following example and follow it as closely as possible.");
                System.Console.WriteLine("OBBLMCyUploader.exe http://www.example.com/ \"user name\" \"this ismy_password\"");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                Environment.Exit(1);
            }

            string mydocs      = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string bbdir       = (Directory.Exists(mydocs + "\\BloodBowlLegendary\\")) ? mydocs + "\\BloodBowlLegendary\\" : mydocs + "\\BloodBowl\\";
            string matchreport = bbdir;
            string replay      = bbdir + "Saves\\Replays\\";
            string zipfile     = bbdir;

            FileSystemWatcher sw_replay = new FileSystemWatcher();

            Console.WriteLine("The replay folder is being monitored.");
            sw_replay.Path                = replay;
            sw_replay.Filter              = "Replay_*.db";
            sw_replay.Created            += new FileSystemEventHandler(OnChanged);
            sw_replay.EnableRaisingEvents = true;

            while (newfile == null)
            {
            }

            sw_replay.EnableRaisingEvents = false;

            replay   = newfile.FullPath;
            zipfile += "Match_" + newfile.Name.Substring(7, newfile.Name.Length - 7 - 3) + ".zip";//-7 for Replay_ and -3 for .db
            //Replay_2010-07-03_17-47-21.db
            newfile = null;

            FileSystemWatcher sw_matchreport = new FileSystemWatcher();

            System.Console.WriteLine("The match report folder is being monitored.");
            sw_matchreport.Path                = matchreport;
            sw_matchreport.Filter              = "MatchReport.sqlite";
            sw_matchreport.Changed            += new FileSystemEventHandler(OnChanged);
            sw_matchreport.EnableRaisingEvents = true;

            while (newfile == null)
            {
            }

            sw_matchreport.EnableRaisingEvents = false;

            matchreport += "MatchReport.sqlite";

            Shell32.ShellClass sc = new Shell32.ShellClass();
            if (createzip(zipfile))
            {
                Shell32.Folder DestFlder = sc.NameSpace(zipfile);
                DestFlder.CopyHere(matchreport);
                checkStatus(1, DestFlder);
                DestFlder.CopyHere(replay);
                checkStatus(2, DestFlder);
            }

            uploadzip uploadZip = new uploadzip();

            uploadZip.Filename = zipfile;
            uploadZip.Password = password;
            uploadZip.Url      = url;
            uploadZip.Page     = page;
            uploadZip.Username = username;
            uploadZip.start();

            Console.WriteLine("The program has finished.");
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey(true);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("The program has started.");
            if (args.Length == 3)
            {
                url = args[0];
                username = args[1];
                password = args[2];
            }
            else if (debug == false)
            {
                url = "http://www.stuntyleeg.com/";
                username = "******";
                password = "******";
                uploadzip uploadZip1 = new uploadzip();
                uploadZip1.Filename = "C:\\Documents and Settings\\username\\My Documents\\BloodBowl\\Match_2010-07-13_20-12-45.zip";
                uploadZip1.Password = password;
                uploadZip1.Url = url;
                uploadZip1.Username = username;
                uploadZip1.Page = page;
                uploadZip1.start();
                Console.ReadKey(true);
                Environment.Exit(1);
            }
            else
            {
                System.Console.WriteLine("This program accepts 3 arguments: url, username, and password.");
                System.Console.WriteLine("Please use the following example and follow it as closely as possible.");
                System.Console.WriteLine("OBBLMCyUploader.exe http://www.example.com/ \"user name\" \"this ismy_password\"");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                Environment.Exit(1);
            }

            string mydocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string bbdir = (Directory.Exists(mydocs + "\\BloodBowlLegendary\\")) ? mydocs + "\\BloodBowlLegendary\\" : mydocs + "\\BloodBowl\\";
            string matchreport = bbdir;
            string replay = bbdir + "Saves\\Replays\\";
            string zipfile = bbdir;

            FileSystemWatcher sw_replay = new FileSystemWatcher();
            Console.WriteLine("The replay folder is being monitored.");
            sw_replay.Path = replay;
            sw_replay.Filter = "Replay_*.db";
            sw_replay.Created += new FileSystemEventHandler(OnChanged);
            sw_replay.EnableRaisingEvents = true;

            while (newfile == null)
            {

            }

            sw_replay.EnableRaisingEvents = false;

            replay = newfile.FullPath;
            zipfile += "Match_" + newfile.Name.Substring(7,newfile.Name.Length-7-3)+".zip";//-7 for Replay_ and -3 for .db
            //Replay_2010-07-03_17-47-21.db
            newfile = null;

            FileSystemWatcher sw_matchreport = new FileSystemWatcher();
            System.Console.WriteLine("The match report folder is being monitored.");
            sw_matchreport.Path = matchreport;
            sw_matchreport.Filter = "MatchReport.sqlite";
            sw_matchreport.Changed += new FileSystemEventHandler(OnChanged);
            sw_matchreport.EnableRaisingEvents = true;

            while (newfile == null)
            {

            }

            sw_matchreport.EnableRaisingEvents = false;

            matchreport += "MatchReport.sqlite";

            Shell32.ShellClass sc = new Shell32.ShellClass();
            if (createzip(zipfile))
            {
                Shell32.Folder DestFlder = sc.NameSpace(zipfile);
                DestFlder.CopyHere(matchreport);
                checkStatus(1, DestFlder);
                DestFlder.CopyHere(replay);
                checkStatus(2, DestFlder);
            }

            uploadzip uploadZip = new uploadzip();
            uploadZip.Filename = zipfile;
            uploadZip.Password = password;
            uploadZip.Url = url;
            uploadZip.Page = page;
            uploadZip.Username = username;
            uploadZip.start();

            Console.WriteLine("The program has finished.");
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey(true);
        }