public void BuildMenuItems(SqlConnection conn, MergeType buildType) { _conn = null; _objectInfo = null; Cleanup(); if (_menuStrip == null) { return; } if (conn == null || conn.State != System.Data.ConnectionState.Open) { return; } _conn = conn; try { FetchObjectInfoFromDatabase(); } catch (Exception ex) { Utils.ShowError("Can not get object information from database.\r\nError: " + ex.Message, MessageBoxButtons.OK); } if (_objectInfo == null) { return; } CreateMenuItems(); }
public void Add(object objectToUndoTo, string typeOfObject, MergeType mergeType) { ICloneable cloneableObject = (ICloneable)objectToUndoTo; if (cloneableObject != null) { if (m_CurrentUndoIndex <= 0 || mergeType == MergeType.NotMergable || m_UndoBuffer[m_CurrentUndoIndex].m_TypeOfObject != typeOfObject) { m_CurrentUndoIndex++; } UndoCheckPoint newUndoCheckPoint = new UndoCheckPoint((ICloneable)cloneableObject.Clone(), typeOfObject, mergeType); if (m_CurrentUndoIndex < m_UndoBuffer.Count) { m_UndoBuffer[m_CurrentUndoIndex] = newUndoCheckPoint; } else { m_UndoBuffer.Add(newUndoCheckPoint); } m_LastValidUndoIndex = m_CurrentUndoIndex; } }
/// <summary> /// Merge CAML conditions in code /// </summary> /// <param name="conditions">A list of contitions to merge into alternative or conjunction</param> /// <param name="type"><value>MergeType.Or</value> for alternative, MergeType.And for conjunction</param> //<returns></returns> private static string MergeCAMLConditions(List <string> conditions, MergeType type) { // No conditions => empty response if (conditions.Count == 0) { return(""); } // Initialize temporary variables string typeStart = (type == MergeType.And ? "<And>" : "<Or>"); string typeEnd = (type == MergeType.And ? "</And>" : "</Or>"); // Build hierarchical structure while (conditions.Count >= 2) { List <string> complexConditions = new List <string>(); for (int i = 0; i < conditions.Count; i += 2) { if (conditions.Count == i + 1) // Only one condition left { complexConditions.Add(conditions[i]); } else // Two condotions - merge { complexConditions.Add(typeStart + conditions[i] + conditions[i + 1] + typeEnd); } } conditions = complexConditions; } return(conditions[0]); }
public string MergeCAMLConditions(List <string> conditions, MergeType type) { if (conditions.Count == 0) { return(""); } string typeStart = (type == MergeType.And ? "<And>" : "<Or>"); string typeEnd = (type == MergeType.And ? "</And>" : "</Or>"); // Build hierarchical structure while (conditions.Count >= 2) { List <string> complexConditions = new List <string>(); for (int i = 0; i < conditions.Count; i += 2) { if (conditions.Count == i + 1) // Only one condition left { complexConditions.Add(conditions[i]); } else // Two conditions - merge { complexConditions.Add(typeStart + conditions[i] + conditions[i + 1] + typeEnd); } } conditions = complexConditions; } return(conditions[0]); }
//restore from specified xml private void restoreButton_Click(object sender, EventArgs e) { Conf_RestoreDlg dlg; if (mergeRadioButton.Checked) //if we're merging { //get merge settings MergeType emuMergeType = ((BackupDropdownItem)emuMergeComboBox.SelectedItem).ValueMember; MergeType profileMergeType = ((BackupDropdownItem)profileMergeComboBox.SelectedItem).ValueMember; MergeType gameMergeType = ((BackupDropdownItem)gameMergeComboBox.SelectedItem).ValueMember; //create restore dialog with merge settings dlg = new Conf_RestoreDlg(restorePathTextBox.Text, emuMergeType, profileMergeType, gameMergeType); } else //else clean restore { //warn user of db deletion DialogResult shouldClean = MessageBox.Show("All existing data in the database will be deleted.\r\nAre you sure you want to continue?", "Clean restore", MessageBoxButtons.YesNo); if (shouldClean != DialogResult.Yes) { return; } //create restore dialog dlg = new Conf_RestoreDlg(restorePathTextBox.Text, RestoreType.Restore); } dlg.RestoreThumbs = restoreThumbsCheckBox.Checked; //display dialog (starts restore) if (dlg.ShowDialog() == DialogResult.OK) { MessageBox.Show("Restore completed successfully."); } dlg.Dispose(); }
public void Add(IUndoData objectToUndoTo, string typeOfObject, MergeType mergeType) { IUndoData cloneableObject = objectToUndoTo; if (cloneableObject != null) { if (currentUndoIndex <= 0 || mergeType == MergeType.NotMergable || undoBuffer[currentUndoIndex].typeOfObject != typeOfObject) { currentUndoIndex++; } UndoCheckPoint newUndoCheckPoint = new UndoCheckPoint(cloneableObject.Clone(), typeOfObject, mergeType); if (currentUndoIndex < undoBuffer.Count) { undoBuffer[currentUndoIndex] = newUndoCheckPoint; } else { undoBuffer.Add(newUndoCheckPoint); } lastValidUndoIndex = currentUndoIndex; } }
private static List <string> ProcessParams(IEnumerable <string> args) { List <string> result = new List <string>(); foreach (string arg in args) { if (arg.StartsWith(MERGE_PARAM_START)) { string type = arg.Substring(MERGE_PARAM_START.Length).Trim(); try { MergeType = (MergeType)Enum.Parse(typeof(MergeType), type, true); } catch (Exception) { Logger.Error("Failed to parse merge type. Using default."); } } else if (arg.StartsWith(THREAD_PARAM_START)) { string threadNum = arg.Substring(THREAD_PARAM_START.Length).Trim(); if (!int.TryParse(threadNum, out MaxThreads) || MaxThreads <= 0) { MaxThreads = 4; } } else { result.Add(arg); } } return(result); }
/// <summary> /// 创建一个单元格位置对象 /// </summary> /// <param name="startCellocation">开始单元格</param> /// <param name="endCellocation">结束单元格</param> /// <param name="mergeType">分组内容依据</param> /// <param name="custom">自定义分组内容</param> public MergeCell(Cellocation startCellocation, Cellocation endCellocation, MergeType mergeType, string custom) { this.StartCellocation = startCellocation; this.EndCellocation = endCellocation; this.IMergeType = mergeType; this.Custom = custom; }
//public methods public virtual int Execute(MergeType mergeType) { _mergeType = mergeType; if (_entityList.Count == 0) { return(0); } List <TEntity>[] entityBatches = GetEntityBatches(_entityList); if (_transaction != null || UseInnerTransactionForBatches == false) { return(ReadOutput(entityBatches, _transaction)); } int res = 0; using (IDbContextTransaction batchTransaction = _context.Database.BeginTransaction()) { SqlTransaction sqlTransaction = (SqlTransaction)batchTransaction.GetDbTransaction(); res += ReadOutput(entityBatches, sqlTransaction); batchTransaction.Commit(); } return(res); }
public PathBlockState(Block block) { Block = block; _restoreType = RestoreType.None; _restoreValue = 0; _restoreMergeType = default; }
public virtual async Task <int> ExecuteAsync(MergeType mergeType) { _mergeType = mergeType; if (_entityList.Count == 0) { return(0); } List <TEntity>[] entityBatches = GetEntityBatches(_entityList); if (_transaction != null || UseInnerTransactionForBatches == false) { return(await ReadOutputAsync(entityBatches, _transaction) .ConfigureAwait(false)); } int res = 0; using (IDbContextTransaction batchTransaction = await _context.Database.BeginTransactionAsync().ConfigureAwait(false)) { SqlTransaction sqlTransaction = (SqlTransaction)batchTransaction.GetDbTransaction(); res = await ReadOutputAsync(entityBatches, sqlTransaction).ConfigureAwait(false); batchTransaction.Commit(); } return(res); }
public Region(Region region1, Region region2, MergeType mergeType) { Width = region1.Width; Count = region1.Count; Grid = new bool[Width * Width]; if (region1.Width != region2.Width) return; // error: can't merge unlike regions if (mergeType == MergeType.And) { for (int i = 0; i < Width * Width; i++) if ((region1.Grid[i]) && (region2.Grid[i])) Add(i); } else if (mergeType == MergeType.Or) { for (int i = 0; i < Width * Width; i++) if ((region1.Grid[i]) || (region2.Grid[i])) Add(i); } else if (mergeType == MergeType.NAnd) { for (int i = 0; i < Width * Width; i++) if ((region1.Grid[i]) && (!region2.Grid[i])) Add(i); } }
public void BuildMenuItems(SqlConnection conn, MergeType buildType, string wordAtCursor) { if (_menuStrip == null) { return; } if (conn == null) { throw new NullParameterException("Connection param is null!"); } if (conn.State != System.Data.ConnectionState.Open) { throw new InvalidConnectionState("Invalid connection state! State = \"" + conn.State.ToString() + "\"."); } _conn = conn; _wordAtCursor = wordAtCursor; Cleanup(); GetObjectInfo(); if (_objectInfo == null) { return; } CreateMenuItems(); }
public PathBlockState(int oldStackSize) { Block = null; _restoreType = RestoreType.PopPushOp; _restoreValue = (ulong)oldStackSize; _restoreMergeType = default; }
public PathBlockState(ulong syncAddress, MergeType mergeType) { Block = null; _restoreType = RestoreType.PushBranchOp; _restoreValue = syncAddress; _restoreMergeType = mergeType; }
private static void SetMergeType(MergeType mt, DatHeader dh) { bool hasRom = DatHasRomOf.HasRomOf(dh.BaseDir); if (hasRom) { switch (mt) { case MergeType.Merge: DatClean.DatSetMakeMergeSet(dh.BaseDir); break; case MergeType.NonMerged: DatClean.DatSetMakeNonMergeSet(dh.BaseDir); break; case MergeType.Split: DatClean.DatSetMakeSplitSet(dh.BaseDir); //DatClean.RemoveNotCollected(dh.BaseDir); break; case MergeType.CHDsMerge: DatClean.DatSetMakeMergeSet(dh.BaseDir, false); break; } DatClean.RemoveDupes(dh.BaseDir); DatClean.RemoveEmptySets(dh.BaseDir); } }
public MergePacket(byte[] data, MergeType type, string timeStamp, string appName) { this.TimeStamp = timeStamp; this.AppName = appName; this.Data = data; this.Type = type; }
protected virtual string ConstructCommandWithParamsOrTVP(MergeType mergeType, List <TEntity> entities) { _mergeType = mergeType; StringBuilder sql = _useTVP ? ConstructHeadTVP() : ConstructHeadValues(entities); //on if (_mergeType == MergeType.Insert) { sql.AppendFormat(" ON 1 = 0 "); } else { ConstructOn(sql); } //merge update bool doUpdate = _mergeType == MergeType.Update || _mergeType == MergeType.Upsert; if (doUpdate) { ConstructUpdateMatched(sql); } if (_mergeType == MergeType.Update) { ConstructUpdateNotMatched(sql); } //merge insert bool doInsert = _mergeType == MergeType.Insert || _mergeType == MergeType.Upsert; if (doInsert) { ConstructInsert(sql); } //merge delete bool doDelete = _mergeType == MergeType.DeleteMatched || _mergeType == MergeType.DeleteNotMatched; if (doDelete) { ConstructDelete(sql); } //output if (!_useTVP) { ConstructOutput(sql); } sql.Append(";"); return(sql.ToString()); }
public virtual string ConstructCommandTVP(MergeType mergeType) { if (!_useTVP) { throw new InvalidOperationException($"{nameof(ConstructCommandTVP)} can only be called for {nameof(Repository)} {nameof(Repository.MergeTVP)} command, but current is {nameof(Repository.Merge)}."); } return(ConstructCommandWithParamsOrTVP(mergeType, null)); }
public MergeStatement(IEnumerable <MemberExpression> keys, string temporaryTableName, MergeType mergeType) { Check.NotNullOrEmpty(keys, nameof(keys)); Check.NotNullOrWhiteSpace(temporaryTableName, nameof(temporaryTableName)); Keys = keys; TemporaryTableName = temporaryTableName; Type = mergeType; }
public override void Read(PackFileDeserializer des, BinaryReaderEx br) { base.Read(des, br); m_mergeType = (MergeType)br.ReadByte(); br.ReadUInt64(); br.ReadUInt32(); br.ReadUInt16(); br.ReadByte(); m_mergeParams = new hkaiSilhouetteGenerationParameters(); m_mergeParams.Read(des, br); }
internal Conf_RestoreDlg(string path, MergeType emuMergeType, MergeType profileMergeType, MergeType gameMergeType) { InitializeComponent(); this.path = path; this.emuMergeType = emuMergeType; this.profileMergeType = profileMergeType; this.gameMergeType = gameMergeType; this.FormClosing += new FormClosingEventHandler(Conf_RestoreDlg_FormClosing); }
//construct sql command text public virtual string ConstructCommand(MergeType mergeType, List <TEntity> entities) { if (_useTVP) { throw new InvalidOperationException($"{nameof(ConstructCommand)} can only be called for {nameof(Repository)} {nameof(Repository.Merge)} command, but current is {nameof(Repository.MergeTVP)}."); } StringBuilder sqlHeader = ConstructHeadValues(entities); return(ConstructCommandWithParamsOrTVP(mergeType, entities)); }
// Called by camera to apply image effect void OnRenderImage(RenderTexture source, RenderTexture destination) { angle += anglePerSecond * Time.deltaTime * Mathf.PI * 2; flow.Update(); Vector3 p = new Vector3(center.position.x, center.position.y, center.position.z); p = GetComponent <Camera> ().WorldToViewportPoint(p); material.SetVector("_center", new Vector4(p.x, p.y, p.z, 0.0f)); material.SetVector("_x", new Vector4(offset.x, offset.y, angle, fade)); material.SetTexture("_Last", lastFrame); material.SetTexture("_Flow", flow.texture); material.SetVector("_Flow_ST", flow.scaleTranslate); if (radial) { Shader.EnableKeyword("radial"); Shader.DisableKeyword("nradial"); } else { Shader.EnableKeyword("nradial"); Shader.DisableKeyword("radial"); } if (invertY) { Shader.EnableKeyword("invert"); Shader.DisableKeyword("ninvert"); } else { Shader.EnableKeyword("ninvert"); Shader.DisableKeyword("invert"); } if (_merge != merge) { _merge = merge; foreach (string s in enums) { material.DisableKeyword(s); } material.EnableKeyword(merge.ToString()); } Graphics.Blit(source, destination, material); }
private static void SetMergeType(DatRule datRule, DatHeader dh) { bool hasRom = DatHasRomOf.HasRomOf(dh.BaseDir); if (hasRom) { MergeType mt = datRule.Merge; if (!datRule.MergeOverrideDAT) { switch (dh.MergeType?.ToLower()) { case "full": mt = MergeType.Merge; break; case "nonmerge": mt = MergeType.NonMerged; break; case "split": mt = MergeType.Split; break; } } switch (mt) { case MergeType.Merge: DatClean.DatSetMakeMergeSet(dh.BaseDir, dh.MameXML); break; case MergeType.NonMerged: DatClean.DatSetMakeNonMergeSet(dh.BaseDir); break; case MergeType.Split: DatClean.DatSetMakeSplitSet(dh.BaseDir); //DatClean.RemoveNotCollected(dh.BaseDir); break; case MergeType.CHDsMerge: DatClean.DatSetMakeMergeSet(dh.BaseDir, false); break; } DatClean.RemoveDupes(dh.BaseDir, !dh.MameXML); DatClean.RemoveEmptySets(dh.BaseDir); } }
public virtual void OnMerge(TDBaseBuffData <TType> newBuff, params object[] obj) { MergeLayer++; if (MergeType == BuffMergeType.None) { CurTime = 0; } else if (MergeType == BuffMergeType.CD) { RTMaxTime += MaxTime; } else { CLog.Error("其他的合并类型不应该出现在这里,错误的类型:{0}", MergeType.GetName()); } }
public Region(Region region1, Region region2, MergeType mergeType) { Width = region1.Width; Count = region1.Count; Grid = new bool[Width * Width]; if (region1.Width != region2.Width) { return; // error: can't merge unlike regions } if (mergeType == MergeType.And) { for (int i = 0; i < Width * Width; i++) { if ((region1.Grid[i]) && (region2.Grid[i])) { Add(i); } } } else if (mergeType == MergeType.Or) { for (int i = 0; i < Width * Width; i++) { if ((region1.Grid[i]) || (region2.Grid[i])) { Add(i); } } } else if (mergeType == MergeType.NAnd) { for (int i = 0; i < Width * Width; i++) { if ((region1.Grid[i]) && (!region2.Grid[i])) { Add(i); } } } }
protected virtual string CreateTopicUpdateQuery(UpdateParameters parameters, DbContext context) { string tvpName = TableValuedParameters.GetFullTVPName(_connectionSettings.Schema, TableValuedParameters.SUBSCRIBER_TYPE); var merge = new MergeCommand <SubscriberTopicSettingsLong>(context, null, tvpName, TableValuedParameters.UPDATE_SUBSCRIBERS_PARAMETER_NAME); merge.Compare.IncludeProperty(p => p.SubscriberId) .IncludeProperty(p => p.CategoryId) .IncludeProperty(p => p.TopicId); merge.UpdateMatched.ExcludeAllByDefault = true; if (parameters.UpdateTopicSendCount) { merge.UpdateMatched.Assign(t => t.SendCount, (t, s) => t.SendCount + s.SendCount); } if (parameters.UpdateTopicLastSendDateUtc) { merge.UpdateMatched.Assign(t => t.LastSendDateUtc, (t, s) => DateTime.UtcNow); } if (parameters.CreateTopicIfNotExist) { merge.Insert .ExcludeProperty(t => t.SubscriberTopicSettingsId) .IncludeValue(t => t.AddDateUtc, DateTime.UtcNow) .IncludeValue(t => t.IsEnabled, true) .IncludeValue(t => t.LastSendDateUtc, DateTime.UtcNow) .IncludeValue(t => t.IsDeleted, false); } MergeType mergeType = parameters.CreateTopicIfNotExist ? MergeType.Upsert : MergeType.Update; return(merge.ConstructCommandTVP(mergeType)); }
public MergeResult Merge(Xsd source, MergeType type) { if (type == MergeType.MatchingOnly) { try { foreach (Section sourceSection in source.sectionCollection.Sections) { foreach (Section destSection in this.sectionCollection.Sections) { if (destSection.NameEqualsTo(sourceSection.Name)) { foreach (XString sourceTextString in sourceSection.XStrings.Rows) { foreach (XString destTextString in destSection.XStrings.Rows) { if (destTextString.ResourceIndex == sourceTextString.ResourceIndex) { destTextString.TextString = sourceTextString.TextString; destTextString.TextStringLength = sourceTextString.TextStringLength; destTextString.ParameterOrder = sourceTextString.ParameterOrder; } } } } } } } catch (System.Exception e) { Debug.WriteLine(e.Message); return(new MergeResult(MergeStatus.Failure)); } } return(new MergeResult(MergeStatus.Success)); }
/// <summary> /// For Dynamic CAML Query /// </summary> /// <param name="conditions"></param> /// <param name="type"></param> /// <returns></returns> private string MergeCAMLConditions(List <string> conditions, MergeType type) { try { if (conditions.Count == 0) { return(""); } string typeStart = (type == MergeType.And ? "<And>" : "<Or>"); string typeEnd = (type == MergeType.And ? "</And>" : "</Or>"); // Build hierarchical structure while (conditions.Count >= 2) { List <string> complexConditions = new List <string>(); for (int i = 0; i < conditions.Count; i += 2) { if (conditions.Count == i + 1) { // Only one condition left complexConditions.Add(conditions[i]); } else { // Two condotions - merge complexConditions.Add(typeStart + conditions[i] + conditions[i + 1] + typeEnd); } } conditions = complexConditions; } } catch (Exception exec) { logger.WriteEventLog("Please contact admin : " + exec.Message); throw exec; } return(conditions[0]); }
internal UndoCheckPoint(IUndoData objectToUndoTo, string typeOfObject, MergeType mergeType) { this.objectToUndoTo = objectToUndoTo; this.typeOfObject = typeOfObject; this.mergeType = mergeType; }
public Layer MergeVisibleLayers(MergeType merge_type) { return new Layer(gimp_image_merge_visible_layers(ID, merge_type)); }
public Layer MergeDown(Layer layer, MergeType merge_type) { return new Layer(gimp_image_merge_down(ID, layer.ID, merge_type)); }
static extern Int32 gimp_image_merge_visible_layers(Int32 image_ID, MergeType merge_type);
static extern Int32 gimp_image_merge_down(Int32 image_ID, Int32 merge_layer_ID, MergeType merge_type);
/// <summary> /// Subscribes to progress reports. /// </summary> /// <param name="id">The identifier.</param> /// <param name="disposables">The disposables.</param> /// <param name="mergeType">Type of the merge.</param> protected virtual void SubscribeToProgressReports(long id, CompositeDisposable disposables, MergeType mergeType) { definitionLoadHandler?.Dispose(); definitionAnalyzeLoadHandler?.Dispose(); definitionMergeProgressHandler?.Dispose(); fileMergeProgressHandler?.Dispose(); modCompressProgressHandler?.Dispose(); modInvalidReplaceHandler?.Dispose(); if (mergeType == MergeType.Advanced) { definitionLoadHandler = modDefinitionLoadHandler.Message.Subscribe(s => { var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Advanced.Overlay_Loading_Definitions); var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new { PercentDone = s.Percentage.ToLocalizedPercentage(), Count = 1, TotalCount = 4 }); TriggerOverlay(id, true, message, overlayProgress); }).DisposeWith(disposables); modInvalidReplaceHandler = modDefinitionInvalidReplaceHandler.Message.Subscribe(s => { var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Advanced.Overlay_Replacing_Definitions); var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new { PercentDone = s.Percentage.ToLocalizedPercentage(), Count = 2, TotalCount = 4 }); TriggerOverlay(id, true, message, overlayProgress); }).DisposeWith(disposables); definitionAnalyzeLoadHandler = modDefinitionAnalyzeHandler.Message.Subscribe(s => { var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Advanced.Overlay_Analyzing_Definitions); var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new { PercentDone = s.Percentage.ToLocalizedPercentage(), Count = 3, TotalCount = 4 }); TriggerOverlay(id, true, message, overlayProgress); }).DisposeWith(disposables); definitionMergeProgressHandler = modDefinitionMergeProgressHandler.Message.Subscribe(s => { var message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Advanced.Overlay_Merging_Collection); var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new { PercentDone = s.Percentage.ToLocalizedPercentage(), Count = 4, TotalCount = 4 }); TriggerOverlay(id, true, message, overlayProgress); }).DisposeWith(disposables); } else if (mergeType == MergeType.Basic) { fileMergeProgressHandler = modFileMergeProgressHandler.Message.Subscribe(s => { string message; if (s.Step == 1) { message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Basic.Overlay_Gathering_Mod_Info); } else { message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Basic.Overlay_Writing_Files); } var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new { PercentDone = s.Percentage.ToLocalizedPercentage(), Count = s.Step, TotalCount = 2 }); TriggerOverlay(id, true, message, overlayProgress); }).DisposeWith(disposables); } else { modCompressProgressHandler = modCompressMergeProgressHandler.Message.Subscribe(s => { string message; if (s.Step == 1) { message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Compress.Overlay_Gathering_Mod_Info); } else { message = localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Compress.Overlay_Compressing_Files); } var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Collection_Mods.MergeCollection.Overlay_Progress), new { PercentDone = s.Percentage.ToLocalizedPercentage(), Count = s.Step, TotalCount = 2 }); TriggerOverlay(id, true, message, overlayProgress); }).DisposeWith(disposables); } }
public static Bitmap MergeImageToBitmap(MergeType type, string fstImage, string sndImage) { Bitmap result = null; if (File.Exists(fstImage) && File.Exists(sndImage)) { Bitmap firstImage = new Bitmap(fstImage); Bitmap secondImage = new Bitmap(sndImage); int resultWidth, resultHeight, drawSndX, drawSndY; switch (type) { case MergeType.MT_LEFT_RIGHT: { resultWidth = firstImage.Width + secondImage.Width; resultHeight = Math.Max(firstImage.Height, secondImage.Height); drawSndX = firstImage.Width; drawSndY = 0; break; } case MergeType.MT_TOP_BOTTOM: { resultWidth = firstImage.Width + secondImage.Width; resultHeight = Math.Max(firstImage.Height, secondImage.Height); drawSndX = 0; drawSndY = firstImage.Height; break; } default: { resultWidth = firstImage.Width + secondImage.Width; resultHeight = Math.Max(firstImage.Height, secondImage.Height); drawSndX = firstImage.Width; drawSndY = 0; break; } } result = new Bitmap(resultWidth, resultHeight); result.SetResolution(Math.Min(firstImage.HorizontalResolution, secondImage.HorizontalResolution), Math.Min(firstImage.VerticalResolution, secondImage.VerticalResolution)); //1.0.0.13 Graphics g = Graphics.FromImage(result); g.FillRectangle(new Pen(Color.White).Brush, 0, 0, result.Width, result.Height); g.DrawImage(firstImage, 0, 0, firstImage.Width, firstImage.Height); g.DrawImage(secondImage, drawSndX, drawSndY, secondImage.Width, secondImage.Height); firstImage.Dispose(); secondImage.Dispose(); } return result; }
/// <summary> /// 合并两张图片,并保存 /// </summary> /// <param name="type">合并方式(左右/上下)</param> /// <param name="fstImage">第一张图片</param> /// <param name="sndImage">第二张图片</param> /// <param name="targetImage">目标图片</param> public static void MergeImage(MergeType type, string fstImage, string sndImage, string targetImage) { if (File.Exists(fstImage) && File.Exists(sndImage)) { Bitmap result = MergeImageToBitmap(type, fstImage, sndImage); ConvertAndSaveImage(result, targetImage); result.Dispose(); } }
private static void AddMergedState(Dictionary <char, string> prevMergedState, ref Automaat <string> merged, Automaat <string> dfaA, Automaat <string> dfaB, MergeType type) { // string[] states = prevMergedState.Split('_'); // Add prev int countFinal = 0; int countStart = 0; string completePrevMergedState = ""; foreach (KeyValuePair <char, string> entry in prevMergedState) { completePrevMergedState += entry.Value + "_"; if (entry.Key == 'A') { if (dfaA.FinalStates.Contains(entry.Value)) { countFinal++; } if (dfaA.StartStates.Contains(entry.Value)) { countStart++; } } else if (entry.Key == 'B') { if (dfaB.FinalStates.Contains(entry.Value)) { countFinal++; } if (dfaB.StartStates.Contains(entry.Value)) { countStart++; } } } completePrevMergedState = completePrevMergedState.TrimEnd('_'); if (type == MergeType.Union && countFinal == prevMergedState.Count) { merged.DefineAsFinalState(completePrevMergedState); } else if (type == MergeType.Concatenation && countFinal >= 1) { merged.DefineAsFinalState(completePrevMergedState); } if (type == MergeType.Union && countStart == prevMergedState.Count) { merged.DefineAsStartState(completePrevMergedState); } else if (type == MergeType.Concatenation && countStart >= 1) { merged.DefineAsStartState(completePrevMergedState); } if (merged.GetTransition(completePrevMergedState).Count == merged.Symbols.Count) { return; } foreach (char symbol in merged.Symbols) { Dictionary <char, string> newMergedState = new Dictionary <char, string>(); // This could break though if (CheckExistingRouteForChar(completePrevMergedState, symbol, merged)) { return; } foreach (KeyValuePair <char, string> entry in prevMergedState) { if (entry.Key == 'A') { CollectRoutesFromDfa(entry, symbol, dfaA, ref newMergedState); } else if (entry.Key == 'B') { CollectRoutesFromDfa(entry, symbol, dfaB, ref newMergedState); } } string completeNewMergedState = ""; foreach (KeyValuePair <char, string> entry in newMergedState) { completeNewMergedState += entry.Value + "_"; } completeNewMergedState = completeNewMergedState.TrimEnd('_'); merged.AddTransition(new Transition <string>(completePrevMergedState, symbol, completeNewMergedState)); AddMergedState(newMergedState, ref merged, dfaA, dfaB, type); } }
public MergeResult Merge(Xsd source, MergeType type) { if (type == MergeType.MatchingOnly) { try { foreach (Section sourceSection in source.sectionCollection.Sections) { foreach (Section destSection in this.sectionCollection.Sections) { if (destSection.NameEqualsTo(sourceSection.Name)) { foreach (XString sourceTextString in sourceSection.XStrings.Rows) { foreach (XString destTextString in destSection.XStrings.Rows) { if (destTextString.ResourceIndex == sourceTextString.ResourceIndex) { destTextString.TextString = sourceTextString.TextString; destTextString.TextStringLength = sourceTextString.TextStringLength; destTextString.ParameterOrder = sourceTextString.ParameterOrder; } } } } } } } catch (System.Exception e) { Debug.WriteLine(e.Message); return new MergeResult(MergeStatus.Failure); } } return new MergeResult(MergeStatus.Success); }
public BackupDropdownItem(string displayMember, MergeType mergeType) { DisplayMember = displayMember; ValueMember = mergeType; }