private void AddEffect(string filePath) { var copyPath = Path.Combine(Path.Combine(WindowUtility.MainForm.CurrentProjectDir, EffectDirPath), Path.GetFileName(filePath)); if (File.Exists(copyPath)) { MessageBox.Show(String.Format("{0}\n{1}", Utility.Language["AlreadyExistResource"], filePath)); return; } CheckResourceDir(); File.Copy(filePath, copyPath, true); foreach (string imagePath in Directory.GetFiles(Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath)))) { var newPath = Path.Combine(Path.Combine(Path.GetDirectoryName(copyPath), Path.GetFileNameWithoutExtension(filePath)), Path.GetFileName(imagePath)); Utility.RecursiveCreateFolder(newPath); File.Copy(imagePath, newPath, true); } CreateNode(EffectNode.Nodes, Path.GetFileName(filePath), NodeType.Effect); var dir = Path.GetDirectoryName(filePath); foreach (string fileName in EffectLoader.GetEffectReference(filePath)) { var path = Path.Combine(dir, fileName); if (File.Exists(path)) { AddEffect(path); } } }
private void AddEffectInfo() { var path = Path.Combine(WindowUtility.MainForm.CurrentProjectDir, Path.Combine("Resource", treeView1.SelectedNode.FullPath)); if (!File.Exists(path)) { return; } try { var refs = EffectLoader.GetEffectReference(path); var manager = EffectLoader.Load(path, false, (fn) => { }); AddInfo(Utility.Language["ReferenceEffect"], String.Join(", ", refs)); AddInfo(Utility.Language["FrameCount"], manager.FrameLength); AddInfo(Utility.Language["StartFrame"], manager.StartFrame); int layerCount = 0; var effects = new Queue <IEffect>(); effects.Enqueue(manager); while (effects.Count > 0) { var effect = effects.Dequeue(); if (effect.Effects.Count == 0) { layerCount++; } else { foreach (IEffect childEffect in effect.Effects) { effects.Enqueue(childEffect); } } } AddInfo(Utility.Language["LayerCount"], layerCount); AddInfo(Utility.Language["FPS"], manager.FPS); var effectPanel = new EffectPanel(); effectPanel.SetLang(); effectPanel.OpenFile(path); ChangePanel(effectPanel); } catch (Exception e) { MessageBox.Show(e.Message); } }