protected override void DataSave(object arg, SaveCallback callback) { try { DataMap data = new DataMap() { { "USER_ID", txtUserId.EditValue }, { "USER_NAME", txtUserName.EditValue }, { "USER_TYPE", lupUserType.EditValue }, { "LOGIN_ID", txtLoginId.EditValue }, { "USE_YN", chkUseYn.EditValue }, { "REMARKS", memeRemarks.EditValue }, { "ROWSTATE", (this.EditMode == EditModeEnum.New)?"INSERT":"UPDATE" } }; var res = DBTranHelper.Execute("Base", "Save", "User", data, "USER_ID"); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } ShowMsgBox("저장하였습니다."); callback(arg, res.TranList[0].ReturnValue); } catch (Exception ex) { ShowErrBox(ex); } }
public void StartRecording(Configuration configuration, SaveCallback saveCallback, IAudioSource audioSource) { #if FFMPEG_API this.configuration = configuration; this.saveCallback = saveCallback; this.readbackBuffer = Acquire(); this.framebuffer = new Texture2D(configuration.width, configuration.height, TextureFormat.RGB24, false); // Create process filename = "recording_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_fff"); videoWriter = CreateProcess(string.Format( @"-y -f rawvideo -vcodec rawvideo -pixel_format rgb24 -video_size {0}x{1} -framerate {2} -loglevel warning -i - -vcodec libx264 -pix_fmt yuv420p -preset ultrafast {3}", configuration.width, configuration.height, configuration.framerate, filename + ".mp4" )); videoWriter.Start(); videoInput = new BinaryWriter(videoWriter.StandardInput.BaseStream); videoWriter.BeginOutputReadLine(); videoWriter.BeginErrorReadLine(); // We don't support audio if (audioSource != null) { audioSource.Dispose(); } // Start recording IsRecording = true; #endif }
private void DoSaveReply(NLRep_Save msg, PBChannel channel, int src, uint session) { string timeoutKey = string.Format("{0}:{1}", msg.DsMsgId, msg.Key); SaveCallback cb = saveOpt_timeout_.Get(timeoutKey); if (null != cb) { DSSaveResult saveRet = DSSaveResult.UnknownError; string errorStr = "Save Unknown Error"; if (msg.Result == NLRep_Save.Types.SaveResult.Success) { saveRet = DSSaveResult.Success; errorStr = "Save Success"; } else if (msg.Result == NLRep_Save.Types.SaveResult.Error) { saveRet = DSSaveResult.PostError; if (msg.HasError) { errorStr = msg.Error.ToString(); } else { errorStr = "Save Post Error"; } } cb(saveRet, errorStr); saveOpt_timeout_.Remove(timeoutKey); } }
public void SavePhoto(byte[] jpg, SaveMode mode, SaveCallback callback) { Func <int> AddCallback = () => { if (callback == null) { return(-1); } int callbackID = saveCallbacks.Count; saveCallbacks.Add(callbackID, callback); return(callbackID); }; if (((int)mode & (int)SaveMode.SaveToAppDocuments) == (int)SaveMode.SaveToAppDocuments) { UtilExt.SavePhoto(jpg, SaveMode.SaveToAppDocuments, callback); } if (((int)mode & (int)SaveMode.SaveToPhotoGallery) == (int)SaveMode.SaveToPhotoGallery) { SavePhoto(jpg, SaveMode.SaveToPhotoGallery, AddCallback()); } if (((int)mode & (int)SaveMode.SaveToPhotoAlbum) == (int)SaveMode.SaveToPhotoAlbum) { SavePhoto(jpg, SaveMode.SaveToPhotoAlbum, AddCallback()); } }
public override void OnSaveRequest(SaveRequest request, SaveCallback callback) { var context = request.FillContexts; var structure = context[context.Count - 1].Structure; var packageName = structure.ActivityComponent.PackageName; if (!SharedPrefsPackageVerificationRepository.GetInstance() .PutPackageSignatures(ApplicationContext, packageName)) { callback.OnFailure( ApplicationContext.GetString(Resource.String.invalid_package_signature)); return; } var data = request.ClientState; if (CommonUtil.VERBOSE) { Log.Verbose(CommonUtil.TAG, "onSaveRequest(): data=" + CommonUtil.BundleToString(data)); CommonUtil.DumpStructure(structure); } var parser = new StructureParser(ApplicationContext, structure); parser.ParseForSave(); var filledAutofillFieldCollection = parser.GetClientFormData(); SharedPrefsAutofillRepository.GetInstance() .SaveFilledAutofillFieldCollection(this, filledAutofillFieldCollection); }
protected override void DataSave(object arg, SaveCallback callback) { try { DataMap data = new DataMap() { { "DICTIONARY_ID", txtDictionaryId.EditValue }, { "LOGICAL_NAME", txtLogicalName.EditValue }, { "PHYSICAL_NAME", txtPhysicalName.EditValue }, { "DESCRIPTION", memDescription.EditValue }, { "ROWSTATE", (this.EditMode == EditModeEnum.New) ? "INSERT" : "UPDATE" } }; var res = DBTranHelper.Execute("Base", "Save", "Dictionary", data, "DICTIONARY_ID"); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } ShowMsgBox("저장하였습니다."); callback(arg, res.TranList[0].ReturnValue); } catch (Exception ex) { ShowErrBox(ex); } }
public RegistrationHandle(StateService owner, SaveCallback saveCallback) { Debug.Assert(owner != null); Debug.Assert(saveCallback != null); this.owner = owner; this.saveCallback = saveCallback; }
public void StartRecording(Configuration configuration, SaveCallback saveCallback, IAudioSource audioSource) { // We don't need the audio source if (audioSource != null) { audioSource.Dispose(); } }
private void UnregisterSaveCallback(SaveCallback saveCallback) { Debug.Assert(saveCallback != null); lock (this.sync) { this.saveCallbacks = this.saveCallbacks.Remove(saveCallback); } }
/// <summary> /// Add a section to the save files with the specified callbacks for /// retrieving values to be saved and notifying the mod of loaded values. /// </summary> /// <param name="title">Title of the section</param> /// <param name="saveCb">Callback for saving</param> /// <param name="loadCb">Callback for loading</param> public static void Add(string title, SaveCallback saveCb, LoadCallback loadCb) { metadata.Add(title, new Metadata() { saveCb = saveCb, loadCb = loadCb, }); }
public IDisposable RegisterSaveCallback(SaveCallback saveCallback) { Ensure.ArgumentNotNull(saveCallback, nameof(saveCallback)); lock (this.sync) { this.saveCallbacks = this.saveCallbacks.Add(saveCallback); } return(new RegistrationHandle(this, saveCallback)); }
public IDisposable RegisterSaveCallback(SaveCallback saveCallback) { saveCallback.AssertNotNull(nameof(saveCallback)); lock (this.sync) { this.saveCallbacks = this.saveCallbacks.Add(saveCallback); } return(new RegistrationHandle(this, saveCallback)); }
void Awake() { checkpointDirectory = Application.dataPath; tempDirectory = Application.temporaryCachePath; preSaveCallback = delegate { }; postLoadCallback = delegate { }; Debug.Log("Checkpoint Directory: " + checkpointDirectory); Debug.Log("Temp Directory: " + tempDirectory); }
public override void OnSaveRequest(SaveRequest request, SaveCallback callback) { var structure = request.FillContexts?.LastOrDefault()?.Structure; if (structure == null) { return; } var parser = new Parser(structure); parser.Parse(); var savedItem = parser.FieldCollection.GetSavedItem(); if (savedItem == null) { Toast.MakeText(this, "Unable to save this form.", ToastLength.Short).Show(); return; } var intent = new Intent(this, typeof(MainActivity)); intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop); intent.PutExtra("autofillFramework", true); intent.PutExtra("autofillFrameworkSave", true); intent.PutExtra("autofillFrameworkType", (int)savedItem.Type); switch (savedItem.Type) { case CipherType.Login: intent.PutExtra("autofillFrameworkName", parser.Uri .Replace(Constants.AndroidAppProtocol, string.Empty) .Replace("https://", string.Empty) .Replace("http://", string.Empty)); intent.PutExtra("autofillFrameworkUri", parser.Uri); intent.PutExtra("autofillFrameworkUsername", savedItem.Login.Username); intent.PutExtra("autofillFrameworkPassword", savedItem.Login.Password); break; case CipherType.Card: intent.PutExtra("autofillFrameworkCardName", savedItem.Card.Name); intent.PutExtra("autofillFrameworkCardNumber", savedItem.Card.Number); intent.PutExtra("autofillFrameworkCardExpMonth", savedItem.Card.ExpMonth); intent.PutExtra("autofillFrameworkCardExpYear", savedItem.Card.ExpYear); intent.PutExtra("autofillFrameworkCardCode", savedItem.Card.Code); break; default: Toast.MakeText(this, "Unable to save this type of form.", ToastLength.Short).Show(); return; } StartActivity(intent); }
protected static void OnSave(int mode, string path, int callback) { instance.dispatch.Dispatch(() => { if (!instance.saveCallbacks.ContainsKey(callback)) { return; } SaveCallback saveCallback = instance.saveCallbacks[callback]; instance.saveCallbacks.Remove(callback); saveCallback((SaveMode)mode, path); }); }
protected override void DataSave(object arg, SaveCallback callback) { if (DataValidate() == false) { return; } if (DataValidate(gridItem) == false) { return; } try { DataMap mst = lc.GroupToDataMap(lcGroupEdit1, lcGroupEdit2); mst.SetValue("ROWSTATE", (this.EditMode == EditModeEnum.New) ? "INSERT" : "UPDATE"); DataTable item = GetPurcItemData(); if (item == null || item.Rows.Count == 0) { throw new Exception("구매품목을 입력해야 합니다."); } var res = DBTranHelper.Execute(new DBTranSet() { ServiceId = "Purchase", ProcessId = "Save", TranList = new DBTranData[] { new DBTranData() { Data = mst }, new DBTranData() { Data = item } } }); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } ShowMsgBox("저장하였습니다."); callback(arg, res.TranList[0].ReturnValue); } catch (Exception ex) { ShowErrBox(ex); } }
/// <summary> /// Start recording a video with no audio /// </summary> /// <param name="configuration">Configuration for recording</param> /// <param name="saveCallback">Callback to be invoked when the video is saved</param> public static void StartRecording(Configuration configuration, SaveCallback saveCallback) { if (IsRecording) { Util.LogError("Cannot start recording because NatCorder is already recording"); return; } if (saveCallback == null) { Util.LogError("Cannot record video without callback"); return; } Implementation.StartRecording(configuration, saveCallback, null); }
public override void OnSaveRequest(SaveRequest request, SaveCallback callback) { var context = request.FillContexts; var structure = context[context.Count - 1].Structure; var data = request.ClientState; Log.Debug(CommonUtil.Tag, "onSaveRequest(): data=" + CommonUtil.BundleToString(data)); var parser = new StructureParser(structure); parser.ParseForSave(); var filledAutofillFieldCollection = parser.ClientFormData; SharedPrefsAutofillRepository.GetInstance(this).SaveFilledAutofillFieldCollection(filledAutofillFieldCollection); }
public void SavePhoto(byte[] png, SaveMode mode, SaveCallback callback) { if (((int)mode & (int)SaveMode.SaveToAppDocuments) == (int)SaveMode.SaveToAppDocuments) { UtilExt.SavePhoto(png, SaveMode.SaveToAppDocuments, callback); } if (((int)mode & (int)SaveMode.SaveToPhotoGallery) == (int)SaveMode.SaveToPhotoGallery) { Util.LogError("Legacy only supports saving to app documents"); } if (((int)mode & (int)SaveMode.SaveToPhotoAlbum) == (int)SaveMode.SaveToPhotoAlbum) { Util.LogError("Legacy only supports saving to app documents"); } }
public static void SavePhoto(byte[] png, SaveMode mode, SaveCallback callback) { if (png == null) { return; } string fileName = string.Format("photo_{0}.png", DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss_fff")), path = Path.Combine(Application.persistentDataPath, fileName); File.WriteAllBytes(path, png); if (callback != null) { callback((SaveMode)mode, path); } }
protected override void DataSave(object arg, SaveCallback callback) { try { DataMap data = new DataMap() { { "ID", txtTableId.EditValue }, { "DB_NAME", lupDbName.EditValue }, { "SCHEMA_NAME", txtSchemaName.EditValue }, { "TABLE_NAME", txtTableName.EditValue }, { "DESCRIPTION", txtDescription.EditValue }, { "REMARKS", memRemarks.EditValue }, { "ROWSTATE", (txtTableId.EditValue.IsNullOrEmpty()) ? "INSERT" : "UPDATE" } }; DataTable dtColumns = GetColumnData(); var res = DBTranHelper.Execute(new DBTranSet() { ServiceId = "Database", ProcessId = "Save", IsTransaction = true, TranList = new DBTranData[] { new DBTranData() { SqlId = "Tables", Data = data, IsMaster = true, KeyField = "ID" }, new DBTranData() { SqlId = "Columns", Data = dtColumns } } }); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } ShowMsgBox("저장하였습니다."); DataLoad(); } catch (Exception ex) { ShowErrBox(ex); } }
protected override void DataSave(object arg, SaveCallback callback) { try { DataTable dt = lc.GroupToDataTable(lcGroupEdit, lcGroupBizEdit) .SetValue("BIZ_REG_ID", mBizRegId) .SetValue("ADDRESS_ID", mAddressId) .SetValue("ROWSTATE", (this.EditMode == EditModeEnum.New) ? "INSERT" : "UPDATE"); var res = DBTranHelper.Execute(new DBTranSet() { ServiceId = "Customer", ProcessId = "Save", TranList = new DBTranData[] { new DBTranData() { Data = dt }, new DBTranData() { Data = GetPhoneData() }, new DBTranData() { Data = GetAddressData() } } }); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } txtCustomerId.EditValue = res.TranList[0].ReturnValue; DataSavePhones(); DataSaveAddress(); ShowMsgBox("저장하였습니다."); callback(arg, res.TranList[0].ReturnValue); } catch (Exception ex) { ShowErrBox(ex); } }
public void Save(string key, IMessage data, SaveCallback cb, bool isForce) { Constraints.MaxSize(data); string error = null; LNReq_Save saveData = null; uint dsMsgId = MessageMapping.Query(data.GetType()); if (dsMsgId == uint.MaxValue) { error = string.Format("unknown data message: " + data.GetType().Name); } string timeoutKey = string.Format("{0}:{1}", dsMsgId, key); if (!isForce && saveOpt_timeout_.Exists(timeoutKey)) { error = "Save operation are too frequent"; cb(DSSaveResult.PrepError, error); return; } try { byte[] bytes = data.ToByteArray(); LNReq_Save.Builder saveBuilder = LNReq_Save.CreateBuilder(); saveBuilder.SetDsMsgId(dsMsgId); saveBuilder.SetKey(key); saveBuilder.SetDsBytes(ByteString.Unsafe.FromBytes(bytes)); saveBuilder.SetChecksum(Crc32.Compute(bytes)); saveData = saveBuilder.Build(); } catch (Exception e) { error = e.Message; } if (null != error) { cb(DSSaveResult.PrepError, error); return; } if (!channel_.Send(saveData)) { cb(DSSaveResult.PrepError, "unknown"); } else { //添加到超时验证 string timeoutTip = string.Format("DataStore save request timeout. MsgId:{0}, Key:{1}", dsMsgId, key); saveOpt_timeout_.Set(timeoutKey, cb, () => cb(DSSaveResult.TimeoutError, timeoutTip)); } }
private void SaveGame() { ConsoleUtil.WriteBlanks(); Console.SetCursorPosition(0, Console.WindowHeight / 2); string defaultName = "game_" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"); Console.Write($"Enter file name (use .json to save to json) [{defaultName}]: "); string name = Console.ReadLine() ?? ""; if (string.IsNullOrEmpty(name)) { name = defaultName; } // if (!name.EndsWith(".json")) name += ".json"; SaveCallback?.Invoke(name); Menu.RevertSelection(1); }
public override void OnSaveRequest(SaveRequest request, SaveCallback callback) { var structure = request.FillContexts?.LastOrDefault()?.Structure; if (structure == null) { return; } var clientState = request.ClientState; var parser = new StructureParser(structure); parser.ParseForSave(); var filledAutofillFieldCollection = parser.GetClientFormData(); //SaveFilledAutofillFieldCollection(filledAutofillFieldCollection); }
/// <summary> /// Start recording a video with audio /// </summary> /// <param name="configuration">Configuration for recording</param> /// <param name="saveCallback">Callback to be invoked when the video is saved</param> /// <param name="audioSource">Audio source for recording audio</param> public static void StartRecording(Configuration configuration, SaveCallback saveCallback, AudioSource audioSource) { if (IsRecording) { Util.LogError("Cannot start recording because NatCorder is already recording"); return; } if (saveCallback == null) { Util.LogError("Cannot record video without callback"); return; } if (audioSource == null) { Util.LogError("Cannot record video with null audio source"); return; } Implementation.StartRecording(configuration, saveCallback, audioSource.gameObject.AddComponent <NatCorderAudio>()); }
public static void StartRecording(SaveCallback callback = null) { if (!Implementation.SupportsRecording) { Util.LogError("Cannot record video because implementation does not support recording"); return; } if (!IsPlaying) { Util.LogError("Cannot record video when session is not running"); return; } if (IsRecording) { Util.LogError("Cannot record video because video is already being recorded"); return; } Implementation.StartRecording(callback); }
public static void StartRecording(Configuration configuration, SaveCallback callback) { if (!Implementation.SupportsRecording) { Util.LogError("Cannot record video because implementation does not support recording"); return; } if (!IsPlaying) { Util.LogError("Cannot record video when session is not running"); return; } if (callback == null) { Util.LogError("Cannot record video without callback"); return; } Implementation.StartRecording(configuration, callback); }
protected override void DataSave(object arg, SaveCallback callback) { if (DataValidate() == false) { return; } try { DataMap data = new DataMap() { { "CODE_ID", txtCodeId.EditValue }, { "PARENT_CODE", lupParentCode.EditValue }, { "CODE", txtCode.EditValue }, { "NAME", txtName.EditValue }, { "VALUE", txtValue.EditValue }, { "SORT_SEQ", spnSortSeq.EditValue }, { "MAX_LENGTH", spnMaxLength.EditValue }, { "USE_YN", chkUseYn.EditValue }, { "DESCRIPTION", memDescription.EditValue }, { "OPTION_VALUE1", txtOptionValue1.EditValue }, { "OPTION_VALUE2", txtOptionValue2.EditValue }, { "OPTION_VALUE3", txtOptionValue3.EditValue }, { "OPTION_VALUE4", txtOptionValue4.EditValue }, { "OPTION_VALUE5", txtOptionValue5.EditValue }, { "ROWSTATE", (this.EditMode == EditModeEnum.New) ? "INSERT" : "UPDATE" } }; var res = DBTranHelper.Execute("Base", "Save", "Code", data, "CODE_ID"); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } ShowMsgBox("저장하였습니다."); callback(arg, res.TranList[0].ReturnValue); } catch (Exception ex) { ShowErrBox(ex); } }
protected override void DataSave(object arg, SaveCallback callback) { try { DataMap data = new DataMap() { { "CAL_DATE", datCalDate.GetDateChar8() }, { "HOLIDAY_YN", chkHolidayYn.EditValue }, { "HOLIDAY_NAME", txtHolidayName.EditValue }, { "REMARKS", memRemarks.EditValue }, { "ROWSTATE", "UPDATE" } }; var res = DBTranHelper.Execute(new DBTranSet() { ServiceId = "Base", ProcessId = "Save", IsTransaction = true, TranList = new DBTranData[] { new DBTranData() { SqlId = "Calendar", KeyField = "CAL_DATE", Data = data } } }); if (res.ErrorNumber != 0) { throw new Exception(res.ErrorMessage); } ShowMsgBox("저장하였습니다."); callback(arg, res.TranList[0].ReturnValue); } catch (Exception ex) { ShowErrBox(ex); } }