コード例 #1
0
ファイル: Sistema.cs プロジェクト: ShadeDBZ/tinke
        private void btnImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog o = new OpenFileDialog();
            o.CheckFileExists = true;
            o.CheckPathExists = true;
            o.Multiselect = true;
            if (o.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;

            // The current selected file will be changed if they only select one file
            if (o.FileNames.Length == 1 && accion.IDSelect < 0xF000)
            {
                accion.Change_File(accion.IDSelect, o.FileNames[0]);
                return;
            }

            // If more than one file is selected, they will be changed by name
            foreach (string currFile in o.FileNames)
            {
                sFolder filesWithSameName = new sFolder();
                if (accion.IDSelect > 0xF000)
                    filesWithSameName = accion.Search_FileName(Path.GetFileName(currFile), accion.Selected_Folder());
                else
                    filesWithSameName = accion.Search_FileName(Path.GetFileName(currFile));

                sFile fileToBeChanged;
                if (filesWithSameName.files.Count == 0)
                    continue;
                else if (filesWithSameName.files.Count == 1)
                    fileToBeChanged = filesWithSameName.files[0];
                else
                {
                    // Get relative path
                    for (int i = 0; i < filesWithSameName.files.Count; i++)
                    {
                        sFile file = filesWithSameName.files[i];
                        file.tag = accion.Get_RelativePath(filesWithSameName.files[i].id, "", accion.Root);
                        filesWithSameName.files[i] = file;
                    }

                    Dialog.SelectFile dialog = new Dialog.SelectFile(filesWithSameName.files.ToArray());
                    if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                        continue;

                    fileToBeChanged = dialog.SelectedFile;
                }

                accion.Change_File(fileToBeChanged.id, currFile);
            }
        }
コード例 #2
0
ファイル: Sistema.cs プロジェクト: calvarado194/layton-rando
        private void btnImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog o = new OpenFileDialog();

            o.CheckFileExists = true;
            o.CheckPathExists = true;
            o.Multiselect     = true;
            if (o.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            // The current selected file will be changed if they only select one file
            if (o.FileNames.Length == 1 && accion.IDSelect < 0xF000)
            {
                accion.Change_File(accion.IDSelect, o.FileNames[0]);
                return;
            }

            // If more than one file is selected, they will be changed by name
            foreach (string currFile in o.FileNames)
            {
                sFolder filesWithSameName = new sFolder();
                if (accion.IDSelect > 0xF000)
                {
                    filesWithSameName = accion.Search_FileName(Path.GetFileName(currFile), accion.Selected_Folder());
                }
                else
                {
                    filesWithSameName = accion.Search_FileName(Path.GetFileName(currFile));
                }

                sFile fileToBeChanged;
                if (filesWithSameName.files.Count == 0)
                {
                    continue;
                }
                else if (filesWithSameName.files.Count == 1)
                {
                    fileToBeChanged = filesWithSameName.files[0];
                }
                else
                {
                    // Get relative path
                    for (int i = 0; i < filesWithSameName.files.Count; i++)
                    {
                        sFile file = filesWithSameName.files[i];
                        file.tag = accion.Get_RelativePath(filesWithSameName.files[i].id, "", accion.Root);
                        filesWithSameName.files[i] = file;
                    }

                    Dialog.SelectFile dialog = new Dialog.SelectFile(filesWithSameName.files.ToArray());
                    if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                    {
                        continue;
                    }

                    fileToBeChanged = dialog.SelectedFile;
                }

                accion.Change_File(fileToBeChanged.id, currFile);
            }
        }