private void BAR_Click(object sender, RoutedEventArgs e) { IsBR = true; BAR br = new BAR(); FFhost.Navigate(br); }
public static void Backup() { Debug.Log("Backup project"); if (!BAR.Backup()) { Debug.LogError($"Could not backup project!"); } }
//切割字串 public static BAR splitstrng(string input) { BAR bar = new BAR(); try { //切割符號 //string mark = ConfigurationManager.AppSettings["Mark"]; input = new Regex("[\\s]+").Replace(input, " "); //string[] sArray = Regex.Split(input, @"|"); string[] sArray = input.Split('|'); bar = new BAR { Dept = sArray[0], ItemCode = sArray[1], SubCode = sArray[2], UnitCode = sArray[3], Internal_ExternalBarcode = sArray[4], EAN13Barcode = sArray[5], OriginalBarcodeType = sArray[6], OriginalBarcodeNo = sArray[7], SNISpecialTypeBarcode = sArray[8], MajorBarcode = sArray[9], StartStopDate = sArray[10], EndStopDate = sArray[11], StopItemReason = sArray[12], StopReasonDescription = sArray[13], ItemID = sArray[14], ItemSubcodeID = sArray[15], Length = sArray[16], Width = sArray[17], Height = sArray[18], NotForSellFlag = sArray[19], StoreCode = sArray[20], NotForSellReason = sArray[21], ItemCodeEnglishDescription = sArray[22], ItemCodeChineseDescription = sArray[23], Status = sArray[24] }; return(bar); } catch (Exception ex) { Common.WriteLog("切割失敗 " + input + " "); Common.WriteLog(ex.ToString()); return(bar); throw; } }
public static void Restore() { if (EditorUtility.DisplayDialog("Restore the project?", "Restore the project from the latest backup?", "Yes", "No")) { Debug.Log("Restore project"); if (!BAR.Restore()) { Debug.LogError($"Could not restore project!"); } } }
public Tim_t7(ref BAR b) { this.file = b; this.Patches = new List <Bitmap>(0); this.PatchesPositions = new List <Point>(0); this.PatchesSizes = new List <Size>(0); this.PatchesCounts = new List <int>(0); this.PatchesDestinations = new List <int>(0); bool containsTexture = false; for (int i = 0; i < b.fileList.Count; i++) { if (b.fileList[i].type == 7) { this.binary = new SrkBinary(ref b.fileList[i].data); this.t7_index = i; this.st = new SrkTim(b.fileList[i]); this.st.ParseTim(); this.ct = new CatzTim(b.fileList[i]); this.ct.parse(); catzMode = this.st.Patches.Count == 0 || (ct.imageCount > st.Bitmaps.Count); if (catzMode) { this.textures = new Texture2D[this.ct.imageCount]; UpdateCatzT2D(); } else { this.Patches = this.st.Patches; this.PatchesPositions = this.st.PatchLocs; this.PatchesSizes = this.st.PatchSizes; this.PatchesCounts = this.st.PatchCounts; this.PatchesDestinations = this.st.PatchTextureIndexes; } containsTexture = true; break; } } if (!containsTexture) { Console.WriteLine("No TIM2 found inside that file."); Console.WriteLine("Exiting..."); System.Threading.Thread.Sleep(2000); System.Diagnostics.Process.GetCurrentProcess().Kill(); } }
//path 完整路徑 finame檔名 public static bool StartInsert(string path, string finame) { bool result = true; int i = 0; string line; List <BAR> bars = new List <BAR>(); BAR bar = new BAR(); try { Common.WriteLog("開始切割 " + finame); FileStream fileStream = File.OpenRead(path); using (StreamReader reader = new StreamReader(fileStream, Encoding.GetEncoding(0))) { line = reader.ReadLine(); while (line != null) { line = new Regex("[\\s]+").Replace(line, " "); if (line == " " || line == "") { line = reader.ReadLine(); continue; } bar = splitstrng(line); bars.Add(bar); line = reader.ReadLine(); i++; } reader.Close(); } Common.WriteLog("新增DB"); result = InsertToSql(bars); Common.WriteLog(finame + "切割完成,一共 " + i + " 筆"); return(result); } catch (Exception e) { Common.WriteLog("BARServices失敗"); Common.WriteLog(e.ToString()); result = false; return(result); } }
public MDLX(string filename) { FileStream str = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Read, FileShare.Read); this.bar = new BAR(str); this.t4 = new Mdl_t4(ref this.bar); this.t7 = new Tim_t7(ref this.bar); this.meshes = new List <Mesh>(0); this.shadowMeshes = new List <Mesh>(0); this.Name = Path.GetFileNameWithoutExtension(filename); this.DirectoryName = Path.GetDirectoryName(filename); this.FileName = filename; }
public Mdl_t4(ref BAR b) { bool containsModel = false; for (int i = 0; i < b.fileList.Count; i++) { if (b.fileList[i].type == 4) { this.binary = new SrkBinary(ref b.fileList[i].data); t4_index = i; containsModel = true; break; } } if (!containsModel) { Console.WriteLine("No model found inside that file."); Console.WriteLine("Exiting..."); System.Threading.Thread.Sleep(2000); System.Diagnostics.Process.GetCurrentProcess().Kill(); } }
/// <inheritdoc /> protected override bool OnStepStart() { return(BAR.Backup()); }
protected static void showBAR() { if (Helper.isEditorMode) { if (!EditorApplication.isCompiling && !EditorApplication.isUpdating) { if (!BAR.isBusy) { GUILayout.Space(3); GUILayout.Label("Backup", EditorStyles.boldLabel); if (Helper.isBackupEnabled) { GUI.enabled = !Helper.isDeleting; if (GUILayout.Button(new GUIContent(" Backup", Helper.Action_Backup, "Backup the project"))) { if (!Config.CONFIRM_BACKUP || EditorUtility.DisplayDialog("Backup the project?", (Config.USE_LEGACY ? Constants.ASSET_NAME + " will now close Unity and save the following folders: " : "Save the following folders: ") + System.Environment.NewLine + (Config.COPY_ASSETS ? "• Assets" + System.Environment.NewLine : string.Empty) + (Config.COPY_LIBRARY ? "• Library" + System.Environment.NewLine : string.Empty) + (Config.COPY_SETTINGS ? "• ProjectSettings" + System.Environment.NewLine : string.Empty) + (Config.COPY_PACKAGES ? "• Packages" + System.Environment.NewLine : string.Empty) + System.Environment.NewLine + "Backup directory: " + Config.PATH_BACKUP + System.Environment.NewLine + System.Environment.NewLine + "This operation could take some time." + System.Environment.NewLine + System.Environment.NewLine + "Would you like to start the backup?", "Yes", "No")) { if (Config.DEBUG) { Debug.Log("Backup initiated"); } BAR.Backup(); GUIUtility.ExitGUI(); } } GUILayout.Label($"Last Backup:\t{(Helper.hasBackup ? Config.BACKUP_DATE.ToString() : "never")}"); //))GUILayout.Label($"Automatic Backup:\t{(EditorTask.AutoBackup.BackupInterval > 0 ? $"{Util.Config.AUTO_BACKUP_DATE.ToString()} (in {(Util.Config.AUTO_BACKUP_DATE - System.DateTime.Now).Minutes}min)" : "disabled")}"); GUILayout.Label($"Auto Backup:\t{(EditorTask.AutoBackup.BackupInterval > 0 ? $"{Util.Config.AUTO_BACKUP_DATE.ToString()} (in {Helper.FormatSecondsToHourMinSec((Util.Config.AUTO_BACKUP_DATE - System.DateTime.Now).TotalSeconds)})" : "disabled")}"); //GUILayout.Label("Last Backup:\t" + Config.BACKUP_DATE + " (" + Config.BACKUP_COUNT + ")"); Helper.SeparatorUI(); GUILayout.Label("Restore", EditorStyles.boldLabel); if (Helper.hasBackup) { if (GUILayout.Button(new GUIContent(" Restore", Helper.Action_Restore, "Restore the project"))) { if (!Config.CONFIRM_RESTORE || EditorUtility.DisplayDialog("Restore the project?", (Config.USE_LEGACY ? Constants.ASSET_NAME + " will now close Unity and restore the following folders: " : "Restore the following folders: ") + System.Environment.NewLine + (Config.COPY_ASSETS ? "• Assets" + System.Environment.NewLine : string.Empty) + (Config.COPY_LIBRARY ? "• Library" + System.Environment.NewLine : string.Empty) + (Config.COPY_SETTINGS ? "• ProjectSettings" + System.Environment.NewLine : string.Empty) + (Config.COPY_PACKAGES ? "• Packages" + System.Environment.NewLine : string.Empty) + //System.Environment.NewLine + //"Restore directory: " + Constants.APPLICATION_PATH + //System.Environment.NewLine + System.Environment.NewLine + "This operation could take some time." + System.Environment.NewLine + System.Environment.NewLine + "Would you like to start the restore?", "Yes", "No")) { if (!Config.CONFIRM_RESTORE || !Config.CONFIRM_WARNING || !EditorUtility.DisplayDialog("Overwrite existing project?", "This operation will overwrite ALL files. Any progress since the last backup will BE LOST!" + System.Environment.NewLine + System.Environment.NewLine + "Would you really want to continue?", "NO!", "Yes")) { if (Config.DEBUG) { Debug.Log("Restore initiated"); } BAR.Restore(); GUIUtility.ExitGUI(); } } } GUILayout.Label("Last Restore:\t" + (Config.RESTORE_COUNT > 0 ? Config.RESTORE_DATE.ToString() : "never")); //GUILayout.Label("Last Restore:\t" + Config.RESTORE_DATE + " (" + Config.RESTORE_COUNT + ")"); } else { EditorGUILayout.HelpBox("No backup found, restore is not possible. Please use 'Backup' first.", MessageType.Info); } GUI.enabled = true; } else { EditorGUILayout.HelpBox("All backup folders are disabled. No actions possible.", MessageType.Error); } } else { EditorGUILayout.HelpBox($"{Constants.ASSET_NAME} is busy, please wait...", MessageType.Info); } } else { EditorGUILayout.HelpBox("Unity Editor is busy, please wait...", MessageType.Info); } } else { EditorGUILayout.HelpBox("Disabled in Play-mode!", MessageType.Info); } }
/// <inheritdoc /> protected override bool OnStepStart() { return(BAR.Restore()); }
private void نسخاحتياطىToolStripMenuItem_Click(object sender, EventArgs e) { BAR backrest = new BAR(); backrest.ShowDialog(); }
private static void Main(string[] args) { Console.WriteLine("OpenKH Core / Debug Console"); Console.WriteLine("Early Version by GovanifY"); Console.Write("Please enter the name of the game you want to load(KH2 or KH1):"); string game = Console.ReadLine(); Console.Write("Please enter the name of the iso you want to load:"); string isoname = Console.ReadLine(); Console.Write("Please enter the name of the file you want to load:"); string inputname = @Console.ReadLine(); if (game == "KH2") { Console.Write("Trying to load the iso..."); FileStream isoStream = File.Open(isoname, FileMode.Open, FileAccess.Read, FileShare.Read); var iso = new ISOFileReader(isoStream); Console.WriteLine("Done!"); Console.Write("Searching the IDX and IMG files..."); Stream dumb = new FileStream(@"libKh.dll", FileMode.Open, FileAccess.Read); var IDXStream = new Substream(dumb); //Anti CS0165 var IMGStream = new Substream(dumb); //Anti CS0165 var OVLIMGStream = new Substream(dumb); //Anti CS0165 var OVLIDXStream = new Substream(dumb); //Anti CS0165 foreach (FileDescriptor file in iso) { string file2 = file.FullName; if (file2.EndsWith("OVL.IDX")) { OVLIDXStream = iso.GetFileStream(file); } if (file2.EndsWith("OVL.IMG")) { OVLIMGStream = iso.GetFileStream(file); } if (file2.EndsWith("KH2.IDX")) { IDXStream = iso.GetFileStream(file); } if (file2.EndsWith("KH2.IMG")) { IMGStream = iso.GetFileStream(file); } } if (IDXStream == IMGStream) { throw new Exception("IDX or IMG Stream isn't loaded correctly!"); } Console.WriteLine("Done!"); var LIBKHIDX = new IDX(IDXStream, IMGStream); // TODO add a f*****g support for the OVL! Console.Write("Opening the internal file..."); Stream internalfile = LIBKHIDX.OpenFile(inputname); Console.WriteLine("Done!"); Console.Write("Extracting the file..."); string inputname2 = Path.GetFullPath("output/" + inputname); Directory.CreateDirectory(Path.GetDirectoryName(inputname2)); var output = new FileStream(inputname2, FileMode.Create, FileAccess.ReadWrite, FileShare.None); internalfile.CopyTo(output); Console.WriteLine("Done!"); var br = new BinaryReader(output); if (br.ReadUInt32() != 0x01524142) { Console.WriteLine("Not a BAR file, continue anyway"); } else { Console.WriteLine("BAR file detected! Unbarring him..."); var msgSys = new BAR(internalfile); } Console.Read(); } else { throw new Exception("NOT IMPLEMENTED"); } }