public void Save(string rootpath) { var path = Path.Combine(rootpath, "ACMD"); Directory.CreateDirectory(path); foreach (var keypair in ACMD_FILES) { keypair.Value.Export(Path.Combine(path, $"{keypair.Key}.bin")); } using (var stream = File.Create(Path.Combine(path, "motion.mtable"))) { using (var writer = new BinaryWriter(stream)) { foreach (uint u in MotionTable) { if (Runtime.WorkingEndian == Endianness.Big) { writer.Write(BitConverter.GetBytes(u.Reverse())); } else { writer.Write(u); } } } } path = Path.Combine(rootpath, "MSC"); Directory.CreateDirectory(path); foreach (var keypair in MSC_FILES) { keypair.Value.Export(Path.Combine(path, $"{keypair.Key}.mscsb")); } path = Path.Combine(rootpath, "PARAM"); Directory.CreateDirectory(path); Fighter_Param_vl.Export(Path.Combine(path, $"fighter_param_vl_{ProjName}.bin")); Attributes.Export(Path.Combine(path, "fighter_param.bin")); path = Path.Combine(rootpath, "ANIM"); DirectoryX.Copy(MotionFolder, path); //foreach (string s in ANIM_FILES) //{ // Directory.CreateDirectory(Path.GetDirectoryName(Path.Combine(path, s))); // var tmp1 = Path.Combine(rootpath, s); // var tmp2 = Path.Combine(path, s); // File.Copy(tmp1, tmp2, true); //} ProjPath = Path.Combine(rootpath, $"{ProjName}.fitproj"); ProjFile = WriteFitproj(ProjPath); }
public void Install(DirectoryInfo source, string destination) { DirectoryXCopyArgs args = new DirectoryXCopyArgs(); args.Source = source; args.Target = new DirectoryInfo(destination); args.DirectoryFilters.Add("*"); args.FileFilters.Add("*"); args.Overwrite = true; args.Rollback = true; args.RollbackTempExtension = ".temp"; DirectoryX.Copy(args); }
private void ClearUselessFiles() { FileInfo fi = new FileInfo(Application.ExecutablePath); try { DirectoryX.Delete(fi.Directory, "*.temp", "*.temp", true); } catch { } string[] files = new string[] { "ZForge.NDIS.dll", "ZForge.NDIS.Interop.dll", "ZForge.DiskSafe.dll", "ZForge.DiskSafe.Interop.dll" }; foreach (string s in files) { string f = Path.Combine(fi.DirectoryName, s); try { if (File.Exists(f)) { File.Delete(f); } } catch { } } string[] dirs = new string[] { "Driver", "Tools" }; foreach (string s in dirs) { string f = Path.Combine(fi.DirectoryName, s); try { if (Directory.Exists(f)) { Directory.Delete(f, true); } } catch { } } }
private void ActionPref() { string oldStorage = MotionConfiguration.Instance.Storage; PerferenceForm fm = new PerferenceForm(); if (DialogResult.OK == fm.ShowDialog()) { MotionPreference.Instance.UpdateUI(this); if (mfAVI != null) { MotionPreference.Instance.UpdateUI(mfAVI); } if (mfPIC != null) { MotionPreference.Instance.UpdateUI(mfPIC); } if (DirectoryX.Compare(MotionConfiguration.Instance.Storage, oldStorage) != 0) { string msg = string.Format(Translator.Instance.T("您的数据存储目录发生了变化, 从[{0}]变更为[{1}], 您是否需要把原先存储目录下的数据迁移到新的存储目录下?"), oldStorage, MotionConfiguration.Instance.Storage); if (DialogResult.Yes == MessageBox.Show(msg, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { this.Cursor = Cursors.WaitCursor; this.ActionPrefBeforeUpdate(); StorageRelocateForm sfm = new StorageRelocateForm(); sfm.StorageSource = oldStorage; sfm.ShowDialog(); this.ActionPrefAfterUpdate(); this.Cursor = Cursors.Default; } } if (fm.GlobalSettingsChanged) { this.treeCamera.NodeReloadGlobalSettings(); } //this.toolStripMainLabelStorage.Text = Translator.Instance.T("存储目录:") + " " + MotionConfiguration.Instance.Storage; } }