public static IMapper GetMapper() => new MapperConfiguration(cfg => { cfg.CreateMap <ApplicationPool, ApplicationPoolGetDto>() .ForMember(dm => dm.Status, o => o.MapFrom(sm => sm.State)) .ForMember(dm => dm.Identity, o => o.MapFrom(sm => sm.ProcessModel.IdentityType)) .ForMember(dm => dm.Applications, o => o.MapFrom(sm => ApplicationPoolUtils.GetNumberOfApplicationPoolApplications(sm.Name))); cfg.CreateMap <ApplicationPool, ApplicationPoolEditablePropertiesDto>() .ForMember(dm => dm.Identity, o => o.MapFrom(sm => sm.ProcessModel.IdentityType)); cfg.CreateMap <App, ApplicationGetDto>() .ForMember(dm => dm.Name, o => o.MapFrom(sm => ApplicationUtils.ConvertPathToName(sm.Path))) .ForMember(dm => dm.PhysicalPath, o => o.MapFrom(sm => sm.VirtualDirectories["/"].PhysicalPath)) .ForMember(dm => dm.ApplicationPoolStatus, o => o.MapFrom(sm => ApplicationPoolUtils.GetApplicationPoolStatus(sm.ApplicationPoolName))); cfg.CreateMap <App, ApplicationEditablePropertiesDto>() .ForMember(dm => dm.Name, o => o.MapFrom(sm => ApplicationUtils.ConvertPathToName(sm.Path))) .ForMember(dm => dm.PhysicalPath, o => o.MapFrom(sm => sm.VirtualDirectories["/"].PhysicalPath)); cfg.CreateMap <Build, BuildGetDto>(); }) .CreateMapper();
public IHttpActionResult Get() { try { var request = Context.AuthenticatedRequest; var siteId = request.GetQueryInt("siteId"); if (!request.IsAdminLoggin) { return(Unauthorized()); } var settings = ApplicationUtils.GetSettings(siteId); var categories = CategoryManager.GetCategoryInfoList(siteId); var departments = DepartmentManager.GetDepartmentInfoList(siteId); return(Ok(new { Categories = categories, Departments = departments, Settings = settings })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult GetUserInformation(string username) { using (ApplicationDbContext db = new ApplicationDbContext()) { var user = UserManager.FindByEmail(username); return(Ok(new { User = ApplicationUtils.CreateApplicationUserViewModel(user) })); } }
public static void Start() { Directory.CreateDirectory("$SacredUtils\\temp"); File.Create("$SacredUtils\\temp\\updated.su"); Process.Start("mnxupdater.exe", ApplicationInfo.CurrentExe + " _newVersionSacredUtilsTemp.exe"); ApplicationUtils.Shutdown(); }
public void AssertThatApplicationIsNotRunning(AppIdentity appIdentity) { IApplicationPool applicationPool = _diContainer.Resolve <IApplicationPool>(); Assert.IsFalse(applicationPool.HasApplication(appIdentity), string.Format("App {0} should not be running!", appIdentity)); Assert.IsFalse(Directory.Exists(Path.Combine(_applicationsInstallPath, ApplicationUtils.GetApplicationRelativePath(appIdentity)))); }
private int ProcessUploadedFile(string fileName) { int idImport = ApplicationConstants.INT_NULL_VALUE; string cleanFileName = ApplicationUtils.GetCleanFileName(fileName); string shareFilePath = string.Empty; // get the directory from appsettings string dirUrl = ConfigurationManager.AppSettings["UploadFolderInitial"]; string dirPath = Server.MapPath(dirUrl); string shareName = @"\\" + Server.MachineName + @"\" + dirUrl; shareFilePath = shareName + @"\" + cleanFileName; ImportInitialBudget initialBudgetUpload = new ImportInitialBudget(SessionManager.GetSessionValueNoRedirect(this.Page, SessionStrings.CONNECTION_MANAGER)); try { idImport = initialBudgetUpload.WriteToInitialBudgetImportTable(shareFilePath, currentUser.IdAssociate); if (idImport > 0) { btnProcess.Enabled = true; ProcessIdHdn.Value = idImport.ToString(); MoveFileToDirectory(TargetDirectoryEnum.DIRECTORY_PROCESSED, shareFilePath); } return(idImport); } catch (Exception ex) { btnProcess.Enabled = false; MoveFileToDirectory(TargetDirectoryEnum.DIRECTORY_CANCELLED, shareFilePath); throw new IndException(ex); } }
public void Init(VisualElement visualElement, PanelSettings panelSettings = null) { if (texture != null) { throw new UnityException("Texture already exists."); } if (visualElement.resolvedStyle.width <= 0 || visualElement.resolvedStyle.height <= 0) { throw new UnityException("VisualElement has no size. Consider calling Init from GeometryChangedEvent."); } float scaleX = panelSettings != null ? (float)ApplicationUtils.GetCurrentAppResolution().Width / panelSettings.referenceResolution.x : 1; float scaleY = panelSettings != null ? (float)ApplicationUtils.GetCurrentAppResolution().Height / panelSettings.referenceResolution.y : 1; int width = (int)(visualElement.resolvedStyle.width * scaleX); int height = (int)(visualElement.resolvedStyle.height * scaleY); Init(width, height); visualElement.style.backgroundImage = new StyleBackground(texture); }
public ActionResult SubmitLikeDislike(int videoId, bool isLike) { if (!User.Identity.IsAuthenticated) { return(Json(new { message = "redirect" }, JsonRequestBehavior.AllowGet)); } using (treca_aplikacija_model db = new treca_aplikacija_model()) { UserViewModel user = ApplicationUtils.FindUserByUsername(User.Identity.GetApplicationUserUsername()); try { ApplicationUtils.RemoveLikeDislike(true, videoId, user.users_id); } catch (Exception) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } video_like_dislike newVld = new video_like_dislike(); newVld.users_id = (byte)user.users_id; newVld.video_id = (byte)videoId; newVld.is_like = isLike == true ? true : false; db.video_like_dislike.Add(newVld); db.SaveChanges(); } return(Json(new { Success = true }, JsonRequestBehavior.AllowGet)); }
private static string GetPropertiesFilePath(string propertiesFileNameWithCountryCode) { string path = I18NFolder + "/" + propertiesFileNameWithCountryCode + PropertiesFileExtension; path = ApplicationUtils.GetStreamingAssetsPath(path); return(path); }
public ActionResult Create(string Content, int videoId) { if (User.Identity.IsAuthenticated == false) { return(Json(new { message = "redirect" }, JsonRequestBehavior.AllowGet)); } treca_aplikacija_model db = new treca_aplikacija_model(); comment comment = new comment(); comment.comment_video_id = (byte)videoId; string LoggedInUserName = User.Identity.GetApplicationUserUsername(); foreach (var x in db.users) { if (x.user_username.Equals(LoggedInUserName)) { comment.comment_user_id = x.users_id; } } comment.comment_created = DateTime.Now; comment.comment_content = Content; db.comments.Add(comment); db.SaveChanges(); //? UserViewModel CommentOwner = ApplicationUtils.CreateUserViewModelDTO(db.users.Find(comment.comment_user_id)); CommentViewModel Comment = ApplicationUtils.CreateCommentViewModelDTO(db.comments.Find(comment.comment_id)); return(Json(new { User = CommentOwner, Comment = Comment }, JsonRequestBehavior.AllowGet)); }
public AboutWindowViewModel( [NotNull] ApplicationUtils applicationUtils, [NotNull] GlobalVariables globalVariables ) { // properties Version = new DelegatedProperty <string>(applicationUtils.GetVersion, null).AsReadonly(); // commands ShowDeveloperCommand = new ActionCommand(() => { WebUtils.OpenLinkInBrowser("https://www.andnixsh.com/"); }); ThankDeveloperCommand = new ActionCommand(() => { WebUtils.OpenLinkInBrowser("http://4pda.ru/forum/index.php?showtopic=477614&st=980"); }); OpenAppDataFolderCommand = new ActionCommand(() => { Process.Start(globalVariables.AppDataPath); }); OpenSourcesPage = new ActionCommand(() => { WebUtils.OpenLinkInBrowser("https://github.com/AndnixSH/SaveToGame"); }); }
/// <summary> /// /// </summary> /// <param name="browser"></param> /// <param name="numberOfCreditsToWaitFor"></param> public void WaitForProgramCreditsWindowsService(IWebDriver browser, string numberOfCreditsToWaitFor) { ProgramPage PP = new ProgramPage(browser); PP.ClickAndWait(PP.DetailsTab); ApplicationUtils.WaitForCreditsToBeApplied(PP, Bys.ProgramPage.DetailsTabCreditsValueLbl, numberOfCreditsToWaitFor); }
static void NewPerson() { int option = 2; string firstName = ""; string lastName = ""; string birthday = ""; while (option == 2) { firstName = ReadString("Digite o primeiro nome da pessoa que deseja adicionar: "); lastName = ReadString("Digite o sobrenome da pessoa que deseja adicionar: "); birthday = ReadString("Digite a data de aniversário no formato dd/MM/yyyy: "); while (ApplicationUtils.checkDate(birthday) == false) { Console.WriteLine("Data inválida."); birthday = ReadString("Digite a data de aniversário no formato dd/MM/yyyy: "); } Console.WriteLine("Os dados abaixo estão corretos?"); Console.WriteLine($"Nome: {firstName} {lastName}"); Console.WriteLine($"Data do aniversário: {birthday}"); option = int.Parse(ReadString("1 - Sim / 2 - Não: ")); Console.Clear(); } DateTime birthdayConverted = Convert.ToDateTime(birthday); var newPerson = PersonService.AddNewPerson(firstName, lastName, birthdayConverted); Console.WriteLine($"{newPerson}\n"); MainMenu(); }
public AboutWindowViewModel( [NotNull] ApplicationUtils applicationUtils, [NotNull] GlobalVariables globalVariables ) { // properties Version = new DelegatedProperty <string>(applicationUtils.GetVersion, null).AsReadonly(); // commands ShowDeveloperCommand = new ActionCommand(() => { WebUtils.OpenLinkInBrowser("http://www.4pda.ru/forum/index.php?showuser=2114045"); }); ThankDeveloperCommand = new ActionCommand(() => { WebUtils.OpenLinkInBrowser("http://4pda.ru/forum/index.php?act=rep&type=win_add&mid=2114045&p=23243303"); }); OpenAppDataFolderCommand = new ActionCommand(() => { Process.Start(globalVariables.AppDataPath); }); OpenSourcesPage = new ActionCommand(() => { WebUtils.OpenLinkInBrowser("https://github.com/And42/SaveToGame"); }); }
public void AssertThatApplicationIsNotRunning(AppIdentity appIdentity) { IApplicationPool applicationPool = _yamsDiModule.Container.Resolve <IApplicationPool>(); Assert.False(applicationPool.HasApplication(appIdentity), $"App {appIdentity} should not be running!"); Assert.False(Directory.Exists(Path.Combine(_applicationsInstallPath, ApplicationUtils.GetApplicationRelativePath(appIdentity)))); }
// Checks whether the audio and video file formats of the song are supported. // Returns true iff the audio file of the SongMeta exists and is supported. private bool CheckSupportedMediaFormats(SongMeta songMeta) { // Check video format. // Video is optional. if (!songMeta.Video.IsNullOrEmpty()) { if (!ApplicationUtils.IsSupportedVideoFormat(Path.GetExtension(songMeta.Video))) { Debug.LogWarning("Unsupported video format: " + songMeta.Video); songMeta.Video = ""; } else if (!File.Exists(SongMetaUtils.GetAbsoluteSongVideoPath(songMeta))) { Debug.LogWarning("Video file does not exist: " + SongMetaUtils.GetAbsoluteSongVideoPath(songMeta)); songMeta.Video = ""; } } // Check audio format. // Audio is mandatory. Without working audio file, the song cannot be played. if (!ApplicationUtils.IsSupportedAudioFormat(Path.GetExtension(songMeta.Mp3))) { Debug.LogWarning("Unsupported audio format: " + songMeta.Mp3); return(false); } else if (!File.Exists(SongMetaUtils.GetAbsoluteSongFilePath(songMeta))) { Debug.LogWarning("Audio file does not exist: " + SongMetaUtils.GetAbsoluteSongFilePath(songMeta)); return(false); } return(true); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //TODO attribution: http://www.codeproject.com/Articles/100199/Smart-Hotkey-Handler-NET SmartHotKey.HotKey hotKeyManager = new SmartHotKey.HotKey(); hotKeyManager.AddHotKey("Control+Shift+S"); hotKeyManager.AddHotKey("Control+Shift+D"); hotKeyManager.HotKeyPressed += new SmartHotKey.HotKey.HotKeyEventHandler(hotKeyManager_HotKeyPressed); RefreshTables.updateTables(); ApplicationUtils.checkForUpdates("RiskApps3.exe"); ApplicationUtils.checkFirstLogin(); #if international string region = RiskApps3.Utilities.Configurator.getNodeValue("globals", "CultureRegion"); if (string.IsNullOrEmpty(region) == false) { CultureInfo culture = new CultureInfo(region); Thread.CurrentThread.CurrentCulture = culture; Thread.CurrentThread.CurrentUICulture = culture; } #endif //then if authenticate, show main form Application.Run(new MainForm()); }
public void FailWhenInputFilesAreMissing() { // Arrange a file with just dates var file1 = @"InputFile_1.data"; var baseDirectory = AppDomain.CurrentDomain.BaseDirectory; var binDirectory = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory).Parent.Parent.FullName; var inputFile1 = Path.Combine(binDirectory, file1); if (File.Exists(inputFile1)) { File.Delete(inputFile1); } Assert.Throws <FileNotFoundException>(() => ApplicationUtils.checkIfFileExists(inputFile1)); var file2 = @"InputFile_2.data"; var inputFile2 = Path.Combine(binDirectory, file2); if (File.Exists(inputFile2)) { File.Delete(inputFile2); } Assert.Throws <FileNotFoundException>(() => ApplicationUtils.checkIfFileExists(inputFile2)); }
public ActionResult DeleteConfirmed(string username) { //Delete applicationUser //Delete databaserUser Debug.WriteLine(username); int userId = ApplicationUtils.FindUserByUsername(username).users_id; string loggedInUserUsername = User.Identity.GetApplicationUserUsername(); if (loggedInUserUsername.Equals(username)) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie); UserManager.Delete(UserManager.FindByEmail((ApplicationUtils.FindUserByUsername(username)).user_email)); } using (treca_aplikacija_model db = new treca_aplikacija_model()) { db.Database.ExecuteSqlCommand("DELETE FROM comment_like_dislike WHERE users_id = {0}", userId); db.Database.ExecuteSqlCommand("DELETE FROM video_like_dislike WHERE users_id = {0}", userId); db.Database.ExecuteSqlCommand("DELETE FROM users_role WHERE users_id = {0}", userId); db.Database.ExecuteSqlCommand("DELETE FROM users_following WHERE user_following = {0} or user_followed = {1}", userId, userId); db.Database.ExecuteSqlCommand("DELETE FROM comment WHERE comment_user_id = {0}", userId); db.Database.ExecuteSqlCommand("DELETE FROM comment WHERE comment_video_id IN (SELECT video_id FROM video WHERE video_user_id = {0})", userId); //db.Database.ExecuteSqlCommand("DELETE FROM comment WHERE video_id = SELEC", userId); db.Database.ExecuteSqlCommand("DELETE FROM video WHERE video_user_id = {0}", userId); db.Database.ExecuteSqlCommand("DELETE FROM users WHERE users_id = {0}", userId); } return(RedirectToAction("Index", "Video")); }
public void ReloadThemes() { if (Application.isEditor && !Application.isPlaying) { ImageManager.ClearCache(); AudioManager.ClearCache(); } string lastThemeName = CurrentTheme?.Name; themeNameToTheme = new Dictionary <string, Theme>(); string themesFilePath = ApplicationUtils.GetStreamingAssetsPath(ThemesFolderName + "/" + ThemesFileName); string themesFileContent = File.ReadAllText(themesFilePath); ReloadThemesFromXml(themesFileContent); // Restore last selected theme if (!lastThemeName.IsNullOrEmpty()) { Theme theme = GetTheme(lastThemeName); if (theme != null) { CurrentTheme = theme; } } }
public IHttpActionResult Get() { try { var request = Context.AuthenticatedRequest; var siteId = request.GetQueryInt("siteId"); if (!request.IsAdminLoggin) { return(Unauthorized()); } var name = request.GetQueryString("name"); var templateInfoList = TemplateManager.GetTemplateInfoList(); var templateInfo = templateInfoList.FirstOrDefault(x => ApplicationUtils.EqualsIgnoreCase(name, x.Name)); return(Ok(new { Value = templateInfo })); } catch (Exception ex) { return(InternalServerError(ex)); } }
private static List <Vector3> GetPositionListForSingleChild(int playerId, List <Vector3> piecePositions, Transform[] childrenTransform, PositionMapElement[,] playerPositionMapElement, GameObject playerField, GameObject playerForSeeWindow, int mapVerticalStartPosition) { int mapSingleHorizontalPosition; if (ApplicationUtils.IsInMultiPlayerMode()) { mapSingleHorizontalPosition = GameFieldUtils.PositionToMapValue(childrenTransform.First().position.x, playerId, playerField, playerForSeeWindow); } else { mapSingleHorizontalPosition = (int)Mathf.Round(childrenTransform.First().position.x - 0.5f); } for (int j = mapVerticalStartPosition; j >= 0; j--) { if (playerPositionMapElement[j, mapSingleHorizontalPosition].IsOccupied) { piecePositions.Add(playerPositionMapElement[j, mapSingleHorizontalPosition].CurrentMapElement.transform.position); break; } if (j == 0) { piecePositions.Add(new Vector3(GameFieldUtils.MapValueToPosition(mapSingleHorizontalPosition, playerId, playerField, playerForSeeWindow), 0.5f, -0.5f)); } } return(piecePositions); }
public static string Parse(IParseContext context) { var type = string.Empty; foreach (var name in context.StlAttributes.AllKeys) { var value = context.StlAttributes[name]; if (ApplicationUtils.EqualsIgnoreCase(name, AttributeType)) { type = Context.ParseApi.ParseAttributeValue(value, context); } } if (string.IsNullOrEmpty(context.StlInnerHtml)) { var elementId = $"iframe_{StringUtils.GetShortGuid(false)}"; var libUrl = Context.PluginApi.GetPluginUrl(ApplicationUtils.PluginId, "assets/lib/iframe-resizer-3.6.3/iframeResizer.min.js"); var pageUrl = Context.PluginApi.GetPluginUrl(ApplicationUtils.PluginId, $"templates/{type}/index.html?siteId={context.SiteId}&apiUrl={HttpUtility.UrlEncode(Context.Environment.ApiUrl)}"); return($@" <iframe id=""{elementId}"" frameborder=""0"" scrolling=""no"" src=""{pageUrl}"" style=""width: 1px;min-width: 100%;""></iframe> <script type=""text/javascript"" src=""{libUrl}""></script> <script type=""text/javascript"">iFrameResize({{log: false}}, '#{elementId}')</script> "); } return($@" <script> var $apiUrl = '{Context.Environment.ApiUrl}'; var $siteId = {context.SiteId}; </script> {context.StlInnerHtml} "); }
public IHttpActionResult Get() { try { var request = Context.GetCurrentRequest(); var siteId = request.GetQueryInt("siteId"); if (!request.IsAdminLoggin || !request.AdminPermissions.HasSitePermissions(siteId, ApplicationUtils.PluginId)) { return(Unauthorized()); } var settings = ApplicationUtils.GetSettings(siteId); var dataInfo = new DataInfo(); var departmentInfoList = DepartmentManager.GetDepartmentInfoList(siteId); return(Ok(new { Value = dataInfo, DepartmentInfoList = departmentInfoList, Settings = settings })); } catch (Exception ex) { return(InternalServerError(ex)); } }
private void MoveSeries() { ReasonDialog dlgReason = new ReasonDialog("Input Reason For Moving Series"); if (dlgReason.ShowDialog(this) == DialogResult.OK) { MoveSeries move = new MoveSeries(); DicomCommandStatusType status = DicomCommandStatusType.Success; ProgressDialog progress = new ProgressDialog(); move.PatientId = textBoxId.Text.Replace(@"\", @"\\").Replace("'", @"''"); move.PatientToMerge.Add(new MergePatientSequence(_Patient.Id)); move.SeriesInstanceUID = _Series.InstanceUID; move.Reason = dlgReason.Reason; move.Operator = Environment.UserName != string.Empty ? Environment.UserName : Environment.MachineName; move.Description = "Move Series"; Thread thread = new Thread(() => { try { status = _naction.SendNActionRequest <MoveSeries>(_scp, move, NActionScu.MoveSeries, NActionScu.PatientUpdateInstance); } catch (Exception e) { ApplicationUtils.ShowException(this, e); status = DicomCommandStatusType.Failure; } }); progress.ActionThread = thread; progress.Title = "Moving Series"; progress.ProgressInfo = "Performing series move to patient: " + textBoxFirstname.Text + " " + textBoxLastname.Text + "."; progress.ShowDialog(this); if (status == DicomCommandStatusType.Success) { _Action = ActionType.Merge; TaskDialogHelper.ShowMessageBox(this, "Move Series", "The series has been successfully move.", GetMergeInfo(), string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); DialogResult = DialogResult.OK; } else { string message = "The series was not move.\r\nError - " + _naction.GetErrorMessage(); if (status == DicomCommandStatusType.MissingAttribute) { message = "The series was not move.\r\nSeries not found on server."; } TaskDialogHelper.ShowMessageBox(this, "Move Series Error", "The series was not moved.", message, string.Empty, TaskDialogStandardButtons.Close, TaskDialogStandardIcon.Information, null); } } }
public AppList() { InitializeComponent(); var startMenuItems = ApplicationUtils.GetStartMenu().Children; startMenuItems.Sort((item1, item2) => string.Compare(item1.Name, item2.Name, StringComparison.CurrentCultureIgnoreCase)); StartMenu.ItemsSource = startMenuItems; }
public void LaunchOnePlayerMode() { string playerType = PlayerTypeConstants.PLAYER_HUMAN; ApplicationUtils.playerNumber = 1; ApplicationUtils.AffectPlayer((int)PlayerEnum.PlayerId.PLAYER_1, playerType); this.LaunchGame(SceneConstants.SCENE_NAME_ONE_PLAYER_MODE); }
public void SaveBlockImage(BlockBase block, Type type, string blockName, string assemblyClassName) { var imagePath = Path.Combine(_docPath, "images", "blocks", blockName + ".png"); var diagramBlock = ApplicationUtils.CreateDiagramBlock(block, false); var img = diagramBlock.GetImage(); img.Save(imagePath, ImageFormat.Png); }
public static void SetTemplateHtml(TemplateInfo templateInfo, string html) { var directoryPath = GetTemplatesDirectoryPath(); var htmlPath = ApplicationUtils.PathCombine(directoryPath, templateInfo.Name, templateInfo.Main); ApplicationUtils.WriteText(htmlPath, html); ClearCache(htmlPath); }
public void AddApplication(string name, string physicalPath, string applicationPoolName, Site site) { var path = ApplicationUtils.ConvertNameToPath(name); var application = site.Applications.Add(path, physicalPath); application.ApplicationPoolName = applicationPoolName; _serverManager.CommitChanges(); }