protected override void ExecuteCommand() { base.ExecuteCommand(); OpenFileDialog openDialog = FileIOUtil.OpenFile("video, hình ảnh hoặc file nén|*.mp3;*.mp4;*.png;*.jpg;*.rar;*.zip", "", "Chọn video, hình ảnh!"); openDialog.InitialDirectory = Logger.GetLogDirectory(); var result = openDialog.ShowDialog(); if (result == DialogResult.OK) { FileInfo fi = new FileInfo(openDialog.FileName); if (fi.Length > LIMITED_ATTACH_FILE_SIZE) { App.Current.ShowApplicationMessageBox("kích thước file không được vượt quá 20MB", HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.Default, HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Info); } else { BRPViewModel.IssueInfoOV.VideoPathText = openDialog.FileName; } } }
protected override void ExecuteCommand() { base.ExecuteCommand(); DataGrid ctrl = DataTransfer[0] as DataGrid; FileIOUtil.ShowBitmapFromName(SDPViewModel.LstDebt[ctrl.SelectedIndex].ImportID.ToString(), FileIOUtil.WAREHOUSE_IMPORT_IMAGE_FOLDER_NAME); }
protected override void OnInitializing() { ButtonCommandOV = new MSW_UMP_UIP_ButtomCommandOV(this); NewUser = new tblUser(); NewUser.Username = ""; UserNameAwareTextBlockVisibility = string.IsNullOrEmpty(NewUser.Username) ? Visibility.Visible : Visibility.Collapsed; UserNameAwareTextBlockContent = UserNameAwareMessage.Empty.GetStringValue(); UserNameVerifiedTextBlockVisibility = Visibility.Collapsed; UserNameVerifingTextBlockVisibility = Visibility.Collapsed; FullNameAwareTextBlockVisibility = string.IsNullOrEmpty(NewUser.FullName) ? Visibility.Visible : Visibility.Collapsed; PhoneAwareTextBlockVisibility = string.IsNullOrEmpty(NewUser.Phone) ? Visibility.Visible : Visibility.Collapsed; JobTitleAwareTextBlockVisibility = string.IsNullOrEmpty(NewUser.Job) ? Visibility.Visible : Visibility.Collapsed; UserImageSource = FileIOUtil. GetBitmapFromName(NewUser.Username, FileIOUtil.USER_IMAGE_FOLDER_NAME). ToImageSource(); NewPasswordChangedCommand = new EventCommandModel(OnNewPasswordChagedEvent); VerifiedPasswordChangedCommand = new EventCommandModel(OnVerifiedPasswordChagedEvent); }
protected override void ExecuteCommand() { OpenFileDialog openDialog = FileIOUtil.OpenFile("File ảnh|*.bmp;*.jpg;*.jpeg;*.png", "", "Chọn ảnh hóa đơn!"); var result = openDialog.ShowDialog(); try { switch (result) { case DialogResult.OK: var file = openDialog.FileName; AOPPViewModel.InvoiceImageURL = file; AOPPViewModel.Invalidate("InvoiceImageURL"); break; default: break; } } catch (Exception e) { App.Current.ShowApplicationMessageBox(e.Message, HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.Default, HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Error, OwnerWindow.MainScreen, "Lỗi!"); return; } return; }
protected override void ExecuteCommand() { base.ExecuteCommand(); DataGrid ctrl = DataTransfer[0] as DataGrid; FileIOUtil.ShowBitmapFromName(OPMPViewModel.OtherPaymentItemSource[ctrl.SelectedIndex].PaymentID.ToString(), FileIOUtil.OTHER_PAYMENT_IMAGE_FOLDER_NAME); }
public override void OnUpdate() { base.OnUpdate(); if (Input.GetKeyDown(KeyCode.F1)) { var playerInstance = Game.instance.GetBtd6Player(); //Console.WriteLine("saving player"); //playerInstance.OnXpRankChanged = null; //FileIOUtil.SaveObject("Model\\player.json", playerInstance); Console.WriteLine("saving player data"); FileIOUtil.SaveObject("Model\\playerdata.json", playerInstance.Data); Console.WriteLine("saving towers"); foreach (TowerModel towerModel in Game.instance.model.towers) { try { FileIOUtil.SaveObject("Model\\Towers\\" + towerModel.baseId + "\\" + towerModel.name + ".json", towerModel); } catch { Console.WriteLine("failed to save " + towerModel.name); } } var towers = Game.instance.model.towers; for (int i = 0; i < towers.Count; i++) { towers[i] = null; } Console.WriteLine("saving entire model"); FileIOUtil.SaveObject("Model\\entiremodel.json", Game.instance.model); } }
public static void Postfix() { GameModel gm = Game.instance.model; if (gm == null) { return; } // normal roundsets Il2CppReferenceArray <RoundSetModel> roundSets = Game.instance.model.roundSets; int i = 0; foreach (RoundSetModel roundset in roundSets) { //log(roundset); i++; } // FBGM - freeplay bloon group model // freeplay stuffs Il2CppReferenceArray <FreeplayBloonGroupModel> e = Game.instance.model.freeplayGroups; int ii = 0; string path = "FBGM/"; Directory.CreateDirectory(path); foreach (FreeplayBloonGroupModel fbgm in e) { var g = fbgm.name; FileIOUtil.SaveObject("FBGM2/" + g + ".json", fbgm); // I have no idea why when I remove this line emissions is empty, but when I remove everything else it just doesnt work File.Create(path + g + ".json").Close(); File.WriteAllText(path + g + ".json", JsonUtility.ToJsonInternal(fbgm, true)); ii++; } }
protected override void ExecuteCommand() { base.ExecuteCommand(); OpenFileDialog openDialog = FileIOUtil.OpenFile("File ảnh|*.bmp;*.jpg;*.jpeg;*.png", "", "Chọn ảnh đại diện của bạn!"); var result = openDialog.ShowDialog(); try { switch (result) { case DialogResult.OK: var file = openDialog.FileName; Bitmap userBit = (Bitmap)Image.FromFile(file); PIPViewModel.UserImageFileName = file; PIPViewModel.UserImageSource = userBit.ToImageSource(); userBit.Dispose(); break; default: break; } } catch (Exception e) { MessageBox.Show(e.Message); return; } return; }
protected override void ExecuteCommand() { base.ExecuteCommand(); OpenFileDialog openDialog = FileIOUtil.OpenFile("File ảnh|*.bmp;*.jpg;*.jpeg;*.png", "", "Chọn ảnh đại diện của bạn!"); var result = openDialog.ShowDialog(); try { switch (result) { case DialogResult.OK: var file = openDialog.FileName; Bitmap cusBit = (Bitmap)Image.FromFile(file); CIPViewModel.CustomerImageFileName = file; CIPViewModel.CustomerImageSource = cusBit.ToImageSource(); cusBit.Dispose(); break; default: break; } } catch (Exception e) { App.Current.ShowApplicationMessageBox(e.Message, HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.Default, HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Error, OwnerWindow.MainScreen, "Lỗi!"); } }
partial void OnExport(NSObject sender) { if (!ValidateExport()) { return; } UIErrorHelper.CheckedExec(delegate { StringBuilder sb = new StringBuilder(); var start = 0; var end = _resultList.Count; if (ScopeComboBox.SelectedIndex == (int)ExportScope.CURR_PAGE) { start = (_currPage - 1) * _pageSize; end = _currPage * _pageSize > _resultList.Count ? _resultList.Count : _currPage * _pageSize; } HashSet <string> attrToExport = new HashSet <string>(); if (AllReturnAttrCheckBox.State == NSCellStateValue.On) { foreach (var item in _returnedAttrList) { attrToExport.Add(item); } } else { foreach (var item in _attrToExportDs.attrList) { attrToExport.Add(item); } } foreach (var item in attrToExport) { sb.Append(item + ","); } sb.Append(Environment.NewLine); for (var i = start; i < end; i++) { foreach (var item in attrToExport) { sb.Append("\""); if (_resultList[i].NodeProperties.ContainsKey(item)) { foreach (var val in _resultList[i].NodeProperties[item].Values) { sb.Append(val.StringValue + " "); } } sb.Append("\""); sb.Append(","); } sb.Append(Environment.NewLine); } if (FileIOUtil.WriteAllTextToFile(sb.ToString(), "Export Result", new string[] { "csv" })) { UIErrorHelper.ShowInformation(VMDirConstants.STAT_RES_EXPO_SUCC); } }); }
private void InitializeLibraryHolder()///第1階層のボタンを作る { //foreach (var room in RoomInfo.m_Rooms) //{ // Debug.Log(room.RoomId); //} FileIOUtil.SafeCreateDirectory(SystemDefines.FDRECORD_PATH); var directories = RoomInfo.m_Rooms; int itemCount = 6; if (directories.Count <= itemCount) { itemCount = directories.Count; } for (int i = 0; i < itemCount; i++)///第一階層 { GameObject button = Instantiate(ButtonLibraryFolderPrefab); ButtonFolderLibraryPresenter blp = button.GetComponent <ButtonFolderLibraryPresenter>(); blp.SetRoomInfo(directories[i]); button.transform.parent = LibraryFolderHolder.transform; button.transform.localPosition = Vector3.zero; button.transform.localRotation = Quaternion.identity; } }
public override void OnUpdate() { base.OnUpdate(); if (Input.GetKeyDown(KeyCode.F1)) { var playerInstance = Game.instance.GetBtd6Player(); //Console.WriteLine("saving player"); //playerInstance.OnXpRankChanged = null; //FileIOUtil.SaveObject("Model\\player.json", playerInstance); Console.WriteLine("saving player data"); FileIOUtil.SaveObject("Model\\playerdata.json", playerInstance.Data); Console.WriteLine("saving towers"); foreach (TowerModel towerModel in Game.instance.model.towers) { //if (towerModel.name.Contains("Alchemist")) //{ // foreach (var at in towerModel.GetBehaviors<AttackModel>()) // { // try // { // //at.weapons[0].projectile.GetBehavior<AddAcidicMixtureToProjectileModel>().mutator = null; // at.weapons[0].projectile.RemoveBehavior<AddAcidicMixtureToProjectileModel>(); // Console.WriteLine("removed"); // } catch // { // } // } // try // { // towerModel.GetBehavior<LoadAlchemistBrewInfoModel>().addAcidicMixtureToProjectileModel = null; // } // catch // { // } // FileIOUtil.SaveObject("Model\\Towers\\" + towerModel.baseId + "\\" + towerModel.name + ".json", towerModel); //} try { FileIOUtil.SaveObject("Model\\Towers\\" + towerModel.baseId + "\\" + towerModel.name + ".json", towerModel); } catch { Console.WriteLine("failed to save " + towerModel.name); } } var towers = Game.instance.model.towers; for (int i = 0; i < towers.Count; i++) { towers[i] = null; } Console.WriteLine("saving entire model"); FileIOUtil.SaveObject("Model\\entiremodel.json", Game.instance.model); } }
private void UpdateMedicineData() { MedicineInfo = MSW_DataFlowHost.Current.CurrentModifiedMedicine; MedicineImageSource = FileIOUtil. GetBitmapFromName(MedicineInfo.MedicineID.ToString(), FileIOUtil.MEDICINE_IMAGE_FOLDER_NAME). ToImageSource(); GetPromoListByMedicine(); }
public StartPageDocument(MainWindow application) { InitializeComponent(); Application = application; Title = "Start Page"; DefaultDirectories.AddRange(FileIOUtil.CreateOmniDefaultDirectoryHandler().GetDirectories()); }
private void UpdateModifyData() { MedicineInfo = MSW_DataFlowHost.Current.CurrentModifiedMedicine; GetWarehouseImportDetail(); MedicineImageSource = FileIOUtil. GetBitmapFromName(MedicineInfo.MedicineID.ToString(), FileIOUtil.MEDICINE_IMAGE_FOLDER_NAME). ToImageSource(); }
public override void OnLoaded(object sender) { base.OnLoaded(sender); UserImageSource = FileIOUtil. GetBitmapFromName(CurrentUser.Username, FileIOUtil.USER_IMAGE_FOLDER_NAME). ToImageSource(); RefreshViewModel(); }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string imageName = value.ToString(); string folderName = parameter?.ToString(); return(FileIOUtil. GetImagePathFromName(imageName, folderName)); }
private static void OnVehicleInfoNotify(object sender, VehicleInfoReceiveEventArgs arg) { string path = ImageSavePath + arg.Device.Id.ToString() + DateTime.Now.ToString("yyyyMMdd") + "\\"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string nameid = string.Format("{0}{1}", string.IsNullOrEmpty(arg.VehiclePlateNo) ? "无牌" : arg.VehiclePlateNo, arg.ReachTime.ToString("HHmmss")); T_ReceiveData data = new T_ReceiveData(); data.EquipId = arg.Device.Id; #region 保存图片 if (arg.PanoramaPhoto != null && arg.PanoramaPhoto.Length > 0) { string PanoramaPhotoPath = path + nameid + "_All.jpg"; FileIOUtil.SaveFileByByteArray(PanoramaPhotoPath, arg.PanoramaPhoto); data.ImageAllPath = PanoramaPhotoPath; } if (arg.CloseShotPhoto != null && arg.CloseShotPhoto.Length > 0) { string CloseShotPhotoPath = path + nameid + "_Near.jpg"; FileIOUtil.SaveFileByByteArray(CloseShotPhotoPath, arg.CloseShotPhoto); data.ImageNearPath = CloseShotPhotoPath; } if (arg.VehiclePlatePhoto != null && arg.VehiclePlatePhoto.Length > 0) { string VehiclePlatePhotoPath = path + nameid + "_VehiclePlate.jpg"; FileIOUtil.SaveFileByByteArray(VehiclePlatePhotoPath, arg.VehiclePlatePhoto); data.ImagePlateNoPath = VehiclePlatePhotoPath; } if (arg.VehiclePlateBinPhoto != null && arg.VehiclePlateBinPhoto.Length > 0) { string BinVehiclePlatePhotoPath = path + nameid + "_Bin.jpg"; FileIOUtil.SaveFileByByteArray(BinVehiclePlatePhotoPath, arg.VehiclePlateBinPhoto); data.ImageBinPlateNoPath = BinVehiclePlatePhotoPath; } #endregion 保存图片 data.ReachTime = arg.ReachTime; data.VehicleLength = arg.VehicleLength; data.VehicleSpeed = arg.VehicleSpeed; data.VehPlateColor = string.IsNullOrEmpty(arg.VehiclePlateColor) ? "未知" : arg.VehiclePlateColor; data.VehPlateNo = arg.VehiclePlateNo; DAL_ReceiveData.SaveReceiveData(data); arg.DbData = data; if (VehicleInfoReceiveNotifyHandler != null) { VehicleInfoReceiveNotifyHandler.Invoke(sender, arg); } }
public static void SaveConfig() { IniConfUtil.Set("toolkit", "Name", Name); IniConfUtil.Set("toolkit", "Services", String.Join(";", Services)); IniConfUtil.Set("toolkit", "Logdir", Logdir); IniConfUtil.Set("toolkit", "Auto", Auto ? "1" : ""); FileIOUtil.CreateFile(BatFilePath, Bat); }
/// <summary> /// Turns a JSON node into a 1-dimensional string. /// </summary> /// <returns>The 1D string.</returns> /// <param name="retrieveInfo">Name of the JSON node to read.</param> /// <param name="filePath">File path.</param> /// <param name="fileName">File name.</param> public static string GetFromFile(string retrieveInfo, string filePath, string fileName) { JSONNode jsonLevel = FileIOUtil.ReadJsonFromFile(Application.dataPath + filePath + fileName); string readString = jsonLevel[retrieveInfo].ToString(); readString = readString.Substring(1); //discard initial quotation mark that is part of JSON formatting readString = readString.TrimEnd('"'); return(readString); }
partial void OnBrowse(NSObject sender) { try { SecretKeyTextField.StringValue = FileIOUtil.ReadAllTextFromFile("Select Secret Key", new string[] { "key", "pem" }); } catch (Exception exp) { UIErrorHelper.ShowError(exp.Message); } }
public static void LoadConfig() { IniConfUtil.Init(OS.exePath + "conf.ini"); Name = IniConfUtil.Get("toolkit", "Name"); Services = IniConfUtil.Get("toolkit", "Services").Split(';'); Logdir = IniConfUtil.Get("toolkit", "Logdir"); Auto = IniConfUtil.Get("toolkit", "Auto") != ""; if (BatFileExists) { Bat = FileIOUtil.ReadFile(BatFilePath); } }
protected override void ExecuteCommand() { base.ExecuteCommand(); OpenFileDialog openDialog = FileIOUtil.OpenFile("File txt|*.txt", "", "Chọn log file!"); openDialog.InitialDirectory = Logger.GetLogDirectory(); var result = openDialog.ShowDialog(); if (result == DialogResult.OK) { BRPViewModel.IssueInfoOV.LogPathText = openDialog.FileName; } }
public override void OnLoaded(object sender) { base.OnLoaded(sender); CurrentModifiedCustomer = MSW_DataFlowHost.Current.CurrentModifiedCustomer; CustomerImageSource = FileIOUtil. GetBitmapFromName(CurrentModifiedCustomer.CustomerID.ToString(), FileIOUtil.CUSTOMER_IMAGE_FOLDER_NAME). ToImageSource(); CustomerNameAwareTextBlockVisibility = String.IsNullOrEmpty(CurrentModifiedCustomer.CustomerName) ? Visibility.Visible : Visibility.Collapsed; PhoneAwareTextBlockVisibility = String.IsNullOrEmpty(CurrentModifiedCustomer.Phone) ? Visibility.Visible : Visibility.Collapsed; }
protected override void ExecuteCommand() { if (SIHPViewModel.ImportInfo == null) { App.Current.ShowApplicationMessageBox("Vui lòng chọn 1 giao dịch để xem hóa đơn!", HPSolutionCCDevPackage.netFramework.AnubisMessageBoxType.Default, HPSolutionCCDevPackage.netFramework.AnubisMessageImage.Info, OwnerWindow.MainScreen, "Thông báo!"); return; } FileIOUtil.ShowBitmapFromName(SIHPViewModel.ImportInfo.ImportID.ToString(), FileIOUtil.WAREHOUSE_IMPORT_IMAGE_FOLDER_NAME); return; }
partial void OnBrowse(NSObject sender) { UIErrorHelper.CheckedExec(delegate { var values = FileIOUtil.ReadAllTextFromFile("Load Values From File", new string[] { "txt", "csv" }); ValuesTextField.StringValue = values; var charArr = new char[] { '\r', '\n' }; foreach (var item in ValuesTextField.StringValue.Split('\n')) { var val = item.Trim(charArr); if (!string.IsNullOrWhiteSpace(val)) { ValuesList.Add(val); } } }); }
private void UpdateModifyData() { _modifiedMedicine = MSW_DataFlowHost.Current.CurrentModifiedMedicine; MedicineID = _modifiedMedicine.MedicineID; MedicineName = _modifiedMedicine.MedicineName; MedicineTypeID = LstMedicineType.IndexOf(_modifiedMedicine.tblMedicineType); MedicineUnitID = LstMedicineUnit.IndexOf(_modifiedMedicine.tblMedicineUnit); SupplierID = LstSupplier.IndexOf(_modifiedMedicine.tblSupplier); BidPrice = _modifiedMedicine.BidPrice; AskingPrice = _modifiedMedicine.AskingPrice; MedicineDescription = _modifiedMedicine.MedicineDescription; GetWarehouseImportDetail(); MedicineImageSource = FileIOUtil. GetBitmapFromName(_modifiedMedicine.MedicineID.ToString(), FileIOUtil.MEDICINE_IMAGE_FOLDER_NAME). ToImageSource(); }
void GenerateCode() { config = ConfigAssets.LoadCodeGeneratorConfig(); string templateDir = Application.dataPath + "/itfantasy/Editor/umvc/CodeGenerator/CodeTemplate"; List <FileInfo> fileInfos = FileIOUtil.GetFileInfos(templateDir); foreach (FileInfo fileInfo in fileInfos) { string fileName = fileInfo.Name; if (fileName.Contains(".meta")) { continue; } if (onlyView) { if (fileName != "TemplateView.cs.txt") { continue; } } fileName = fileName.Replace(".txt", ""); string saveName = fileName.Replace("Template", name); string content = FileIOUtil.ReadFile(fileInfo.FullName); string saveContent = content.Replace("##NAME##", name); saveContent = saveContent.Replace("##HASVIEW##", hasView ? "" : "//"); if (hasView && fileName == "TemplateView.cs") { GenerateViewCode(ref saveContent); } string savePath = "/" + config.codeSavePath + "/" + name + "Window/" + saveName; if (!onlyView) { if (FileIOUtil.FileExists(Application.dataPath + savePath)) { Debug.LogError("The target files have existed! However, if you want to recreate them, delete please!"); return; } } FileIOUtil.CreateFile(Application.dataPath + savePath, saveContent); Debug.Log("[GenerateCode]:: " + savePath); } AssetDatabase.Refresh(); }
private void OnShowLog() { List <FileInfo> logInfos = FileIOUtil.GetFileInfos(Conf.Logdir); string logs = ""; foreach (FileInfo info in logInfos) { logs += " " + info.FullName; } if (logs != "") { new System.Threading.Thread(() => { OS.Execute(String.Format("start {0}bin_tools\\baretail\\baretail.exe{1}", OS.exePath, logs)); }).Start(); } }
// bloons info logging public override void OnUpdate() { base.OnUpdate(); bool inAGame = InGame.instance != null && InGame.instance.bridge != null; if (Input.GetKeyDown(KeyCode.Alpha8)) { var bloons = InGame.instance.bridge.GetAllBloons(); foreach (BloonToSimulation bts in bloons) { var e = bts.Def; FileIOUtil.SaveObject("e.txt", e); string btss = JsonUtility.ToJson(e, true); log(btss); } log(bloons._size.ToString()); } }