예제 #1
0
        /// <summary>
        /// 导入单个mono文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void importFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IEManager.InputStr = fileIDTextBox.Text;
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title = "选择要覆盖的Aseets";
            string targetFileName = "";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (currentFile == null)
                {
                    return;
                }
                if (assetList.SelectedCells.Count > 0)
                {
                    var    selRow   = assetList.SelectedRows[0];
                    string typeName = (string)selRow.Cells[2].Value;
                    if (typeName == "Folder")
                    {
                        string dirName = (string)selRow.Cells[1].Value;
                        ChangeDirectory(dirName);
                        return;
                    }
                    else
                    {
                        targetFileName = ofd.FileName;
                    }
                }
            }
            else
            {
                return;
            }

            OpenFileDialog ofd2 = new OpenFileDialog
            {
                CheckFileExists = false,
                FileName        = "[选择文件]",
                Title           = "选择要导入的文件"
            };

            if (ofd2.ShowDialog() == DialogResult.OK)
            {
                if (assetList.SelectedCells.Count > 0)
                {
                    var selRow = assetList.SelectedRows[0];
                    if (!string.IsNullOrEmpty(fileIDTextBox.Text))
                    {
                        ImportUtils.ImportAssets(long.Parse(fileIDTextBox.Text), ofd2.FileName, targetFileName);
                    }
                    else
                    {
                        ImportUtils.ImportAssets((long)selRow.Cells[3].Value, ofd2.FileName, targetFileName);
                    }
                    MessageBox.Show("导入成功");
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 导入整个文件夹的mono
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void imporDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!AssetUtils.AllDependenciesLoaded(helper, currentFile))
            {
                MessageBox.Show("未加载依赖文件");
                return;
            }

            IEManager.InputStr = fileIDTextBox.Text;
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title = "选择要覆盖的Aseets";
            string targetFileName = "";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                if (currentFile == null)
                {
                    return;
                }
                if (assetList.SelectedCells.Count > 0)
                {
                    var    selRow   = assetList.SelectedRows[0];
                    string typeName = (string)selRow.Cells[2].Value;
                    if (typeName == "Folder")
                    {
                        string dirName = (string)selRow.Cells[1].Value;
                        ChangeDirectory(dirName);
                        return;
                    }
                    else
                    {
                        targetFileName = ofd.FileName;
                    }
                }
            }
            else
            {
                return;
            }

            OpenFileDialog ofd2 = new OpenFileDialog
            {
                CheckFileExists = false,
                FileName        = "[选择文件夹]",
                Title           = "选择要导入的文件夹"
            };

            if (ofd2.ShowDialog() == DialogResult.OK)
            {
                string dirName = Path.GetDirectoryName(ofd2.FileName);
                if (Directory.Exists(dirName))
                {
                    ImportUtils.ImportAssets(dirName, targetFileName);
                    MessageBox.Show("导入成功");
                }
                else
                {
                    MessageBox.Show("文件夹不存在.", "Assets View");
                }
            }
        }