Exemple #1
0
        private static bool LaunchInt(string filename)
        {
            string mutexId = "Global\\foxScreenMutex";

            mutex = new Mutex(false, mutexId);

            MutexAccessRule allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);
            MutexSecurity   securitySettings  = new MutexSecurity();

            securitySettings.AddAccessRule(allowEveryoneRule);
            mutex.SetAccessControl(securitySettings);

            bool hasHandle = false;

            try
            {
                try
                {
                    hasHandle = mutex.WaitOne(100, false);
                    if (hasHandle == false)
                    {
                        mutex = null;
                        return(false);
                    }
                }
                catch (AbandonedMutexException)
                {
                    hasHandle = true;
                }

                uploadOrganizer   = new UploadOrganizer();
                screenshotManager = new ScreenshotManager(uploadOrganizer);

                if (filename != null)
                {
                    if (LoadCredentials())
                    {
                        uploadOrganizer.AddFileUpload(filename);
                    }
                }

                mainFrm = new frmMain();
                Application.Run(mainFrm);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                if (!hasHandle)
                {
                    mutex = null;
                }
                Stop();
            }

            return(true);
        }
Exemple #2
0
        private void frmDropArea_DragDrop(object sender, DragEventArgs e)
        {
            DragEnd();

            string[] files = e.Data.GetData(DataFormats.FileDrop) as string[];
            if (files != null)
            {
                foreach (string file in files)
                {
                    uploadOrganizer.AddFileUpload(file);
                }

                return;
            }

            string text = e.Data.GetData(DataFormats.Text) as string;

            if (text != null)
            {
                uploadOrganizer.AddUpload("paste.txt", new MemoryStream(System.Text.Encoding.ASCII.GetBytes(text)));
            }
        }
Exemple #3
0
        private static bool LaunchInt(string filename)
        {
            string mutexId = "Global\\foxScreenMutex";

            mutex = new Mutex(false, mutexId);

            MutexAccessRule allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow);
            MutexSecurity securitySettings = new MutexSecurity();
            securitySettings.AddAccessRule(allowEveryoneRule);
            mutex.SetAccessControl(securitySettings);

            bool hasHandle = false;
            try
            {
                try
                {
                    hasHandle = mutex.WaitOne(100, false);
                    if (hasHandle == false)
                    {
                        mutex = null;
                        return false;
                    }
                }
                catch (AbandonedMutexException)
                {
                    hasHandle = true;
                }

                uploadOrganizer = new UploadOrganizer();
                screenshotManager = new ScreenshotManager(uploadOrganizer);

                if (filename != null)
                {
                    if (LoadCredentials())
                    {
                        uploadOrganizer.AddFileUpload(filename);
                    }
                }

                mainFrm = new frmMain();
                Application.Run(mainFrm);
            }
            catch(Exception e)
            {
                MessageBox.Show(e.ToString());
                if (!hasHandle)
                {
                    mutex = null;
                }
                Stop();
            }

            return true;
        }