Example #1
0
        private void uploadFileToHereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect      = true;
            ofd.Filter           = PCPath.FilterAllFiles;
            ofd.InitialDirectory = PCPath.Mycomputer;

            DialogResult result = ofd.ShowDialog();

            if (result == DialogResult.OK | result == DialogResult.Yes)
            {
                List <IItemNode> list_item_from = new List <IItemNode>();

                string    root     = Path.GetDirectoryName(ofd.FileNames[0]);
                IItemNode rootnode = ItemNode.GetNodeFromDiskPath(root);
                foreach (string a in ofd.SafeFileNames)
                {
                    FileInfo  info = new FileInfo(root + "\\" + a);
                    IItemNode n    = new ItemNode();
                    n.Info.Name = a;
                    n.Info.Size = info.Length;
                    rootnode.AddChild(n);
                    list_item_from.Add(n);
                }
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, rootnode,
                                                                                       ((UC_LVitem)tabControl1.SelectedTab.Controls[0]).managerhistory_itemnodes.NodeWorking(), false);
            }
        }
Example #2
0
        private void uploadFolderToHereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog(MainForm);

            if (result == DialogResult.OK | result == DialogResult.Yes)
            {
                List <IItemNode> list_item_from = new List <IItemNode>();
                IItemNode        node           = ItemNode.GetNodeFromDiskPath(fbd.SelectedPath.TrimEnd('\\'));
                list_item_from.Add(node);

                IItemNode rootto = managerhistory_itemnodes.NodeWorking();
                if (LV_item.SelectedItems.Count == 1)
                {
                    IItemNode find = FindNodeLV(LV_item.SelectedItems[0]);
                    if (find != null && find.Info.Size <= 0)
                    {
                        rootto = find;
                    }
                }
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, node.Parent, rootto, false);
            }
        }
        void uploadfile()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Multiselect      = true;
            ofd.Filter           = PCPath.FilterAllFiles;
            ofd.InitialDirectory = PCPath.Mycomputer;
            DialogResult result = ofd.ShowDialog();

            if (result != DialogResult.OK | result != DialogResult.Yes)
            {
                return;
            }
            List <IItemNode> items = new List <IItemNode>();
            IItemNode        root  = ItemNode.GetNodeFromDiskPath(System.IO.Path.GetDirectoryName(ofd.FileNames[0]));

            foreach (string s in ofd.SafeFileNames)
            {
                IItemNode n = new ItemNode();
                n.Info.Name = s;
                root.AddChild(n);
                FileInfo info = new FileInfo(n.GetFullPathString());
                n.Info.Size    = info.Length;
                n.Info.DateMod = info.LastWriteTime;
                items.Add(n);
            }
            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(items, root, managerehistory_itemnodes.NodeWorking(), false);
        }
Example #4
0
        void RecieveCode(IAsyncResult rs)
        {
            HttpListenerContext ls = listener.EndGetContext(rs);

            HttpListenerRequest request = ls.Request;
            string cloudname            = request.QueryString.Get("cloudname");
            string id    = request.QueryString.Get("id");
            string path  = request.QueryString.Get("path");
            string email = request.QueryString.Get("email");
            string range = request.Headers.Get("Range");

            CloudType type = CloudType.Folder;
            Stream    stream;
            long      start_range = -1;
            long      end_range   = -1;
            IItemNode filenode    = null;

            if (range != null)
            {
                string[] range_arr = range.Split('-');
                long.TryParse(range_arr[0], out start_range);
                long.TryParse(range_arr[1], out end_range);
            }

            if (cloudname != null && id != null && Enum.TryParse <CloudType>(cloudname, out type) && type != CloudType.LocalDisk && type != CloudType.Folder)
            {
                if (email == null)
                {
                    email = AppSetting.settings.GetDefaultCloud(type);
                }
                RootNode rootnode = AppSetting.settings.GetCloudRootNode(email, type);
                filenode = new ItemNode(new NodeInfo()
                {
                    ID = id
                });
                rootnode.AddChild(filenode);
            }
            else if (path != null && File.Exists(path))
            {
                type     = CloudType.LocalDisk;
                filenode = ItemNode.GetNodeFromDiskPath(path);
            }
            else//return 404 not found
            {
            }

            stream = AppSetting.ManageCloud.GetFileStream(filenode, start_range, end_range, false);//mega need cal chunk and size file

            HttpListenerResponse response = ls.Response;
        }
