Inheritance: AddonHelper.Addon
Exemple #1
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            string path = GetPath(items.First());

            if (!path.StartsWith(Dropbox.BasePath))
            {
                path = GetLink(path);
            }

            string url = Dropbox.GetRevisionsUrl(path);

            Services.Environment.OpenUrl(url);

            yield break;
        }
Exemple #2
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            string url, path;
            Item   item = items.First();

            if (item is IApplicationItem)
            {
                url = Dropbox.GetWebUrl();
            }
            else
            {
                path = (item as IFileItem).Path;
                url  = Dropbox.GetWebUrl(path);
            }

            Services.Environment.OpenUrl(url);

            yield break;
        }
Exemple #3
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            string path;

            foreach (Item i in items)
            {
                path = GetPath(i);

                if (!path.StartsWith(Dropbox.PublicPath))
                {
                    path = GetLink(path);
                }

                string url = Dropbox.GetPubUrl(path);

                yield return(new BookmarkItem(url, url));
            }

            yield break;
        }
Exemple #4
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            string target, extension, filename, linkName, url;

            foreach (Item item in items)
            {
                target    = GetPath(item);
                extension = Path.GetExtension(target);
                filename  = Path.GetFileNameWithoutExtension(target);
                linkName  = Path.Combine(Dropbox.DoSharedPath,
                                         String.Format("{0}-{1}{2}", filename, rand.Next(), extension));

                Directory.CreateDirectory(Dropbox.DoSharedPath);

                if (MakeLink(target, linkName))
                {
                    url = Dropbox.GetPubUrl(linkName);
                    yield return(new BookmarkItem(url, url));
                }
            }
        }
Exemple #5
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            Dropbox.Stop();

            yield break;
        }
