private void OpenInputEffect(string fileName) { if (this.outputEffectLST.Items.Count > 0) { DialogResult result = MessageBox.Show("Discard unsaved changes?", "Alert", MessageBoxButtons.YesNo); if (result == System.Windows.Forms.DialogResult.No) { return; } } string extension = Path.GetExtension(fileName).ToLowerInvariant(); if (extension == ".effects") { using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { this.mEffectResources = new EffectResource[1]; this.mEffectResources[0] = new EffectResource(0, fileStream); } } else if (extension == ".package") { this.mEffectPackage = s3pi.Package.Package.OpenPackage(0, fileName) as s3pi.Package.Package; List <IResourceIndexEntry> effectResources = this.mEffectPackage.FindAll( new Predicate <IResourceIndexEntry>(IsEffectResource)); if (effectResources == null || effectResources.Count == 0) { MessageBox.Show(string.Concat(Path.GetFileName(fileName), " does not contain any effect resources.")); return; } this.mEffectResources = new EffectResource[effectResources.Count]; for (int k = 0; k < effectResources.Count; k++) { this.mEffectResources[k] = new EffectResource(0, this.mEffectPackage.GetResource(effectResources[k])); } } else { MessageBox.Show(string.Concat("Unknown file type: *", extension)); return; } this.inputEffectLST.Items.Clear(); this.outputEffectLST.Items.Clear(); this.mOutputEffectResBuilder = new EffectResourceBuilder(/*this.mEffectResource/**/); EffectResource effectResource; int i, j, count; for (i = 0; i < this.mEffectResources.Length; i++) { effectResource = this.mEffectResources[i]; count = effectResource.VisualEffectNames.Count; for (j = 0; j < count; j++) { this.inputEffectLST.Items.Add(new VisualEffectHandleContainer( effectResource.VisualEffectNames[j], effectResource)); } } this.printInputBTN.Enabled = true; }
private void OpenInputEffect(string fileName) { if (this.outputEffectLST.Items.Count > 0) { DialogResult result = MessageBox.Show("Discard unsaved changes?", "Alert", MessageBoxButtons.YesNo); if (result == System.Windows.Forms.DialogResult.No) return; } string extension = Path.GetExtension(fileName).ToLowerInvariant(); if (extension == ".effects") { using (FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { this.mEffectResources = new EffectResource[1]; this.mEffectResources[0] = new EffectResource(0, fileStream); } } else if (extension == ".package") { this.mEffectPackage = s3pi.Package.Package.OpenPackage(0, fileName) as s3pi.Package.Package; List<IResourceIndexEntry> effectResources = this.mEffectPackage.FindAll( new Predicate<IResourceIndexEntry>(IsEffectResource)); if (effectResources == null || effectResources.Count == 0) { MessageBox.Show(string.Concat(Path.GetFileName(fileName), " does not contain any effect resources.")); return; } this.mEffectResources = new EffectResource[effectResources.Count]; for (int k = 0; k < effectResources.Count; k++) { this.mEffectResources[k] = new EffectResource(0, this.mEffectPackage.GetResource(effectResources[k])); } } else { MessageBox.Show(string.Concat("Unknown file type: *", extension)); return; } this.inputEffectLST.Items.Clear(); this.outputEffectLST.Items.Clear(); this.mOutputEffectResBuilder = new EffectResourceBuilder(/*this.mEffectResource/**/); EffectResource effectResource; int i, j, count; for (i = 0; i < this.mEffectResources.Length; i++) { effectResource = this.mEffectResources[i]; count = effectResource.VisualEffectNames.Count; for (j = 0; j < count; j++) this.inputEffectLST.Items.Add(new VisualEffectHandleContainer( effectResource.VisualEffectNames[j], effectResource)); } this.printInputBTN.Enabled = true; }