/// <summary> /// Check for an existing hash. We basically want it to be fresh every time. /// This would be a good place to abuse the Redbrick, if you had a mind to. /// </summary> private void AddHash() { System.IO.FileInfo fi; try { if (!string.IsNullOrWhiteSpace(Document.GetPathName())) { fi = new System.IO.FileInfo(Document.GetPathName()); prop.PartFileInfo = fi; if (!prop.Contains("CRC32")) { prop.Hash = Redbrick.GetHash(string.Format("{0}\\{1}", prop.PartFileInfo.Directory.FullName, prop.PartFileInfo.Name)); SwProperty p = new SwProperty("CRC32", swCustomInfoType_e.swCustomInfoNumber, prop.Hash.ToString(), true); p.Old = false; prop.Add(p); } else { } } else { //this.prop.PartName = "New Document"; // <-- stack overflow? weird } } catch (ArgumentException ae) { prop.PartName = ae.HResult.ToString(); } catch (Exception e) { prop.PartName = e.HResult.ToString(); } }
private void CalculateBlankSize(double edgeL, double edgeW) { double dVal = 0.0; double finLen = 0.0; double blankLen = 0.0; if (propertySet.Contains("LENGTH")) { if (double.TryParse(propertySet.GetProperty("LENGTH").ResValue, out finLen)) { blankLen = finLen; } if (double.TryParse(tbOverL.Text, out dVal)) { _overL = dVal; } this.tbBlankL.Text = Math.Round((blankLen + dVal + edgeW), 3).ToString("N3"); } blankLen = 0.0; if (propertySet.Contains("WIDTH")) { if (double.TryParse(propertySet.GetProperty("WIDTH").ResValue, out finLen)) { blankLen = finLen; } dVal = 0.0; if (double.TryParse(tbOverW.Text, out dVal)) { _overW = dVal; } tbBlankW.Text = Math.Round((blankLen + dVal + edgeL), 3).ToString("N3"); } }
private void LinkControlToProperty(string property, Control c) { SwProperty p = propertySet.GetProperty(property); if (propertySet.Contains(p)) { p.Ctl = c; c.Text = p.Value; } else { SwProperty x = new SwProperty(property, swCustomInfoType_e.swCustomInfoText, string.Empty, true); x.Ctl = c; } }