Exemple #6
0
        public FormSettings(Dropbox mainClass)
        {
            InitializeComponent();

            this.mainClass = mainClass;

            groupNoDropbox.Visible = !mainClass.DropboxInstalled;
            if (!mainClass.DropboxInstalled)
                return;

            textPath.Text = mainClass.dbPath;
            textHttp.Text = mainClass.dbHttp;

            int selIndex = 0;
            switch (mainClass.imageFormat.ToLower()) {
                case "png": selIndex = 0; break;
                case "jpg": selIndex = 1; break;
                case "gif": selIndex = 2; break;
            }
            comboFormat.SelectedIndex = selIndex;

            checkUseMD5.Checked = mainClass.useMD5;
            checkShortMD5.Checked = mainClass.shortMD5;
            numLength.Value = mainClass.length;

            checkJpegCompression.Checked = mainClass.jpegCompression;
            numJpegCompressionFilesize.Value = mainClass.jpegCompressionFilesize;
            numJpegCompressionRate.Value = mainClass.jpegCompressionRate;

            {
                string[] parts = mainClass.shortCutDragModifiers.Split('+');
                foreach (string part in parts) {
                    switch (part) {
                        case "Ctrl": checkDragModCtrl.Checked = true; break;
                        case "Alt": checkDragModAlt.Checked = true; break;
                        case "Shift": checkDragModShift.Checked = true; break;
                    }
                }
            }

            {
                string[] parts = mainClass.shortCutPasteModifiers.Split('+');
                foreach (string part in parts) {
                    switch (part) {
                        case "Ctrl": checkPasteModCtrl.Checked = true; break;
                        case "Alt": checkPasteModAlt.Checked = true; break;
                        case "Shift": checkPasteModShift.Checked = true; break;
                    }
                }
            }

            mainClass.PopulateKeysCombobox(comboDragKeys);
            mainClass.PopulateKeysCombobox(comboPasteKeys);

            comboDragKeys.SelectedItem = mainClass.shortCutDragKey;
            comboPasteKeys.SelectedItem = mainClass.shortCutPasteKey;

            if (textPath.Text == "") {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Dropbox\\config.db";
                if (File.Exists(path)) {
                    string dropboxPath = "";

                    try {
                        SQLiteConnection connection = new SQLiteConnection("Data Source=" + path);
                        connection.Open();
                        SQLiteCommand cmd = new SQLiteCommand(connection);
                        cmd.CommandText = "select * from config where \"key\"=\"dropbox_path\";";
                        SQLiteDataReader reader = cmd.ExecuteReader();

                        dropboxPath = Encoding.ASCII.GetString((byte[])reader[1]);

                        connection.Close();
                    } catch { }

                    if (dropboxPath != "")
                        textPath.Text = dropboxPath.Replace('\\', '/') + "/Public/";
                }
            }
        }
        public FormSettings(Dropbox mainClass)
        {
            InitializeComponent();

            this.mainClass = mainClass;

            groupNoDropbox.Visible = !mainClass.DropboxInstalled;
            if (!mainClass.DropboxInstalled)
            {
                return;
            }

            textPath.Text = mainClass.dbPath;
            textHttp.Text = mainClass.dbHttp;

            int selIndex = 0;

            switch (mainClass.imageFormat.ToLower())
            {
            case "png": selIndex = 0; break;

            case "jpg": selIndex = 1; break;

            case "gif": selIndex = 2; break;
            }
            comboFormat.SelectedIndex = selIndex;

            checkUseMD5.Checked   = mainClass.useMD5;
            checkShortMD5.Checked = mainClass.shortMD5;
            numLength.Value       = mainClass.length;

            {
                string[] parts = mainClass.shortCutDragModifiers.Split('+');
                foreach (string part in parts)
                {
                    switch (part)
                    {
                    case "Ctrl": checkDragModCtrl.Checked = true; break;

                    case "Alt": checkDragModAlt.Checked = true; break;

                    case "Shift": checkDragModShift.Checked = true; break;
                    }
                }
            }

            {
                string[] parts = mainClass.shortCutPasteModifiers.Split('+');
                foreach (string part in parts)
                {
                    switch (part)
                    {
                    case "Ctrl": checkPasteModCtrl.Checked = true; break;

                    case "Alt": checkPasteModAlt.Checked = true; break;

                    case "Shift": checkPasteModShift.Checked = true; break;
                    }
                }
            }

            mainClass.PopulateKeysCombobox(comboDragKeys);
            mainClass.PopulateKeysCombobox(comboPasteKeys);

            comboDragKeys.SelectedItem  = mainClass.shortCutDragKey;
            comboPasteKeys.SelectedItem = mainClass.shortCutPasteKey;

            if (textPath.Text == "")
            {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Dropbox\\config.db";
                if (File.Exists(path))
                {
                    string dropboxPath = "";

                    try {
                        SQLiteConnection connection = new SQLiteConnection("Data Source=" + path);
                        connection.Open();
                        SQLiteCommand cmd = new SQLiteCommand(connection);
                        cmd.CommandText = "select * from config where \"key\"=\"dropbox_path\";";
                        SQLiteDataReader reader = cmd.ExecuteReader();

                        dropboxPath = Encoding.ASCII.GetString((byte[])reader[1]);

                        connection.Close();
                    } catch { }

                    if (dropboxPath != "")
                    {
                        textPath.Text = dropboxPath.Replace('\\', '/') + "/Public/";
                    }
                }
            }
        }
        public FormSettings(Dropbox mainClass)
        {
            InitializeComponent();

              this.mainClass = mainClass;

              groupNoDropbox.Visible = !mainClass.DropboxInstalled;
              if (!mainClass.DropboxInstalled)
            return;

              textPath.Text = mainClass.dbPath;
              textHttp.Text = mainClass.dbHttp;

              int selIndex = 0;
              switch (mainClass.imageFormat.ToLower()) {
            case "png": selIndex = 0; break;
            case "jpg": selIndex = 1; break;
            case "gif": selIndex = 2; break;
              }
              comboFormat.SelectedIndex = selIndex;

              checkUseMD5.Checked = mainClass.useMD5;
              checkShortMD5.Checked = mainClass.shortMD5;
              numLength.Value = mainClass.length;

              checkJpegCompression.Checked = mainClass.jpegCompression;
              numJpegCompressionFilesize.Value = mainClass.jpegCompressionFilesize;
              numJpegCompressionRate.Value = mainClass.jpegCompressionRate;

              {
            string[] parts = mainClass.shortCutDragModifiers.Split('+');
            foreach (string part in parts) {
              switch (part) {
            case "Ctrl": checkDragModCtrl.Checked = true; break;
            case "Alt": checkDragModAlt.Checked = true; break;
            case "Shift": checkDragModShift.Checked = true; break;
              }
            }
              }

              {
            string[] parts = mainClass.shortCutAnimModifiers.Split('+');
            foreach (string part in parts) {
              switch (part) {
            case "Ctrl": checkAnimModCtrl.Checked = true; break;
            case "Alt": checkAnimModAlt.Checked = true; break;
            case "Shift": checkAnimModShift.Checked = true; break;
              }
            }
              }

              {
            string[] parts = mainClass.shortCutPasteModifiers.Split('+');
            foreach (string part in parts) {
              switch (part) {
            case "Ctrl": checkPasteModCtrl.Checked = true; break;
            case "Alt": checkPasteModAlt.Checked = true; break;
            case "Shift": checkPasteModShift.Checked = true; break;
              }
            }
              }

              mainClass.PopulateKeysCombobox(comboDragKeys);
              mainClass.PopulateKeysCombobox(comboPasteKeys);

              comboDragKeys.SelectedItem = mainClass.shortCutDragKey;
              comboPasteKeys.SelectedItem = mainClass.shortCutPasteKey;

              if (textPath.Text == "") {
            string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Dropbox\\host.db";
            if (File.Exists(path)) {
              string dropboxPath = "";

              try {
            using (StreamReader reader = new StreamReader(File.OpenRead(path))) {
              // new way of getting the user's dropbox path.
              // host.db contains a second line which is a base64 encoded string of the path.
              // don't ask me why, but they made config.db encrypted (config.dbx)
              reader.ReadLine(); // skip first line, random useless zeros
              dropboxPath = mainClass.base64Decode(reader.ReadLine());
            }
              } catch { }

              if (dropboxPath != "")
            textPath.Text = dropboxPath.Replace('\\', '/') + "/Public/";
            }
              }
        }