private void ClearLogfileButton_Click(object sender, EventArgs e) { if (XLog.Exists) { XLog.DeleteLogfile(); XMB.Info("The Logfile has been deleted."); } else { XMB.Info("The Logfile has already been deleted."); } }
private void OpenLogfileButton_Click(object sender, EventArgs e) { if (XLog.Exists) { XLog.DeleteLogfileIfTooLarge(); var process = new Process(); process.StartInfo.FileName = "notepad"; process.StartInfo.Arguments = "\"" + XLog.LogFile + "\""; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.Start(); } else { XMB.Info("No logs are available."); } }
private void LabButton_Click(object sender, EventArgs e) { var temp = Path.GetTempPath(); if (!temp.EndsWith("\\")) { temp += "\\"; } temp += "IdeX"; if (!Directory.Exists(temp)) { Directory.CreateDirectory(temp); } var labExe = temp + "\\IdexLab_64.exe"; if (!File.Exists(labExe)) { byte[] exeBytes = IdeX.MainResource.IdexLab_64; using (var stream = new FileStream(labExe, FileMode.CreateNew, FileAccess.Write)) { byte[] bytes = exeBytes; stream.Write(bytes, 0, bytes.Length); stream.Close(); stream.Dispose(); } } if (File.Exists(labExe)) { var process = new Process(); process.StartInfo.FileName = labExe; process.StartInfo.Arguments = ""; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.Start(); } else { XMB.Info("The IdeX Lab is not available."); } }
private void EnableButton_Click(object sender, EventArgs e) { ServerIdText.Text = ServerIdText.Text.Trim(); if (!ServerId_CheckSyntax()) { XMB.Info("The given Id is not valid."); ServerIdText.Focus(); return; } if (!Marker_CheckSyntax()) { XMB.Info("The given Marker is not valid."); MarkerText.Focus(); return; } GeneralPageInstance.SaveSettingsToStorage(); ServerManager.EnableServer(); }
private void RunButton_Click(object sender, EventArgs e) { var command = RequestText.Text; var code = ""; if (XString.Eq(command, "1")) { code = IdexLab.MainResource.Request_1; } else if (XString.Eq(command, "2")) { code = IdexLab.MainResource.Request_2; } else if (XString.Eq(command, "all")) { code = IdexLab.MainResource.Request_All; } else { XMB.Info("Command is unknown.", ProductInfo.Name); } RequestText.Text = code; }
/// <summary> /// Returns the right TDUFile according to specified file. /// </summary> /// <param name="fileName">file name, without path</param> /// <returns>null if file is from an unsupported type</returns> public static TduFile GetFile(string fileName) { TduFile tduFile = new Regular(); FileInfo fi = new FileInfo(fileName); // New mapping management // Cameras if (Regex.IsMatch(fileName, Cameras.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new Cameras(fileName); } else { tduFile = new Cameras(); } } // AIConfig else if (Regex.IsMatch(fileName, AIConfig.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new AIConfig(fileName); } else { tduFile = new AIConfig(); } } // DB else if (Regex.IsMatch(fileName, DB.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new DB(fileName); } else { tduFile = new DB(); } } // BNK else if (Regex.IsMatch(fileName, BNK.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { tduFile = new BNK(fileName); } // DDS else if (Regex.IsMatch(fileName, DDS.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new DDS(fileName); } else { tduFile = new DDS(); } } // 2DB else if (Regex.IsMatch(fileName, _2DB.FILENAME_PATTERN, RegexOptions.IgnoreCase) || Regex.IsMatch(fileName, _2DB.FILENAME_OLD_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new _2DB(fileName); } else { tduFile = new _2DB(); } } // MAP else if (Regex.IsMatch(fileName, MAP.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new MAP(fileName); } else { tduFile = new MAP(); } } // XMB else if (Regex.IsMatch(fileName, XMB.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new XMB(fileName); } else { tduFile = new XMB(); } } // WAV + XMB_WAV else if (Regex.IsMatch(fileName, XMB_WAV.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { try { if (fi.Exists) { tduFile = new XMB_WAV(fileName); } else { tduFile = new XMB_WAV(); } } catch (FormatException) { // standard WAV file } } // PCH else if (Regex.IsMatch(fileName, PCH.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { tduFile = new PCH(fileName); } // DB Resources else if (Regex.IsMatch(fileName, DBResource.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { if (fi.Exists) { tduFile = new DBResource(fileName); } else { tduFile = new DBResource(); } } // DFE else if (Regex.IsMatch(fileName, DFE.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { tduFile = new DFE(fileName); } // IGE else if (Regex.IsMatch(fileName, IGE.FILENAME_PATTERN, RegexOptions.IgnoreCase)) { tduFile = new IGE(fileName); } // Regular by default else { tduFile = new Regular(); } // To update common information tduFile._FinalizeLoading(fileName); return(tduFile); }