private static void ShiftFrameDown(AnimViewModel view) { ANIM.TextureList frames = view.mANIM.Frames; ANIM.TextureFrame frame = view.GetSelectedFrame().Frame; int index = frames.IndexOf(frame); ANIM.TextureFrame next = frames[index + 1]; frames[index + 1] = frame; frames[index] = next; view.SyncFrames(); view.CurrentFrameIndex += 1; }
private static void ShiftFrameUp(AnimViewModel view) { ANIM.TextureList frames = view.mANIM.Frames; ANIM.TextureFrame frame = view.GetSelectedFrame().Frame; int index = frames.IndexOf(frame); ANIM.TextureFrame previous = frames[index - 1]; frames[index - 1] = frame; frames[index] = previous; view.SyncFrames(); view.CurrentFrameIndex -= 1; }
private static void ExportDds(AnimViewModel parent) { FrameViewModel view = parent.GetSelectedFrame(); var dialog = new SaveFileDialog { AddExtension = true, CheckPathExists = true, DefaultExt = ".dds", Filter = "DDS File(*.dds)|*.dds" }; if ((bool)dialog.ShowDialog()) { using (FileStream f = File.Create(dialog.FileName)) { byte[] buffer = view.Frame.AsBytes; f.Write(buffer, 0, buffer.Length); } } }
private static void ImportDds(AnimViewModel parent) { FrameViewModel view = parent.GetSelectedFrame(); var dialog = new OpenFileDialog { AddExtension = true, CheckFileExists = true, CheckPathExists = true, DefaultExt = ".dds", Filter = "DDS File(*.dds)|*.dds" }; if ((bool)dialog.ShowDialog()) { using (FileStream f = File.OpenRead(dialog.FileName)) { var buffer = new byte[f.Length]; f.Read(buffer, 0, buffer.Length); view.Data = buffer; } } }
private static void Main(params String[] args) { byte[] buffer = null; using (Stream s = File.OpenRead(args[0])) { buffer = new byte[s.Length]; s.Read(buffer, 0, buffer.Length); } var app = new Application(); var resource = new GenericRCOLResource(0, new MemoryStream(buffer)); var viewModel = new AnimViewModel(resource); var win = new MainWindow(viewModel); app.Run(win); if (viewModel.IsSaving) { byte[] output = resource.AsBytes; using (FileStream s = File.Create(args[0])) { s.Write(output, 0, output.Length); } } }
public FrameViewModel(AnimViewModel parent, ANIM.TextureFrame frame) { mParent = parent; mFrame = frame; }
private static void RemoveFrame(AnimViewModel view) { view.mANIM.Frames.Remove(view.GetSelectedFrame().Frame); view.SyncFrames(); }
private static void ImportDds(AnimViewModel parent) { FrameViewModel view = parent.GetSelectedFrame(); var dialog = new OpenFileDialog {AddExtension = true, CheckFileExists = true, CheckPathExists = true, DefaultExt = ".dds", Filter = "DDS File(*.dds)|*.dds"}; if ((bool) dialog.ShowDialog()) { using (FileStream f = File.OpenRead(dialog.FileName)) { var buffer = new byte[f.Length]; f.Read(buffer, 0, buffer.Length); view.Data = buffer; } } }
private static void ExportDds(AnimViewModel parent) { FrameViewModel view = parent.GetSelectedFrame(); var dialog = new SaveFileDialog {AddExtension = true, CheckPathExists = true, DefaultExt = ".dds", Filter = "DDS File(*.dds)|*.dds"}; if ((bool) dialog.ShowDialog()) { using (FileStream f = File.Create(dialog.FileName)) { byte[] buffer = view.Frame.AsBytes; f.Write(buffer, 0, buffer.Length); } } }
private static void AddFrame(AnimViewModel view) { view.mANIM.Frames.Add(); view.SyncFrames(); }
internal MainWindow(AnimViewModel viewModel) : this() { mViewModel = viewModel; DataContext = mViewModel; }