void ICommand.Execute(object parameter) { ControlExtended.SafeInvoke(() => Execute?.Invoke(parameter), LogType.Info, GlobalHelper.Get("key_133") + this.Text); HockeyClient.Current.TrackEvent(this.Text); }
public static IAreaOfEffect GetRandomAOE() { var type = GlobalHelper.GetRandomEnumValue <AoeType>(); return(GetAOEByType(type)); }
protected override IQueryable <CriHcPreview> PreviewQuery(Guid id, ccEntities _db) { var objectSet = _db.CriBases.OfType <CriHc>(); var Clients = this.GetClients(_db); var SubReports = this.GetSubReports(_db); var subReportId = _db.Imports.Where(f => f.Id == id).Select(f => f.TargetId).FirstOrDefault(); var details = (from sr in _db.SubReports where sr.Id == subReportId select new { MrStart = sr.MainReport.Start, MrEnd = sr.MainReport.End, AgencyId = sr.AppBudgetService.AgencyId, AppId = sr.AppBudgetService.AppBudget.AppId, AgencyGroupId = sr.AppBudgetService.Agency.GroupId, sr.AppBudgetService.Service.ReportingMethodId }).SingleOrDefault(); var startingWeek = details.MrStart; DayOfWeek selectedDOW = startingWeek.DayOfWeek; int? selectedDowDb = GlobalHelper.GetWeekStartDay(details.AgencyGroupId, details.AppId); if (selectedDowDb.HasValue) { selectedDOW = (DayOfWeek)selectedDowDb.Value; if (startingWeek.Month > 1) { var diff = selectedDowDb.Value - (int)startingWeek.DayOfWeek; startingWeek = startingWeek.AddDays((double)(diff)); if (startingWeek > details.MrStart) { startingWeek = startingWeek.AddDays(-7); } } } var weekToSubstruct = new DateTime(startingWeek.Year, 1, 1); weekToSubstruct = weekToSubstruct.AddDays(Math.Abs((int)selectedDOW - (int)weekToSubstruct.DayOfWeek)); var mrStartDate = details.MrStart; if (details.ReportingMethodId == (int)Service.ReportingMethods.HomecareWeekly) { mrStartDate = startingWeek; } DateTime JoinDateToCompare = new DateTime(2018, 1, 1); var source = (from item in objectSet where item.ImportId == id join client in Clients on item.ClientId equals client.Id into clientsGroup from client in clientsGroup.DefaultIfEmpty() join subReport in SubReports on item.SubReportId equals subReport.Id into srg from subReport in srg.DefaultIfEmpty() let ldx = System.Data.Objects.EntityFunctions.AddDays(client.LeaveDate, client.DeceasedDate == null ? 0 : 90) let start = item.Date ?? subReport.MainReport.Start let mrStart = subReport.MainReport.Start let end = subReport.MainReport.End let diff = SqlFunctions.DateDiff("day", weekToSubstruct, item.Date) select new CriHcPreview { RowIndex = item.RowIndex, ClientId = item.ClientId, ClientName = client.AgencyId != subReport.AppBudgetService.AgencyId ? "" : client.FirstName + " " + client.LastName, Date = item.Date, Week = "W" + SqlFunctions.StringConvert((decimal?)(diff / 7 + (SqlFunctions.DatePart("day", weekToSubstruct) == 1 || diff < 0 ? 1 : 2))), Rate = item.Rate, Quantity = item.Quantity, Remarks = item.Remarks, Errors = (item.Errors ?? "") + ( ((client == null) ? "Invalid ClientId. " : "") + ((client.AgencyId != subReport.AppBudgetService.AgencyId) ? "Invalid Agency. " : "") + ((item.Rate == null || item.Rate <= 0) ? "Rate must be greater than 0. " : "") + ((item.Quantity == null || item.Quantity < 0) ? "Quantity must be greater or equal to 0. " : "") + (client.JoinDate > end ? "Client has joined after report end date" : "") + (client.DeceasedDate == null && client.LeaveDate < mrStart ? "Client has left before report start date" : "") + (client.DeceasedDate != null && client.DeceasedDate < mrStart ? "Client has DOD before report start date" : "") + ((item.Date < mrStartDate || item.Date >= subReport.MainReport.End) ? "Invalid Date (report date is outside of the report period)" : "") + ((client.AgencyId != subReport.AppBudgetService.AgencyId) ? "Invalid Agency. " : "") + ((client.JoinDate > subReport.MainReport.End) ? "Client cant be reported because of Join Date. " : "") + (ldx < start ? "The Client has left the agency." : "") + ( (client.LeaveDate < start && ldx >= start && (item.Remarks == null || item.Remarks.Trim().Length == 0)) ? "Deceased Client needs to be specified with Unique Circumstances." : "" ) + //client is not marked as complied but the verification is required (( !client.IncomeCriteriaComplied && client.Agency.AgencyGroup.Country.IncomeVerificationRequired && (client.FundStatusId == null || client.FundStatus.IncomeVerificationRequired)) ? "Income verification required. " : "") + (!(client.ExceptionalHours > 0 || client.GrandfatherHours.Any(f => f.StartDate < subReport.MainReport.End) || client.FunctionalityScores.Any(f => f.StartDate < subReport.MainReport.End)) ? "Insufficient Home Care Hours limit. " : "") + (!(client.HomeCareEntitledPeriods.Any(f => f.StartDate < subReport.MainReport.End && (f.EndDate == null || f.EndDate > subReport.MainReport.Start))) ? "Eligibility period does not permit reporting. " : "") + (!(client.FunctionalityScores.Any(f => f.StartDate < subReport.MainReport.End)) ? "Functionality Scores period does not permit reporting. " : "") ) }); return(source); }
/// <summary> /// 功能:记录日志到控制台 /// </summary> /// <param name="strSource">消息来源</param> /// <param name="strMessage">消息</param> /// <param name="logAddition">日志附加信息</param> /// <param name="logLevel">消息类型</param> private static void LogToConsole(string strSource, string strMessage, string logAddition, LogLevel logLevel) { if (strMessage.Length > 180) { strMessage = strMessage.Substring(0, 180); } var strTemp = $"Source:{strSource}--Message:{strMessage}--Addition:{logAddition}--Machine:{GlobalHelper.GetMachineName()},Time:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"; Console.WriteLine(strTemp); }
public async Task Load(Tuple <Repository, string, string> repoPath) //This page recieves RepositoryId and name of the file { Content = ""; IsSupportedFile = true; Repository = repoPath.Item1; Path = repoPath.Item2; if (string.IsNullOrWhiteSpace(repoPath.Item3)) { SelectedBranch = await RepositoryUtility.GetDefaultBranch(Repository.Id); } else { SelectedBranch = repoPath.Item3; } MarkdownOptions options = new MarkdownOptions { AsteriskIntraWordEmphasis = true, AutoNewlines = true, StrictBoldItalic = true, AutoHyperlink = false, LinkEmails = true }; Markdown markDown = new Markdown(options); if (!GlobalHelper.IsInternet()) { Messenger.Default.Send(new GlobalHelper.NoInternetMessageType()); //Sending NoInternet message to all viewModels } else { Messenger.Default.Send(new GlobalHelper.HasInternetMessageType()); //Sending Internet available message to all viewModels isLoading = true; IsReadme = false; IsImage = false; if ((Path.ToLower().EndsWith(".exe")) || (Path.ToLower().EndsWith(".pdf")) || (Path.ToLower().EndsWith(".ttf")) || (Path.ToLower().EndsWith(".suo")) || (Path.ToLower().EndsWith(".mp3")) || (Path.ToLower().EndsWith(".mp4")) || (Path.ToLower().EndsWith(".avi"))) { /* * Unsupported file types */ IsSupportedFile = false; isLoading = false; return; } if ((Path.ToLower()).EndsWith(".png") || (Path.ToLower()).EndsWith(".jpg") || (Path.ToLower()).EndsWith(".jpeg") || (Path.ToLower().EndsWith(".gif"))) { /* * Image file types */ IsImage = true; var uri = (await RepositoryUtility.GetRepositoryContentByPath(Repository.Id, Path, SelectedBranch))[0].DownloadUrl; ImageFile = new BitmapImage(uri); isLoading = false; return; } if ((Path.ToLower()).EndsWith(".md")) { /* * Files with .md extension will be shown with full markdown */ IsReadme = true; var str = (await RepositoryUtility.GetRepositoryContentByPath(Repository.Id, Path, SelectedBranch))[0].Content; Content = "<html><head><meta charset = \"utf-8\" /></head><body style=\"font-family: sans-serif\">" + markDown.Transform(str) + "</body></html>"; isLoading = false; return; } Content = (await RepositoryUtility.GetRepositoryContentByPath(Repository.Id, Path, SelectedBranch))[0].Content; isLoading = false; } }
private static void Main(string[] args) { SystemHelper.DisableDPIScale(); try { Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEUpdater.exe"), "schedule"); } catch { } if (!GlobalHelper.CheckCoreDLLs()) { MessageBox.Show( "Some of the core Dlls are missing.\r\n" + "Please whitelist these Dlls in your antivirus software, then download and re-install LE.\r\n" + "\r\n" + "These Dlls are:\r\n" + "LoaderDll.dll\r\n" + "LocaleEmulator.dll", "Locale Emulator Version " + GlobalHelper.GetLEVersion(), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!File.Exists(LEConfig.GlobalConfigPath)) { MessageBox.Show( "\"LEConfig.xml\" not found. \r\n" + "Please run \"LEGUI.exe\" once to let it generate one for you.", "Locale Emulator Version " + GlobalHelper.GetLEVersion(), MessageBoxButtons.OK, MessageBoxIcon.Information); } if (args.Length == 0) { MessageBox.Show( "Welcome to Locale Emulator command line tool.\r\n" + "\r\n" + "Usage: LEProc.exe\r\n" + "\t[-run] path [args]\r\n" + "\t-runas guid path [args]\r\n" + "\t-manage path\r\n" + "\t-global\r\n" + "\r\n" + "path\tFull path of the target application.\r\n" + "guid\tGuid of the target profile (in LEConfig.xml).\r\n" + "args\tAdditional arguments will be passed to the application.\r\n" + "-run\tRun an application with it's own profile.\r\n" + "-runas\tRun an application with a global profile of specific Guid.\r\n" + "-manage\tModify the profile of one application.\r\n" + "-global\tOpen Global Profile Manager.\r\n" + "\r\n" + "\r\n" + "Have a suggestion? Want to report a bug? You're welcome! \r\n" + "Go to https://github.com/xupefei/Locale-Emulator/issues.\r\n" + "\r\n" + "\r\n" + "You can press CTRL+C to copy this message to your clipboard.\r\n", "Locale Emulator Version " + GlobalHelper.GetLEVersion() ); GlobalHelper.ShowErrorDebugMessageBox("SYSTEM_REPORT", 0); return; } try { Args = args; switch (Args[0]) { case "-run": //-run %APP% RunWithIndependentProfile(Args[1]); break; case "-manage": //-manage %APP% Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEGUI.exe"), $"\"{Args[1]}.le.config\""); break; case "-global": //-global Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEGUI.exe")); break; case "-runas": //-runas %GUID% %APP% RunWithGlobalProfile(Args[1], Args[2]); break; default: // Still run as "-run" if (File.Exists(Args[0])) { Args = new[] { "-run" }.Concat(Args).ToArray(); RunWithIndependentProfile(Args[1]); } break; } } catch { } }
private static void DoRunWithLEProfile(string absPath, int argumentsStart, LEProfile profile) { try { if (profile.RunAsAdmin && !SystemHelper.IsAdministrator()) { ElevateProcess(); return; } if (profile.RunWithSuspend) { if (DialogResult.No == MessageBox.Show( "You are running a exectuable with CREATE_SUSPENDED flag.\r\n" + "\r\n" + "The exectuable will be executed after you click the \"Yes\" button, " + "but as a background process which has no notifications at all." + "You can attach it by using OllyDbg, or stop it with Task Manager.\r\n", "Locale Emulator Debug Mode Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Information )) { return; } } var applicationName = string.Empty; var commandLine = string.Empty; if (Path.GetExtension(absPath).ToLower() == ".exe") { applicationName = absPath; commandLine = absPath.StartsWith("\"") ? $"{absPath} " : $"\"{absPath}\" "; // use arguments in le.config, prior to command line arguments commandLine += string.IsNullOrEmpty(profile.Parameter) && Args.Skip(argumentsStart).Any() ? Args.Skip(argumentsStart).Aggregate((a, b) => $"{a} {b}") : profile.Parameter; } else { var jb = AssociationReader.GetAssociatedProgram(Path.GetExtension(absPath)); if (jb == null) { return; } applicationName = jb[0]; commandLine = jb[0].StartsWith("\"") ? $"{jb[0]} " : $"\"{jb[0]}\" "; commandLine += jb[1].Replace("%1", absPath).Replace("%*", profile.Parameter); } var currentDirectory = Path.GetDirectoryName(absPath); var ansiCodePage = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.ANSICodePage; var oemCodePage = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.OEMCodePage; var localeID = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.LCID; var defaultCharset = (uint) GetCharsetFromANSICodepage(CultureInfo.GetCultureInfo(profile.Location) .TextInfo.ANSICodePage); var registries = profile.RedirectRegistry ? RegistryEntriesLoader.GetRegistryEntries(profile.IsAdvancedRedirection) : null; var l = new LoaderWrapper { ApplicationName = applicationName, CommandLine = commandLine, CurrentDirectory = currentDirectory, AnsiCodePage = ansiCodePage, OemCodePage = oemCodePage, LocaleID = localeID, DefaultCharset = defaultCharset, HookUILanguageAPI = profile.IsAdvancedRedirection ? (uint)1 : 0, Timezone = profile.Timezone, NumberOfRegistryRedirectionEntries = registries?.Length ?? 0, DebugMode = profile.RunWithSuspend }; registries?.ToList() .ForEach( item => l.AddRegistryRedirectEntry(item.Root, item.Key, item.Name, item.Type, item.GetValue(CultureInfo.GetCultureInfo(profile.Location)))); uint ret; if ((ret = l.Start()) != 0) { if (SystemHelper.IsAdministrator()) { GlobalHelper.ShowErrorDebugMessageBox(commandLine, ret); } else { ElevateProcess(); } } } catch (Exception e) { MessageBox.Show(e.ToString()); } }
public object Convert(object value, Type targetType, object parameter, string language) { return(GlobalHelper.GetSolidColorBrush((value as string) + "FF")); }
// Update is called once per frame void Update() { if (sandboxSurface != GlobalHelper.GetMostImmediateParentVoxeme(sandboxSurface)) { sandboxSurface = GlobalHelper.GetMostImmediateParentVoxeme(sandboxSurface); } if (placementState == PlacementState.Delete) { if (Input.GetMouseButtonDown(0)) { if (GlobalHelper.PointOutsideMaskedAreas( new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y), new Rect[] { new Rect(Screen.width - (15 + (int)(110 * fontSizeModifier / 3)) + 38 * fontSizeModifier - 60, Screen.height - (35 + (int)(20 * fontSizeModifier)), 60, 20 * fontSizeModifier) })) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // Casts the ray and get the first game object hit Physics.Raycast(ray, out selectRayhit); if (selectRayhit.collider != null) { if (selectRayhit.collider.gameObject.transform.root.gameObject == selectedObject) { DeleteVoxeme(selectedObject); actionButtonText = "Add Object"; placementState = PlacementState.Add; selected = -1; cameraControl.allowRotation = true; } } } } } else if (placementState == PlacementState.Place) { if (Input.GetMouseButton(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // Casts the ray and get the first game object hit Physics.Raycast(ray, out selectRayhit); if (selectRayhit.collider != null) { if (selectRayhit.collider.gameObject.transform.root.gameObject == sandboxSurface) { Debug.Log(selectRayhit.point.y); if (Mathf.Abs(selectRayhit.point.y - ((Vector3)preds.ComposeRelation(voxmlLibrary.VoxMLObjectDict["on"], new object[] { sandboxSurface })).y) <= Constants.EPSILON) { if ((Mathf.Abs(selectRayhit.point.x - GlobalHelper.GetObjectWorldSize(sandboxSurface).min.x) >= GlobalHelper.GetObjectWorldSize(selectedObject).extents.x) && (Mathf.Abs(selectRayhit.point.x - GlobalHelper.GetObjectWorldSize(sandboxSurface).max.x) >= GlobalHelper.GetObjectWorldSize(selectedObject).extents.x) && (Mathf.Abs(selectRayhit.point.z - GlobalHelper.GetObjectWorldSize(sandboxSurface).min.z) >= GlobalHelper.GetObjectWorldSize(selectedObject).extents.z) && (Mathf.Abs(selectRayhit.point.z - GlobalHelper.GetObjectWorldSize(sandboxSurface).max.z) >= GlobalHelper.GetObjectWorldSize(selectedObject).extents.z)) { selectedObject.transform.position = new Vector3(selectRayhit.point.x, ((Vector3)preds.ComposeRelation(voxmlLibrary.VoxMLObjectDict["on"], new object[] { sandboxSurface })).y + surfacePlacementOffset, selectRayhit.point.z); Voxeme voxComponent = selectedObject.GetComponent <Voxeme>(); voxComponent.targetPosition = selectedObject.transform.position; foreach (Voxeme child in voxComponent.children) { if (child.isActiveAndEnabled) { if (child.gameObject != voxComponent.gameObject) { child.transform.localPosition = voxComponent.parentToChildPositionOffset[child.gameObject]; child.targetPosition = child.transform.position; } } } } } } } } if (Input.GetKeyDown(KeyCode.Return)) { actionButtonText = "Add Object"; placementState = PlacementState.Add; selected = -1; cameraControl.allowRotation = true; selectedObject.GetComponent <Rigging>().ActivatePhysics(true); SetShader(selectedObject, ShaderType.Default); } } else if (placementState == PlacementState.Add) { if (Input.GetMouseButton(0)) { if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); // Casts the ray and get the first game object hit Physics.Raycast(ray, out selectRayhit); if (selectRayhit.collider != null) { if (GlobalHelper.IsSupportedBy(selectRayhit.collider.gameObject.transform.root.gameObject, sandboxSurface)) { if (selectRayhit.collider.gameObject.transform.root.gameObject.GetComponent <Voxeme>() != null) { selectedObject = selectRayhit.collider.gameObject.transform.root.gameObject; surfacePlacementOffset = (GlobalHelper.GetObjectWorldSize(selectedObject.gameObject).center.y - GlobalHelper.GetObjectWorldSize(selectedObject.gameObject).min.y) + (selectedObject.gameObject.transform.position.y - GlobalHelper.GetObjectWorldSize(selectedObject.gameObject).center.y); SetShader(selectedObject, ShaderType.Highlight); actionButtonText = "Place"; placementState = PlacementState.Place; cameraControl.allowRotation = false; if (selectedObject != null) { selectedObject.GetComponent <Rigging>().ActivatePhysics(false); } } } } } } } }
public override IEnumerable <LogItem> GetEntries(string dataSource, FilterParams filter) { var settings = new XmlReaderSettings { ConformanceLevel = ConformanceLevel.Fragment }; var nt = new NameTable(); var mgr = new XmlNamespaceManager(nt); mgr.AddNamespace("log4j", GlobalHelper.LAYOUT_LOG4J); var pc = new XmlParserContext(nt, mgr, string.Empty, XmlSpace.Default); var date = new DateTime(1970, 1, 1, 0, 0, 0, 0); using (var stream = new FileStream(dataSource, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)) { using (var reader = new StreamReader(stream, System.Text.Encoding.Default, true)) { using (var xmlTextReader = XmlReader.Create(reader, settings, pc)) { var entryId = 1; DateTime?prevTimeStamp = null; while (xmlTextReader.Read()) { if ((xmlTextReader.NodeType != XmlNodeType.Element) || (xmlTextReader.Name != "log4j:event")) { continue; } var entry = new LogItem { Id = entryId, Path = dataSource }; entry.Logger = xmlTextReader.GetAttribute("logger"); entry.TimeStamp = date.AddMilliseconds(Convert.ToDouble(xmlTextReader.GetAttribute("timestamp"))).ToLocalTime(); entry.Delta = prevTimeStamp.HasValue ? GlobalHelper.GetTimeDelta(prevTimeStamp.Value, entry.TimeStamp) : "-"; prevTimeStamp = entry.TimeStamp; entry.Level = xmlTextReader.GetAttribute("level"); entry.Thread = xmlTextReader.GetAttribute("thread"); while (xmlTextReader.Read()) { var breakLoop = false; switch (xmlTextReader.Name) { case "log4j:event": breakLoop = true; break; default: switch (xmlTextReader.Name) { case ("log4j:message"): entry.Message = xmlTextReader.ReadString(); break; case ("log4j:data"): switch (xmlTextReader.GetAttribute("name")) { case ("log4net:UserName"): entry.UserName = xmlTextReader.GetAttribute("value"); break; case ("log4japp"): entry.App = xmlTextReader.GetAttribute("value"); break; case ("log4jmachinename"): entry.MachineName = xmlTextReader.GetAttribute("value"); break; case ("log4net:HostName"): entry.HostName = xmlTextReader.GetAttribute("value"); break; } break; case ("log4j:throwable"): entry.Throwable = xmlTextReader.ReadString(); break; case ("log4j:locationInfo"): entry.Class = xmlTextReader.GetAttribute("class"); entry.Method = xmlTextReader.GetAttribute("method"); entry.File = xmlTextReader.GetAttribute("file"); entry.Line = xmlTextReader.GetAttribute("line"); break; } break; } if (breakLoop) { break; } } if (filterByParameters(entry, filter)) { yield return(entry); entryId++; } } } } } }
private void Awake() { instance = this; }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { string cultureOnCookie = GetCultureOnCookie(filterContext.HttpContext.Request); string cultureOnURL = filterContext.RouteData.Values.ContainsKey("lang") ? filterContext.RouteData.Values["lang"].ToString() : GlobalHelper.DefaultUICulture(); string culture = (cultureOnCookie == string.Empty) ? (filterContext.RouteData.Values["lang"].ToString()) : cultureOnCookie; if (cultureOnURL != culture) { filterContext.HttpContext.Response.RedirectToRoute("LocalizedDefault", new { lang = culture, controller = filterContext.RouteData.Values["controller"], action = filterContext.RouteData.Values["action"] }); return; } SetCurrentUICultureOnThread(culture); if (culture != MultiLanguageViewEngine.CurrentUICulture()) { (ViewEngines.Engines[0] as MultiLanguageViewEngine).SetCurrentUICulture(culture); } base.OnActionExecuting(filterContext); }
public override void Run() { var travelManager = Object.FindObjectOfType <TravelManager>(); var chosenCompanion = travelManager.Party.GetRandomCompanion(); Description = $"{chosenCompanion.FirstName()} finds an abandoned cabin. There are some supplies inside. They are about to leave when they notice a trapdoor to an underground lab. Looks like some unfinished health potions were left behind. Handling these could be dangerous!"; Options = new Dictionary <string, Option>(); var optionTitle = "Leave them alone!"; string optionResultText = "Everyone agrees it's not worth the risk and leaves the lab untouched."; var optionOne = new Option(optionTitle, optionResultText, null, null, EncounterType); Options.Add(optionTitle, optionOne); optionTitle = "Finish making them"; Reward optionTwoReward = null; Penalty optionTwoPenalty = null; const int finishSuccess = 20; var bestCoord = travelManager.Party.GetCompanionWithHighestCoordination(); var coordCheck = Dice.Roll($"{bestCoord.Attributes.Coordination - 1}d6"); var wildRoll = GlobalHelper.RollWildDie(); coordCheck += wildRoll; if (bestCoord.Attributes.Coordination > 5) { optionResultText = $"{chosenCompanion.FirstName()} attempts to finish the potions. \n\nThey finish them easily and end up with 5 potions."; optionTwoReward = new Reward(); optionTwoReward.AddPartyGain(PartySupplyTypes.HealthPotions, 5); } else if (coordCheck >= finishSuccess) { optionResultText = $"{chosenCompanion.FirstName()} attempts to finish the potions. \n\nThey ruin a few of the potions, but nobody gets hurt."; optionTwoReward = new Reward(); optionTwoReward.AddPartyGain(PartySupplyTypes.HealthPotions, 3); } else { optionResultText = $"{chosenCompanion.FirstName()} attempts to finish the potions. \n\nThey are in over their head and make a horrible mistake!"; optionTwoPenalty = new Penalty(); foreach (var companion in travelManager.Party.GetCompanions()) { optionTwoPenalty.AddEntityLoss(companion, EntityStatTypes.CurrentHealth, ReferenceEquals(companion, chosenCompanion) ? 15 : 5); } } var optionTwo = new Option(optionTitle, optionResultText, optionTwoReward, optionTwoPenalty, EncounterType); Options.Add(optionTitle, optionTwo); SubscribeToOptionSelectedEvent(); var eventMediator = Object.FindObjectOfType <EventMediator>(); eventMediator.Broadcast(GlobalHelper.FourOptionEncounter, this); }
/// <summary> /// Default Constructor /// </summary> internal ClipSyncControlForm() { InitializeComponent(); this.globalHelper = new GlobalHelper(); }
public void PayUHelper_GetHashString_UnitTest_ArthurClive() { //Arrange var keyFromXML = GlobalHelper.ReadXML().Elements("payu").Where(x => x.Element("current").Value.Equals("Yes")).Descendants("key").First().Value; var saltkeyFromXML = GlobalHelper.ReadXML().Elements("payu").Where(x => x.Element("current").Value.Equals("Yes")).Descendants("saltkey").First().Value; var txnId = "477d56ca6f1c3d22552a"; PaymentModel paymentModel = new PaymentModel { Amount = "100", ProductInfo = "Tshirt", FirstName = "Sample", Email = "*****@*****.**" }; var requiredHashString = "gtKFFx|477d56ca6f1c3d22552a|100|Tshirt|Sample|[email protected]|||||||||||eCwWELxi"; string[] hashSequence = ("key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5|udf6|udf7|udf8|udf9|udf10").Split('|'); string hashString = ""; var expectedKey = "gtKFFx"; var expectedSaltKey = "eCwWELxi"; var expectHashString = "gtKFFx|477d56ca6f1c3d22552a|100|Tshirt|Sample|[email protected]|||||||||||eCwWELxi"; //Act string hashString = ""; foreach (string hash_var in hashSequence) { if (hash_var == "key") { hashString = hashString + GlobalHelper.ReadXML().Elements("payu").Where(x => x.Element("current").Value.Equals("Yes")).Descendants("key").First().Value; hashString = hashString + '|'; } else if (hash_var == "txnid") { hashString = hashString + txnId; hashString = hashString + '|'; } else if (hash_var == "amount") { hashString = hashString + Convert.ToDecimal(paymentModel.Amount).ToString("g29"); hashString = hashString + '|'; } else if (hash_var == "productinfo") { hashString = hashString + paymentModel.ProductInfo; hashString = hashString + '|'; } else if (hash_var == "firstname") { hashString = hashString + paymentModel.FirstName; hashString = hashString + '|'; } else if (hash_var == "email") { hashString = hashString + paymentModel.Email; hashString = hashString + '|'; } else { hashString = hashString + ""; hashString = hashString + '|'; } } hashString += GlobalHelper.ReadXML().Elements("payu").Where(x => x.Element("current").Value.Equals("Yes")).Descendants("saltkey").First().Value; var result = hashString; //Assert Assert.IsNotNull(result); Assert.AreEqual(requiredHashString, result); Assert.IsNotNull(keyFromXML); Assert.IsNotNull(saltkeyFromXML); Assert.AreEqual(expectedKey, keyFromXML); Assert.AreEqual(expectedSaltKey, saltkeyFromXML); Assert.AreEqual(expectHashString, hashString); }
public override void DoModalWindow(int windowID) { if (placementState != PlacementState.Add) { return; } base.DoModalWindow(windowID); //makes GUI window scrollable scrollPosition = GUILayout.BeginScrollView(scrollPosition); selected = GUILayout.SelectionGrid(selected, listItems, 1, buttonStyle, GUILayout.ExpandWidth(true)); GUILayout.EndScrollView(); if (selected != -1) { render = false; GameObject go = (GameObject)Instantiate(prefabs[selected]); go.transform.position = GlobalHelper.FindClearRegion(sandboxSurface, go).center; Debug.Log(go.transform.position); go.SetActive(true); go.name = go.name.Replace("(Clone)", ""); List <Voxeme> existingObjsOfType = objSelector.allVoxemes.FindAll(v => v.gameObject.name.StartsWith(go.name)); List <int> objIndices = existingObjsOfType.Select(v => Convert.ToInt32(v.name.Replace(go.name, "0"))) .ToList(); for (int i = 0; i < objIndices.Count; i++) { if (objIndices[i] == 0) { objIndices[i] = 1; } } int j; for (j = 0; j < objIndices.Count; j++) { if (objIndices[j] != j + 1) { break; } } go.name = go.name + (j + 1); // store shaders foreach (Renderer renderer in go.GetComponentsInChildren <Renderer>()) { defaultShaders[renderer] = renderer.material.shader; } voxemeInit.InitializeVoxemes(); // Debug.Log (go); // foreach (Voxeme vox in objSelector.allVoxemes) { // Debug.Log (vox.gameObject); // } selectedObject = objSelector.allVoxemes.Find(v => v.gameObject.transform.Find(go.name) != null).gameObject; selectedObject.GetComponent <Voxeme>().VoxMLLoaded += VoxMLUpdated; surfacePlacementOffset = (GlobalHelper.GetObjectWorldSize(selectedObject.gameObject).center.y - GlobalHelper.GetObjectWorldSize(selectedObject.gameObject).min.y) + (selectedObject.gameObject.transform.position.y - GlobalHelper.GetObjectWorldSize(selectedObject.gameObject).center.y); selectedObject.transform.position = new Vector3(go.transform.position.x, ((Vector3)preds.ComposeRelation(voxmlLibrary.VoxMLObjectDict["on"], new object[] { sandboxSurface })).y + surfacePlacementOffset, go.transform.position.z); SetShader(selectedObject, ShaderType.Highlight); actionButtonText = "Place"; placementState = PlacementState.Place; cameraControl.allowRotation = false; selectedObject.GetComponent <Rigging>().ActivatePhysics(false); } }
public override IEnumerable <FreeDocument> ReadFile(Action <int> alreadyGetSize = null) { var titles = new List <string>(); var intColCount = 0; var blnFlag = true; var builder = new StringBuilder(); foreach (var strline in FileEx.LineRead(FileName, AttributeHelper.GetEncoding(EncodingType))) { if (string.IsNullOrWhiteSpace(strline)) { continue; } builder.Clear(); var comma = false; var array = strline.ToCharArray(); var values = new List <string>(); var length = array.Length; var index = 0; while (index < length) { var item = array[index++]; if (item.ToString() == SplitChar) { if (comma) { builder.Append(item); } else { values.Add(builder.ToString()); builder.Clear(); } } else if (item == '"') { comma = !comma; } else { builder.Append(item); } } if (builder.Length > 0) { values.Add(builder.ToString()); } var count = values.Count; if (count == 0) { continue; } //给datatable加上列名 if (blnFlag) { blnFlag = false; intColCount = values.Count; if (ContainHeader) { titles.AddRange(values); continue; } for (var i = 0; i < intColCount; i++) { titles.Add(GlobalHelper.Get("key_55") + i); } } var data = new FreeDocument(); var dict = new Dictionary <string, object>(); for (index = 0; index < Math.Min(titles.Count, values.Count); index++) { if (index == 0 && PropertyNames.Any() == false) { PropertyNames = titles.ToDictionary(d => d, d => d); } var title = titles[index]; var key = PropertyNames.FirstOrDefault(d => d.Value == title).Key; if (key != null) { dict.Add(key, values[index]); } } data.DictDeserialize(dict); yield return(data); } }
public IDataProcess GetOneInstance(string name, bool isAddToList = true, bool newOne = false, bool isAddUI = false) { if (newOne) { var process = PluginProvider.GetObjectByType <IDataProcess>(name); if (process != null) { if (isAddToList) { ; process.SysDataManager = dataManager; process.SysProcessManager = this; var rc4 = process as AbstractProcessMethod; if (rc4 != null) { rc4.MainPluginLocation = MainFrmUI.MainPluginLocation; rc4.MainFrm = MainFrmUI; } var names = CurrentProcessCollections.Select(d => d.Name); var count = names.Count(d => d.Contains(process.TypeName)); if (count > 0) { process.Name = process.TypeName + (count + 1); } CurrentProcessCollections.Add(process); XLogSys.Print.Info(GlobalHelper.Get("key_319") + process.TypeName + GlobalHelper.Get("key_320")); } if (isAddUI) { ControlExtended.UIInvoke(() => LoadProcessView(process)); } return(process); } } return(ProcessCollection.Get(name, isAddToList)); }
void ICommand.Execute(object parameter) { Analytics.TrackEvent(this.Text, new Dictionary <string, string> { { "Parameter", parameter == null?"null":parameter.ToString() }, { "Description", Description } }); ControlExtended.SafeInvoke(() => Execute?.Invoke(parameter), LogType.Info, GlobalHelper.Get("key_133") + this.Text); //HockeyClient.Current.TrackEvent(this.Text); }
public override bool Init() { base.Init(); GitHubApi = new GitHubAPI(); MarketProjects = new ObservableCollection <ProjectItem>(); dockableManager = MainFrmUI as IDockableManager; dataManager = MainFrmUI.PluginDictionary["DataManager"] as IDataManager; ProcessCollection = new ObservableCollection <IDataProcess>(); CurrentProcessTasks = new ObservableCollection <TaskBase>(); if (!MainDescription.IsUIForm) { return(true); } this.datatTimer = new DispatcherTimer(); var aboutAuthor = new BindingAction(GlobalHelper.Get("key_262"), d => { var view = PluginProvider.GetObjectInstance <ICustomView>(GlobalHelper.Get("key_263")); var window = new Window(); window.Title = GlobalHelper.Get("key_263"); window.Content = view; window.ShowDialog(); }) { Description = GlobalHelper.Get("key_264"), Icon = "information" }; var mainlink = new BindingAction(GlobalHelper.Get("key_265"), d => { var url = "https://github.com/ferventdesert/Hawk"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_266"), Icon = "home" }; var helplink = new BindingAction(GlobalHelper.Get("key_267"), d => { var url = "https://ferventdesert.github.io/Hawk/"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_268"), Icon = "question" }; var feedback = new BindingAction(GlobalHelper.Get("key_269"), d => { var url = "https://github.com/ferventdesert/Hawk/issues"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_270"), Icon = "reply_people" }; var giveme = new BindingAction(GlobalHelper.Get("key_271"), d => { var url = "https://github.com/ferventdesert/Hawk/wiki/8-%E5%85%B3%E4%BA%8E%E4%BD%9C%E8%80%85%E5%92%8C%E6%8D%90%E8%B5%A0"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_272"), Icon = "smiley_happy" }; var blog = new BindingAction(GlobalHelper.Get("key_273"), d => { var url = "http://www.cnblogs.com/buptzym/"; System.Diagnostics.Process.Start(url); }) { Description = GlobalHelper.Get("key_274"), Icon = "tower" }; var update = new BindingAction(GlobalHelper.Get("checkupgrade"), d => { AutoUpdater.Start("https://raw.githubusercontent.com/ferventdesert/Hawk/global/Hawk/autoupdate.xml"); }) { Description = GlobalHelper.Get("checkupgrade"), Icon = "arrow_up" }; var helpCommands = new BindingAction(GlobalHelper.Get("key_275")) { Icon = "magnify" }; helpCommands.ChildActions.Add(mainlink); helpCommands.ChildActions.Add(helplink); helpCommands.ChildActions.Add(feedback); helpCommands.ChildActions.Add(giveme); helpCommands.ChildActions.Add(blog); helpCommands.ChildActions.Add(aboutAuthor); helpCommands.ChildActions.Add(update); MainFrmUI.CommandCollection.Add(helpCommands); var hierarchy = (Hierarchy)LogManager.GetRepository(); var debugCommand = new BindingAction(GlobalHelper.Get("debug")) { ChildActions = new ObservableCollection <ICommand> { new BindingAction(GlobalHelper.Get("key_277")) { ChildActions = new ObservableCollection <ICommand> { new BindingAction("Debug", obj => hierarchy.Root.Level = Level.Debug), new BindingAction("Info", obj => hierarchy.Root.Level = Level.Info), new BindingAction("Warn", obj => hierarchy.Root.Level = Level.Warn), new BindingAction("Error", obj => hierarchy.Root.Level = Level.Error), new BindingAction("Fatal", obj => hierarchy.Root.Level = Level.Fatal) } } }, Icon = "" }; MainFrmUI.CommandCollection.Add(debugCommand); BindingCommands = new BindingAction(GlobalHelper.Get("key_279")); var sysCommand = new BindingAction(); sysCommand.ChildActions.Add( new Command( GlobalHelper.Get("key_280"), obj => { if ( MessageBox.Show(GlobalHelper.Get("key_281"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.OK) { ProcessCollection.RemoveElementsNoReturn(d => true, RemoveOperation); } }, obj => true, "clear")); sysCommand.ChildActions.Add( new Command( GlobalHelper.Get("key_282"), obj => { if ( MessageBox.Show(GlobalHelper.Get("key_283"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.OK) { SaveCurrentProject(); } }, obj => true, "save")); BindingCommands.ChildActions.Add(sysCommand); var taskAction1 = new BindingAction(); taskAction1.ChildActions.Add(new Command(GlobalHelper.Get("key_284"), async obj => { var project = await GetRemoteProjectContent(); if (project != null) { foreach (var param in project.Parameters) { //TODO: how check if it is same? name? if (CurrentProject.Parameters.FirstOrDefault(d => d.Name == param.Name) == null) { CurrentProject.Parameters.Add(param); } } CurrentProject.ConfigSelector.SelectItem = project.ConfigSelector.SelectItem; } (obj as ProcessTask).Load(true); }, obj => obj is ProcessTask, "inbox_out")); BindingCommands.ChildActions.Add(taskAction1); var taskAction2 = new BindingAction(GlobalHelper.Get("key_287")); taskAction2.ChildActions.Add(new Command(GlobalHelper.Get("key_288"), obj => { var task = obj as TaskBase; task.Start(); }, obj => { var task = obj as TaskBase; return(task != null && task.IsStart == false); }, "play")); taskAction2.ChildActions.Add(new Command(GlobalHelper.Get("cancel_task"), obj => { var task = obj as TaskBase; if (task.IsStart) { task.Remove(); } task.Remove(); }, obj => { var task = obj as TaskBase; return(task != null); }, "cancel")); var runningTaskActions = new BindingAction(GlobalHelper.Get("key_290")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("key_291"), d => GetSelectedTask(d).Execute(d2 => { d2.IsPause = true; d2.ShouldPause = true; }), d => true, "pause")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("key_292"), d => GetSelectedTask(d).Execute(d2 => { d2.IsPause = false; d2.ShouldPause = false; }), d => ProcessTaskCanExecute(d, false), "play")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("key_293"), d => { var selectedTasks = GetSelectedTask(d).ToList(); CurrentProcessTasks.Where(d2 => selectedTasks.Contains(d2)).ToList().Execute(d2 => d2.Remove()); }, d => ProcessTaskCanExecute(d, null), "delete")); runningTaskActions.ChildActions.Add(new Command(GlobalHelper.Get("property"), d => { var selectedTasks = GetSelectedTask(d).FirstOrDefault(); PropertyGridFactory.GetPropertyWindow(selectedTasks).ShowDialog(); }, d => ProcessTaskCanExecute(d, null), "settings")); BindingCommands.ChildActions.Add(runningTaskActions); BindingCommands.ChildActions.Add(runningTaskActions); var processAction = new BindingAction(); dynamic processview = (MainFrmUI as IDockableManager).ViewDictionary.FirstOrDefault(d => d.Name == GlobalHelper.Get("key_794")) .View; processView = processview.processListBox as ListBox; var tickInterval = ConfigFile.GetConfig().Get <int>("AutoSaveTime"); if (tickInterval > 0) { this.datatTimer.Tick += timeCycle; this.datatTimer.Interval = new TimeSpan(0, 0, 0, tickInterval); this.datatTimer.Start(); } ConfigFile.GetConfig().PropertyChanged += (s, e) => { if (e.PropertyName == "AutoSaveTime") { var tick = ConfigFile.GetConfig().Get <int>("AutoSaveTime"); if (tick <= 0) { tick = 1000000; } this.datatTimer.Interval = new TimeSpan(0, 0, 0, tick); } }; processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_294"), obj => { if (obj != null) { foreach (var process in GetSelectedProcess(obj)) { if (process == null) { return; } var old = obj as IDataProcess; if (old == null) { return; } var name = process.GetType().ToString().Split('.').Last(); var item = GetOneInstance(name, true, true); (process as IDictionarySerializable).DictCopyTo(item as IDictionarySerializable); item.Init(); item.Name = process.Name + "_copy"; } } else { var plugin = GetOneInstance("SmartETLTool", true, true, true) as SmartETLTool; plugin.Init(); ControlExtended.DockableManager.ActiveModelContent(plugin); } }, obj => true, "add")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_295"), obj => { if (obj == null) { var plugin = GetOneInstance("SmartCrawler", true, true, true) as SmartCrawler; plugin.Init(); ControlExtended.DockableManager.ActiveModelContent(plugin); } else { foreach (var process in GetSelectedProcess(obj)) { if (process == null) { return; } var name = process.GetType().ToString().Split('.').Last(); var item = GetOneInstance(name, true, true); (process as IDictionarySerializable).DictCopyTo(item as IDictionarySerializable); item.Init(); item.Name = process.Name + "_copy"; } } }, obj => true, "cloud_add")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_296"), obj => { if (obj == null) { SaveCurrentProject(); } else { foreach (var process in GetSelectedProcess(obj)) { SaveTask(process, false); } } }, obj => true, "save")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_297"), obj => { var process = GetSelectedProcess(obj).FirstOrDefault(); if (process == null) { return; } var view = (MainFrmUI as IDockableManager).ViewDictionary.FirstOrDefault(d => d.Model == process); if (view == null) { LoadProcessView(process); } (MainFrmUI as IDockableManager).ActiveModelContent(process); process.Init(); }, obj => true, "tv")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_298"), obj => { if (MessageBox.Show(GlobalHelper.Get("delete_confirm"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return; } foreach (var process in GetSelectedProcess(obj)) { if (process == null) { return; } RemoveOperation(process); ProcessCollection.Remove(process); var tasks = CurrentProcessTasks.Where(d => d.Publisher == process).ToList(); if (tasks.Any()) { foreach (var item in tasks) { item.Remove(); XLogSys.Print.Warn(string.Format(GlobalHelper.Get("key_299"), process.Name, item.Name)); } } } }, obj => true, "delete")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("key_300"), obj => { ControlExtended.DockableManager.ActiveThisContent(GlobalHelper.Get("ModuleMgmt")); }, obj => true, "home")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("find_ref"), obj => { PrintReferenced(obj as IDataProcess); }, obj => true, "diagram")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("property"), obj => { PropertyGridFactory.GetPropertyWindow(obj).ShowDialog(); }, obj => true, "settings")); processAction.ChildActions.Add(new Command(GlobalHelper.Get("param_group"), obj => { this.dockableManager.ActiveThisContent(GlobalHelper.Get("ModuleMgmt")); MainTabIndex = 2; }, obj => true, "equalizer")); BindingCommands.ChildActions.Add(processAction); BindingCommands.ChildActions.Add(taskAction2); var attributeactions = new BindingAction(GlobalHelper.Get("key_301")); attributeactions.ChildActions.Add(new Command(GlobalHelper.Get("key_302"), obj => { var attr = obj as XFrmWorkAttribute; if (attr == null) { return; } var process = GetOneInstance(attr.MyType.Name, newOne: true, isAddUI: true); process.Init(); }, icon: "add")); BindingCommands.ChildActions.Add(attributeactions); var marketAction = new BindingAction(); marketAction.ChildActions.Add(new Command(GlobalHelper.Get("connect_market"), async obj => { GitHubApi.Connect(ConfigFile.GetConfig().Get <string>("Login"), ConfigFile.GetConfig().Get <string>("Password")); MarketProjects.Clear(); ControlExtended.SetBusy(ProgressBarState.Indeterminate, message: GlobalHelper.Get("get_remote_projects")); MarketProjects.AddRange(await GitHubApi.GetProjects(ConfigFile.GetConfig().Get <string>("MarketUrl"))); ControlExtended.SetBusy(ProgressBarState.NoProgress); }, icon: "refresh")); BindingCommands.ChildActions.Add(marketAction); var marketProjectAction = new BindingAction(); marketProjectAction.ChildActions.Add(new Command(GlobalHelper.Get("key_307"), async obj => { var projectItem = obj as ProjectItem; var keep = MessageBoxResult.Yes; if (projectItem == null) { return; } if (MessageBox.Show(GlobalHelper.Get("is_load_remote_project"), GlobalHelper.Get("key_99"), MessageBoxButton.OKCancel) == MessageBoxResult.Cancel) { return; } if (NeedSave()) { keep = MessageBox.Show(GlobalHelper.Get("keep_old_datas"), GlobalHelper.Get("key_99"), MessageBoxButton.YesNoCancel); if (keep == MessageBoxResult.Cancel) { return; } } var proj = await this.GetRemoteProjectContent(projectItem); LoadProject(proj, keep == MessageBoxResult.Yes); }, icon: "download")); var config = ConfigFile.GetConfig <DataMiningConfig>(); if (config.Projects.Any()) { var project = config.Projects.FirstOrDefault(); if (project != null) { ControlExtended.SafeInvoke(() => { CurrentProject = LoadProject(project.SavePath); }, LogType.Info, GlobalHelper.Get("key_303")); } } BindingCommands.ChildActions.Add(marketProjectAction); if (MainDescription.IsUIForm) { ProgramNameFilterView = new ListCollectionView(PluginProvider.GetPluginCollection(typeof(IDataProcess)).ToList()); ProgramNameFilterView.GroupDescriptions.Clear(); ProgramNameFilterView.GroupDescriptions.Add(new PropertyGroupDescription("GroupName")); var taskView = PluginProvider.GetObjectInstance <ICustomView>(GlobalHelper.Get("key_304")); var userControl = taskView as UserControl; if (userControl != null) { userControl.DataContext = this; dynamic control = userControl; currentProcessTasksView = control.currentProcessTasksView; ((INotifyCollectionChanged)CurrentProcessTasks).CollectionChanged += (s, e) => { ControlExtended.UIInvoke(() => { if (e.Action == NotifyCollectionChangedAction.Add) { dockableManager.ActiveThisContent(GlobalHelper.Get("key_304")); } }); } ; dockableManager.AddDockAbleContent(taskView.FrmState, this, taskView, GlobalHelper.Get("key_304")); } ProcessCollectionView = new ListCollectionView(ProcessCollection); ProcessCollectionView.GroupDescriptions.Clear(); ProcessCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("TypeName")); } var fileCommand = MainFrmUI.CommandCollection.FirstOrDefault(d => d.Text == GlobalHelper.Get("key_305")); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_306"), obj => CreateNewProject()) { Icon = "add" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_307"), obj => { var keep = MessageBoxResult.No; if (NeedSave()) { keep = MessageBox.Show(GlobalHelper.Get("keep_old_datas"), GlobalHelper.Get("key_99"), MessageBoxButton.YesNoCancel); if (keep == MessageBoxResult.Cancel) { return; } } LoadProject(keepLast: keep == MessageBoxResult.Yes); }) { Icon = "inbox_out" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_308"), obj => SaveCurrentProject()) { Icon = "save" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("key_309"), obj => SaveCurrentProject(false)) { Icon = "save" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("generate_project_doc"), obj => { if (CurrentProject == null) { return; } var doc = this.GenerateRemark(this.ProcessCollection); var docItem = new DocumentItem() { Title = this.CurrentProject.Name, Document = doc }; PropertyGridFactory.GetPropertyWindow(docItem).ShowDialog(); }, obj => CurrentProject != null) { Icon = "help" }); fileCommand.ChildActions.Add(new BindingAction(GlobalHelper.Get("recent_file")) { Icon = "save", ChildActions = new ObservableCollection <ICommand>(config.Projects.Select(d => new BindingAction(d.SavePath, obj => { var keep = MessageBoxResult.No; if (NeedSave()) { keep = MessageBox.Show(GlobalHelper.Get("keep_old_datas"), GlobalHelper.Get("key_99"), MessageBoxButton.YesNoCancel); if (keep == MessageBoxResult.Cancel) { return; } } LoadProject(d.SavePath, keep == MessageBoxResult.Yes); }) { Icon = "folder" })) }); var languageMenu = new BindingAction(GlobalHelper.Get("key_lang")) { Icon = "layout" }; var files = Directory.GetFiles("Lang"); foreach (var f in files) { var ba = new BindingAction(f, obj => { AppHelper.LoadLanguage(f); }) { Icon = "layout" }; languageMenu.ChildActions.Add(ba); } // helpCommands.ChildActions.Add(languageMenu); return(true); }
private static void Main(string[] args) { SystemHelper.DisableDPIScale(); try { Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEUpdater.exe"), "schedule"); } catch { } if (!GlobalHelper.CheckCoreDLLs()) { MessageBox.Show( "Some of the core Dlls are missing.\r\n" + "Please whitelist these Dlls in your antivirus software, then download and re-install LE.\r\n" + "\r\n" + "These Dlls are:\r\n" + "LoaderDll.dll\r\n" + "LocaleEmulator.dll", "Locale Emulator Version " + GlobalHelper.GetLEVersion(), MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //If global config does not exist, create a new one. LEConfig.CheckGlobalConfigFile(true); if (args.Length == 0) { MessageBox.Show( "Welcome to Locale Emulator command line tool.\r\n" + "\r\n" + "Usage: LEProc.exe\r\n" + "\tpath\r\n" + "\t-run path [args]\r\n" + "\t-runas guid path [args]\r\n" + "\t-manage path\r\n" + "\t-global\r\n" + "\r\n" + "path\tFull path of the target application.\r\n" + "guid\tGuid of the target profile (in LEConfig.xml).\r\n" + "args\tAdditional arguments will be passed to the application.\r\n" + "\r\n" + "path\tRun an application with \r\n" + "\t\t(i) its own profile (if any) or \r\n" + "\t\t(ii) first global profile (if any) or \r\n" + "\t\t(iii) default ja-JP profile.\r\n" + "-run\tRun an application with it's own profile.\r\n" + "-runas\tRun an application with a global profile of specific Guid.\r\n" + "-manage\tModify the profile of one application.\r\n" + "-global\tOpen Global Profile Manager.\r\n" + "\r\n" + "\r\n" + "You can press CTRL+C to copy this message to your clipboard.\r\n", "Locale Emulator Version " + GlobalHelper.GetLEVersion() ); GlobalHelper.ShowErrorDebugMessageBox("SYSTEM_REPORT", 0); return; } try { Args = args; switch (Args[0]) { case "-run": //-run %APP% RunWithIndependentProfile(Args[1]); break; case "-manage": //-manage %APP% Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEGUI.exe"), $"\"{Args[1]}.le.config\""); break; case "-global": //-global Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEGUI.exe")); break; case "-runas": //-runas %GUID% %APP% RunWithGlobalProfile(Args[1], Args[2]); break; default: if (File.Exists(Args[0])) { RunWithDefaultProfile(Args[0]); } break; } } catch { } }
private void timeCycle(object sender, EventArgs e) { if (NeedSave()) { dynamic welcomeWindow = PluginProvider.GetObjectInstance <ICustomView>(GlobalHelper.Get("auto_save_tooltip")); welcomeWindow.ShowDialogAdvance(); if (welcomeWindow.DialogResult == true) { SaveCurrentProject(true); } } }
/// <summary> /// 功能:记录日志到文件 /// </summary> /// <param name="strSource">消息来源</param> /// <param name="strMessage">消息</param> /// <param name="logAddition">日志附加信息</param> /// <param name="logLevel">消息类型</param> private static void LogToFile(string strSource, string strMessage, string logAddition, LogLevel logLevel) { var strTemp = $"Source:{strSource}--Message:{strMessage}--Addition:{logAddition}--Machine:{GlobalHelper.GetMachineName()},Time:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"; if (logLevel == LogLevel.Error) { m_fileLog.ErrorFormat(strTemp); } else if (logLevel == LogLevel.Information) { m_fileLog.InfoFormat(strTemp); } else { m_fileLog.ErrorFormat(strTemp); m_fileLog.InfoFormat(strTemp); } }
public virtual IEnumerable <IFreeDocument> TransformManyData(IEnumerable <IFreeDocument> datas, AnalyzeItem analyzer = null) { var olddatas = datas; var errorCounter = 0; foreach (var data in datas) { IEnumerable <IFreeDocument> newdatas = null; try { DateTime now = DateTime.Now; newdatas = InternalTransformManyData(data); if (analyzer != null) { analyzer.RunningTime += DateTime.Now - now; } } catch (Exception ex) { if (analyzer != null) { analyzer.Analyzer.AddErrorLog(data, ex, this); } else { XLogSys.Print.Error(string.Format(GlobalHelper.Get("key_208"), this.Column, this.TypeName, ex.Message)); } } if (MainDescription.IsUIForm) { if (((olddatas is IList) == false || !olddatas.Any()) && newdatas is IList && (!newdatas.Any())) { errorCounter++; if (errorCounter == 5 && isErrorRemind) { //连续三次无值输出,表示为异常现象 if (ControlExtended.UIInvoke(() => { var result = MessageBox.Show( string.Format(GlobalHelper.Get("fail_remind"), Column, TypeName), GlobalHelper.Get("key_570"), MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { var window = PropertyGridFactory.GetPropertyWindow(this); var list = processManager.CurrentProcessTasks.Where( task => task.Publisher == Father && task.IsPause == false).ToList(); list.Execute(task => task.Remove()); // window.Closed += (s, e) => Father.ETLMount++; Father.ETLMount = Math.Max(0, Father.CurrentETLTools.IndexOf(this)); window.ShowDialog(); window.Topmost = true; return(true); } if (result == MessageBoxResult.Cancel) { isErrorRemind = false; return(true); } return(false); }) == false) { yield break; } } } else { errorCounter = 0; } } if (newdatas == null) { continue; } foreach (var newdata in newdatas) { yield return(newdata); } } }
public AppearenceSettingsViewModel() { AvailableHighlightStyles = new ObservableCollection <SyntaxHighlightStyle> { new SyntaxHighlightStyle { Name = "Borland", ColorOne = GlobalHelper.GetSolidColorBrush("000080FF"), ColorTwo = GlobalHelper.GetSolidColorBrush("000000FF"), ColorThree = GlobalHelper.GetSolidColorBrush("008800FF"), ColorFour = GlobalHelper.GetSolidColorBrush("000000FF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("FFFFFFFF") }, new SyntaxHighlightStyle { Name = "Colorful", ColorOne = GlobalHelper.GetSolidColorBrush("008800FF"), ColorTwo = GlobalHelper.GetSolidColorBrush("0e84b5FF"), ColorThree = GlobalHelper.GetSolidColorBrush("888888FF"), ColorFour = GlobalHelper.GetSolidColorBrush("BB0066FF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("FFFFFFFF") }, new SyntaxHighlightStyle { Name = "Emacs", ColorOne = GlobalHelper.GetSolidColorBrush("AA22FFFF"), ColorTwo = GlobalHelper.GetSolidColorBrush("0000FFFF"), ColorThree = GlobalHelper.GetSolidColorBrush("008800FF"), ColorFour = GlobalHelper.GetSolidColorBrush("0000FFFF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("f8f8f8FF") }, new SyntaxHighlightStyle { Name = "Fruity", ColorOne = GlobalHelper.GetSolidColorBrush("fb660aFF"), ColorTwo = GlobalHelper.GetSolidColorBrush("ffffffFF"), ColorThree = GlobalHelper.GetSolidColorBrush("008800FF"), ColorFour = GlobalHelper.GetSolidColorBrush("ffffffFF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("111111FF") }, new SyntaxHighlightStyle { Name = "Monokai", ColorOne = GlobalHelper.GetSolidColorBrush("66d9efFF"), ColorTwo = GlobalHelper.GetSolidColorBrush("f8f8f2FF"), ColorThree = GlobalHelper.GetSolidColorBrush("75715eFF"), ColorFour = GlobalHelper.GetSolidColorBrush("a6e22eFF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("272822FF") }, new SyntaxHighlightStyle { Name = "Native", ColorOne = GlobalHelper.GetSolidColorBrush("6ab825FF"), ColorTwo = GlobalHelper.GetSolidColorBrush("447fcfFF"), ColorThree = GlobalHelper.GetSolidColorBrush("999999FF"), ColorFour = GlobalHelper.GetSolidColorBrush("447fcfFF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("202020FF") }, new SyntaxHighlightStyle { Name = "Perldoc", ColorOne = GlobalHelper.GetSolidColorBrush("8B008BFF"), ColorTwo = GlobalHelper.GetSolidColorBrush("008b45FF"), ColorThree = GlobalHelper.GetSolidColorBrush("228B22FF"), ColorFour = GlobalHelper.GetSolidColorBrush("008b45FF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("eeeeddFF") }, new SyntaxHighlightStyle { Name = "Vim", ColorOne = GlobalHelper.GetSolidColorBrush("cdcd00FF"), ColorTwo = GlobalHelper.GetSolidColorBrush("ccccccFF"), ColorThree = GlobalHelper.GetSolidColorBrush("000080FF"), ColorFour = GlobalHelper.GetSolidColorBrush("00cdcdFF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("000000FF") }, new SyntaxHighlightStyle { Name = "VS", ColorOne = GlobalHelper.GetSolidColorBrush("0000ffFF"), ColorTwo = GlobalHelper.GetSolidColorBrush("000000FF"), ColorThree = GlobalHelper.GetSolidColorBrush("008000FF"), ColorFour = GlobalHelper.GetSolidColorBrush("2b91afFF"), BackgroundColor = GlobalHelper.GetSolidColorBrush("ffffffFF") }, }; }
/// <summary> /// /// </summary> /// <param name="repoPath">Tuple with Repository, path and branch</param> /// <returns></returns> public async Task Load(Tuple <Repository, string, string> repoPath) { IsSupportedFile = true; Repository = repoPath.Item1; Path = repoPath.Item2; if (GlobalHelper.IsInternet()) { isLoading = true; if (string.IsNullOrWhiteSpace(repoPath.Item3)) { SelectedBranch = await RepositoryUtility.GetDefaultBranch(Repository.Id); } else { SelectedBranch = repoPath.Item3; } IsImage = false; if ((Path.ToLower().EndsWith(".exe")) || (Path.ToLower().EndsWith(".pdf")) || (Path.ToLower().EndsWith(".ttf")) || (Path.ToLower().EndsWith(".suo")) || (Path.ToLower().EndsWith(".mp3")) || (Path.ToLower().EndsWith(".mp4")) || (Path.ToLower().EndsWith(".avi"))) { /* * Unsupported file types */ IsSupportedFile = false; isLoading = false; return; } if ((Path.ToLower()).EndsWith(".png") || (Path.ToLower()).EndsWith(".jpg") || (Path.ToLower()).EndsWith(".jpeg") || (Path.ToLower().EndsWith(".gif"))) { /* * Image file types */ IsImage = true; String uri = (await RepositoryUtility.GetRepositoryContentByPath(Repository, Path, SelectedBranch))?[0].Content.DownloadUrl; if (!string.IsNullOrWhiteSpace(uri)) { ImageFile = new BitmapImage(new Uri(uri)); } isLoading = false; return; } if ((Path.ToLower()).EndsWith(".md")) { /* * Files with .md extension */ TextContent = (await RepositoryUtility.GetRepositoryContentByPath(Repository, Path, SelectedBranch))?[0].Content.Content; isLoading = false; return; } /* * Code files */ String content = (await RepositoryUtility.GetRepositoryContentByPath(Repository, Path, SelectedBranch))?[0].Content.Content; if (content == null) { IsSupportedFile = false; isLoading = false; return; } SyntaxHighlightStyleEnum style = (SyntaxHighlightStyleEnum)SettingsService.Get <int>(SettingsKeys.HighlightStyleIndex); bool lineNumbers = SettingsService.Get <bool>(SettingsKeys.ShowLineNumbers); HTMLContent = await HiliteAPI.TryGetHighlightedCodeAsync(content, Path, style, lineNumbers, CancellationToken.None); if (HTMLContent == null) { /* * Plain text files (Getting HTML for syntax highlighting failed) */ RepositoryContent result = await RepositoryUtility.GetRepositoryContentTextByPath(Repository, Path, SelectedBranch); if (result != null) { TextContent = result.Content; } } if (HTMLContent == null && TextContent == null) { IsSupportedFile = false; } isLoading = false; } }
private static void ProcessUpdate(XmlDocument xmlContent, NotifyIcon notifyIcon) { var newVer = xmlContent.SelectSingleNode(@"/VersionInfo/Version/text()").Value; if (CompareVersion(GlobalHelper.GetLEVersion(), newVer)) { try { GlobalHelper.SetLastUpdate(int.Parse(DateTime.Now.ToString("yyyyMMdd"))); var version = xmlContent.SelectSingleNode(@"/VersionInfo/Version/text()").Value; var date = xmlContent.SelectSingleNode(@"/VersionInfo/Date/text()").Value; url = xmlContent.SelectSingleNode(@"/VersionInfo/Url/text()").Value; var note = xmlContent.SelectSingleNode(@"/VersionInfo/Note/text()").Value; notifyIcon.BalloonTipClicked += (sender, e) => { Process.Start(url); notifyIcon.Visible = false; Environment.Exit(0); }; notifyIcon.BalloonTipClosed += (sender, e) => { notifyIcon.Visible = false; Environment.Exit(0); }; notifyIcon.ShowBalloonTip(0, $"New Version {version} Available (Current: {GlobalHelper.GetLEVersion()})", $"{note}\r\n" + "\r\n" + "Click here to open download page.", ToolTipIcon.Info); } catch (Exception) { notifyIcon.Visible = false; Environment.Exit(0); } } else { notifyIcon.Visible = false; Environment.Exit(0); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ReportViewer1.ProcessingMode = ProcessingMode.Local; ReportViewer1.LocalReport.ReportPath = "D:\\Projects\\Sofwena\\Sofwena-ERP\\ERP1\\ERP.Web\\RDLC\\TicketingManagement\\CounterSettlement.rdlc"; ReportService service = new ReportService(); OrganisationService companyInfo = new OrganisationService(); string from = Request.QueryString.Get("from"); string to = Request.QueryString.Get("to"); string userIdId = Request.QueryString.Get("userId"); DateTime tDate = Convert.ToDateTime(to); DateTime fDate = Convert.ToDateTime(from); NPDate date = new NPDate(); string f_DateBS = ""; string t_DateBS = ""; DataTable dt = service.GetCounterSettlementReport(fDate, tDate, userIdId); f_DateBS = date.GetNepaliDate(Convert.ToDateTime(fDate)).npDate; t_DateBS = date.GetNepaliDate(Convert.ToDateTime(tDate)).npDate; List <Organisation> company = companyInfo.List().ToList(); if (company.Count > 0) { ReportParameter address = new ReportParameter("address", company[0].Address); ReportViewer1.LocalReport.SetParameters(address); ReportParameter companyName = new ReportParameter("companyName", company[0].Name); ReportViewer1.LocalReport.SetParameters(companyName); } string fromAD = GlobalHelper.ToShortDate(fDate.ToString()); string toAD = GlobalHelper.ToShortDate(tDate.ToString()); ReportParameter fDateAD = new ReportParameter("fDateAD", fromAD); ReportViewer1.LocalReport.SetParameters(fDateAD); ReportParameter tDateAD = new ReportParameter("tDateAD", toAD); ReportViewer1.LocalReport.SetParameters(tDateAD); ReportParameter fDateBS = new ReportParameter("fDateBS", f_DateBS.ToString()); ReportViewer1.LocalReport.SetParameters(fDateBS); ReportParameter tDateBS = new ReportParameter("tDateBS", t_DateBS.ToString()); ReportViewer1.LocalReport.SetParameters(tDateBS); string userName = Session["userName"].ToString(); string fyCode = Session["fiscalCode"].ToString(); ReportParameter User = new ReportParameter("User", userName); ReportViewer1.LocalReport.SetParameters(User); ReportParameter fy = new ReportParameter("fy", fyCode); ReportViewer1.LocalReport.SetParameters(fy); ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource datasource = new ReportDataSource("Denomination", dt); ReportViewer1.LocalReport.DataSources.Add(datasource); ReportViewer1.LocalReport.Refresh(); } }
private async void VisitUrlAsync() { if (!enableRefresh) { return; } if (hasInit == false) { return; } URLHTML = await MainFrm.RunBusyWork(() => { HttpStatusCode code; ConfigFile.GetConfig <DataMiningConfig>().RequestCount++; return(GetHtml(URL, out code)); }, title : GlobalHelper.Get("long_visit_web")); if (URLHTML.Contains(GlobalHelper.Get("key_671")) && MessageBox.Show(GlobalHelper.Get("key_672") + URLHTML + GlobalHelper.Get("key_673"), GlobalHelper.Get("key_99"), MessageBoxButton.OK) == MessageBoxResult.OK) { return; } ControlExtended.SafeInvoke(() => { HtmlDoc.LoadHtml(URLHTML); if (MainDescription.IsUIForm) { var dock = MainFrm as IDockableManager ?? ControlExtended.DockableManager; var control = dock?.ViewDictionary.FirstOrDefault(d => d.Model == this); if (control != null) { dynamic invoke = control.View; if (IsSuperMode == false) { invoke.UpdateHtml(URLHTML); OnPropertyChanged("HtmlDoc"); } else { invoke.UpdateHtml(GlobalHelper.Get("key_674")); } } } }, name: GlobalHelper.Get("key_675")); if (string.IsNullOrWhiteSpace(selectText) == false) { currentXPaths = HtmlDoc.SearchXPath(SelectText, () => IsAttribute).GetEnumerator(); GetXPathAsync(); } OnPropertyChanged("URLHTML"); }
private void Clear() { GlobalHelper.DestroyAllChildren(OrderTabParent); GlobalHelper.DestroyAllChildren(IngredientPrefabParent); OrderDescription.transform.GetComponent <TextMeshProUGUI>().text = string.Empty; }