Example #5
0
        private void uploadFolderToHereToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog();

            if (result == DialogResult.OK | result == DialogResult.Yes)
            {
                List <IItemNode> list_item_from = new List <IItemNode>();
                IItemNode        node           = ItemNode.GetNodeFromDiskPath(fbd.SelectedPath);
                list_item_from.Add(node);
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, node.Parent,
                                                                                       ((UC_LVitem)tabControl1.SelectedTab.Controls[0]).managerhistory_itemnodes.NodeWorking(), false);
            }
        }
Example #6
0
        private void dowloadSeletedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog();

            if (result == DialogResult.OK | result == DialogResult.Yes)
            {
                List <IItemNode> list_item_from = new List <IItemNode>();
                IItemNode        node           = ItemNode.GetNodeFromDiskPath(TV_item.SelectedNode.FullPath);
                list_item_from.Add(node);
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, node.Parent,
                                                                                       ItemNode.GetNodeFromDiskPath(fbd.SelectedPath), false);
            }
        }
        void uploadfolder()
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog();

            if (result != DialogResult.OK | result != DialogResult.Yes)
            {
                return;
            }
            IItemNode node = ItemNode.GetNodeFromDiskPath(fbd.SelectedPath);

            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(new List <IItemNode>()
            {
                node
            }, node.Parent, managerehistory_itemnodes.NodeWorking(), false);
        }
Example #8
0
        public void FileSaveDialog(string InitialDirectory, string FileName, string Filter, IItemNode node)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.InitialDirectory = InitialDirectory;
            sfd.FileName         = FileName;
            sfd.Filter           = Filter;

            this.Dispatcher.Invoke(new Action(() =>
            {
                if (sfd.ShowDialog().Value)
                {
                    Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(new List <IItemNode>()
                    {
                        node
                    }, node.Parent, ItemNode.GetNodeFromDiskPath(sfd.FileName).Parent, false);
                }
            }));
        }
Example #9
0
        public void FileSaveDialog(string InitialDirectory, string FileName, string Filter, IItemNode node)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.InitialDirectory = InitialDirectory;
            sfd.FileName         = FileName;
            sfd.Filter           = Filter;
            Invoke(new Action(() =>
            {
                DialogResult rs = sfd.ShowDialog();
                if (rs == DialogResult.OK || rs == DialogResult.Yes)
                {
                    IItemNode filesave = ItemNode.GetNodeFromDiskPath(sfd.FileName, node.Info.Size);
                    Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(new List <IItemNode>()
                    {
                        node
                    }, node.Parent, filesave.Parent, false);
                }
            }));
        }
Example #10
0
        private void dowloadSeletedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog(MainForm);

            if (result == DialogResult.OK || result == DialogResult.Yes)
            {
                List <IItemNode> list_item_from = new List <IItemNode>();
                foreach (ListViewItem item in LV_item.SelectedItems)
                {
                    ItemNode find = FindNodeLV(item);
                    if (find != null)
                    {
                        list_item_from.Add(find);
                    }
                }
                Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(list_item_from, managerhistory_itemnodes.NodeWorking(), ItemNode.GetNodeFromDiskPath(fbd.SelectedPath), false);
            }
        }
        void DownloadSelected()
        {
            if (LV_items.SelectedIndex < 1)
            {
                return;
            }
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            fbd.RootFolder          = Environment.SpecialFolder.MyComputer;
            fbd.ShowNewFolderButton = true;
            DialogResult result = fbd.ShowDialog();

            if (result != DialogResult.OK | result != DialogResult.Yes)
            {
                return;
            }
            List <IItemNode> listitems = new List <IItemNode>();

            foreach (LV_data item in LV_items.SelectedItems)
            {
                listitems.Add(item.Node);
            }
            Setting_UI.reflection_eventtocore.ExplorerAndManagerFile.TransferItems(listitems, managerehistory_itemnodes.NodeWorking(), ItemNode.GetNodeFromDiskPath(fbd.SelectedPath), false);
        }