Пример #1
0
 private void MainForm_DragDrop(object sender, DragEventArgs e)
 {
     string[] paths = (string[])e.Data.GetData(DataFormats.FileDrop, false);
     foreach (var path in paths)
     {
         var attr = System.IO.File.GetAttributes(path);
         var ext  = System.IO.Path.GetExtension(path);
         if (attr == System.IO.FileAttributes.Directory)
         {
             if (project != null)
             {
                 project.AddAsset(path);
                 RefreshAssetList();
                 dirty = true;
                 UpdateTitle();
             }
         }
         else if (ext == Model.Project.Ext)
         {
             if (project == null)
             {
                 project = new Model.Project();
             }
             ClearForm();
             project.Open(path);
             project.Open();
             ProjectSettingToForm();
             UpdateTitle();
             RefreshAssetList();
             UpdateMenuEnable();
             dirty = false;
             UpdateTitle();
         }
     }
 }
Пример #2
0
        public void SetData(Model.Project project, Model.Asset asset)
        {
            if (project == null || asset == null)
            {
                Close();
                return;
            }

            this.project = project;
            this.asset   = asset;

            string        rootpath = project.MakeAbsolutePath(asset.Path);
            List <string> dirs     = GetLastDirs(rootpath, rootpath);

            this.dirs = dirs;

            lst_Frames.LargeImageList = new ImageList();
            foreach (Model.Sprite sprite in asset.Atlas.Sprites)
            {
                lst_Frames.LargeImageList.Images.Add(sprite.ImageName, sprite.Image);
            }

            RefreshList();
        }