private void btnShowPreview_Click(object sender, EventArgs e) { //When more than one frame, create duplicate action and view action if (Package.PackageState != AMTUtil.State.READY) { return; } if (lbFrames.SelectedIndex == -1) { MessageBox.Show("You need to select a frame!"); return; } if (lbFrames.SelectedItems.Count > 1) { MessageBox.Show("You cannot view more than one frame."); return; } if (Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].ActionRef == null) { AMTResource PreviewResource = AMTUtil.GetResourceFromName(Package, Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].Resource); FramePreview PreviewWindow = new FramePreview(AMTUtil.BytesToImage(PreviewResource.Frames[Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].FrameRef])); PreviewWindow.Show(); } else { ActionPreview PreviewWindow = new ActionPreview(Package, AMTUtil.GetActionFromName(Package.Animation, Package.Animation.Actions[lbActions.SelectedIndex].Frames[lbFrames.SelectedIndex].ActionRef)); PreviewWindow.Show(); } }
private void btnNormalLoad_Click(object sender, EventArgs e) { Stopwatch stopWatch = new Stopwatch(); OpenFileDialog OpenFileDialog = new OpenFileDialog(); OpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); OpenFileDialog.Filter = "resource files (*" + AMTConfig.ResourceExtension + ")|*" + AMTConfig.ResourceExtension; OpenFileDialog.FilterIndex = 2; OpenFileDialog.RestoreDirectory = true; if (OpenFileDialog.ShowDialog() == DialogResult.OK) { AMTResource TestResource = new AMTResource(); stopWatch.Start(); TestResource = (AMTResource)JsonConvert.DeserializeObject <AMTResource>(File.ReadAllText(OpenFileDialog.FileName)); stopWatch.Stop(); Console.WriteLine(TestResource.UID); Console.WriteLine(JsonConvert.SerializeObject(TestResource.FrameUID)); } lblDebug.Text = "Elapsed: " + stopWatch.ElapsedMilliseconds + "ms"; }