/// <summary> /// 初始化子系统 /// </summary> /// <returns>子系统自动打开的菜单代码</returns> private string InitSubSystem() { DisplayHelper.Show("获取子系统相关数据", "正在装载系统,请等待..."); BDictSystem system = EmpInfo.CanUseSystemList.Find(sys => sys.Code == EnvInfo.SystemCode); this.Text = this.Title + " --- " + EnvInfo.SystemName; Image img = BmpHelper.GetBmp(system.Ico); if (img != null) { Bitmap map = new Bitmap(img); Icon icon = Icon.FromHandle(map.GetHicon()); if (icon != null) { this.Icon = icon; } } // 获取参数(ParamHelper) 根据系统和人员获取默认菜单 String pname = "DEF_MENU_" + EnvInfo.SystemCode; var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()), new KeyValuePair <string, string>("parmName", pname) }; CustomException ce = null; String menuCode = HttpDataHelper.GetStringWithInfo("BASE", "/sys/parameteremp", out ce, parmList); return(menuCode); }
private static void stegImageByImageType(string path, BitArray baBits, int securityLevel) { var trimPath = path.ToLower().Trim(); // Check image type if (trimPath.EndsWith(".jpg") || trimPath.EndsWith(".jpeg")) // JPEG { JpegHelper.StegBinary(path, baBits, securityLevel); } else if (trimPath.EndsWith(".bmp")) // BITMAP { BmpHelper.StegBinary(path, baBits, securityLevel); } else if (trimPath.EndsWith(".png")) // PNG { PngHelper.StegBinary(path, baBits, securityLevel); } else if (trimPath.EndsWith(".gif")) // GIF { GifHelper.StegBinary(path, baBits); } else if (trimPath.EndsWith(".tif") || trimPath.EndsWith(".tiff")) // TIFF { TifHelper.StegBinary(path, baBits, securityLevel); } else if (!string.IsNullOrEmpty(trimPath)) { MessageBox.Show("Wrong extension.", "StegImageUI", MessageBoxButton.OK, MessageBoxImage.Information); } }
public bool TryGetWindowImage(out Image sendImage) { if (BmpHelper.TryGetWindow(_WindowHandle, out Bitmap windowBmp)) { if (_WindowWidth > 0) { sendImage = BmpHelper.ResizeBmp(windowBmp, _WindowWidth, _Mode); } else { sendImage = windowBmp; } return(true); } sendImage = null; return(false); }
private void getSlotsByImageType(string imagePath) { var trimPath = imagePath.ToLower().Trim(); // Check image type if (trimPath.EndsWith(".jpg") || trimPath.EndsWith(".jpeg")) // JPEG { // Available slots not 0 - DCT values 0 won't be overwritten var dctCoeffs = JpegHelper.GetDctCoefficients(imagePath); // 2 bits for each dct coefficient (0 values are skpped) _slots = 2 * dctCoeffs.DctFullAc.Where(s => 0 != s).Count() - HEADER_BITS_LEN; } else if (trimPath.EndsWith(".bmp")) // BITMAP { _slots = BmpHelper.GetAvailableSlots(imagePath) - HEADER_BITS_LEN; } else if (trimPath.EndsWith(".png")) // PNG { _slots = PngHelper.GetAvailableSlots(imagePath) - HEADER_BITS_LEN; } else if (trimPath.EndsWith(".gif")) // GIF { sldSecLevel.Value = 1; _slots = GifHelper.GetAvailableSlots(imagePath) - HEADER_BITS_IDX_LEN; } else if (trimPath.EndsWith(".tif") || trimPath.EndsWith(".tiff")) // TIFF { sldSecLevel.Value = 1; _slots = TifHelper.GetAvailableSlots(imagePath) - HEADER_BITS_IDX_LEN; } if (_slots < 10) { tbxSlots.Text = tbxSlotsUsed.Text = tbxSlotsLeft.Text = "0"; MessageBox.Show("Image not suitable for embedding content.", "StegImageUI", MessageBoxButton.OK, MessageBoxImage.Information); } }
/// <summary> /// 产生菜单 /// </summary> /// <param name="menu">菜单数据</param> /// <param name="pi">菜单起点</param> /// <returns></returns> private BarSubItem CreateMenu(List <DataMenu> menuList, ref int pi) { // 取数据到变量 string code = menuList[pi].Code; string title = menuList[pi].Title; // 加入下拉菜单 BarSubItem bsimenu = new BarSubItem(); bsimenu.Caption = title; bsimenu.Name = "bsi" + code; string ico = menuList[pi].Ico; if (!ico.IsNullOrEmpty()) // 图标 { if (ico.ToLower().EndsWith("svg")) { bsimenu.ImageOptions.SvgImage = BmpHelper.GetSvg(ico); } else { Image img = BmpHelper.GetIco(ico); bsimenu.LargeGlyph = bsimenu.Glyph = img; } } // 在菜单项下加入菜单(中间项)或子项(功能项) pi++; for (; pi < menuList.Count; pi++) { string code1 = menuList[pi].Code; string title1 = menuList[pi].Title; if (code1.Length == (code.Length + 1) && code1.Substring(0, code.Length) == code) { string modname = menuList[pi].ModuleName; string funname = menuList[pi].ObjectName; string para = menuList[pi].Parameter; int openflag = menuList[pi].WinState; if (string.IsNullOrEmpty(funname)) // 有子菜单 { BarSubItem bsisubmenu = this.CreateMenu(menuList, ref pi); if (bsisubmenu.LinksPersistInfo.Count > 0) // 有子项才加入 { this.ribbon.Items.Add(bsisubmenu); bsimenu.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(bsisubmenu)); } } else { // 是功能加入功能项 BarButtonItem bbi = new BarButtonItem(); bbi.Caption = title1; bbi.Id = this.ribbon.Items.Count; bbi.Name = "bbi" + code1; if (!string.IsNullOrEmpty(menuList[pi].Prompt)) { SuperToolTip stt = new SuperToolTip(); ToolTipItem tti = new ToolTipItem(); tti.Text = menuList[pi].Prompt; stt.Items.Add(tti); bbi.SuperTip = stt; } ico = menuList[pi].Ico; if (!ico.IsNullOrEmpty()) // 图标 { bbi.RibbonStyle = RibbonItemStyles.Default; if (ico.ToLower().EndsWith("svg")) { bbi.ImageOptions.SvgImage = BmpHelper.GetSvg(ico); } else { bbi.Glyph = BmpHelper.GetIco(ico); } } bbi.Tag = ToFunction(menuList[pi]); bbi.ItemClick += new ItemClickEventHandler(this.dynamic_bbi_ItemClick); this.ribbon.Items.Add(bbi); bsimenu.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(bbi)); } } else { pi--; break; } } return(bsimenu); }
/// <summary> /// 形成Page及Item /// </summary> private void Create_Page(string open_menu_code) { // 取菜单表 // 获取可用菜单信息 String roles = EmpInfo.Roles; var parmList = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("systemId", EnvInfo.SystemId.ToString()), new KeyValuePair <string, string>("empId", EmpInfo.Id.ToString()), new KeyValuePair <string, string>("roles", EmpInfo.Roles), }; CustomException ce = null; List <DataMenu> menuList = HttpDataHelper.GetWithInfo <List <DataMenu> >("BASE", "/sys/menu", out ce, parmList); // 删除失效菜单(模块或对象不可用) for (int i = menuList.Count - 1; i >= 0; i--) { if (!String.IsNullOrEmpty(menuList[i].ObjectCode) && (String.IsNullOrEmpty(menuList[i].ObjectName) || String.IsNullOrEmpty(menuList[i].ModuleName))) { menuList.RemoveAt(i); } } int num = 0; string curPageOrd = ""; RibbonPage rbPage = new RibbonPage(); RibbonPageGroup rbPageGroup = new RibbonPageGroup(); for (int i = 0; i < menuList.Count; i++) { string code = menuList[i].Code; string title = menuList[i].Title; if (code.Length == 1) // 对应页 { rbPage = new RibbonPage(title); rbPage.Name = "rbPage" + code; this.ribbon.Pages.Insert(num, rbPage); this.ribbon.Pages[num].Visible = false; curPageOrd = code; num++; } if (code.Length == 2) // 对应页组 { int funcount = CountFunctionItem(menuList, i); // 是否存在功能 if (funcount > 0 && num > 0 && curPageOrd == code.Substring(0, 1)) { this.ribbon.Pages[num - 1].Visible = true; // 加入页组 rbPageGroup = new RibbonPageGroup(""); rbPageGroup.Name = "rbPageGroup" + code; rbPageGroup.ShowCaptionButton = false; rbPage.Groups.Add(rbPageGroup); string funname = menuList[i].ObjectName; if (!string.IsNullOrEmpty(funname)) { BarButtonItem bbi = new BarButtonItem(); bbi.Caption = title; bbi.Id = this.ribbon.Items.Count; bbi.Name = "bbi" + code; if (!string.IsNullOrEmpty(menuList[i].Prompt)) { SuperToolTip stt = new SuperToolTip(); ToolTipItem tti = new ToolTipItem(); tti.Text = menuList[i].Prompt; stt.Items.Add(tti); bbi.SuperTip = stt; } string ico = menuList[i].Ico; if (!ico.IsNullOrEmpty()) // 图标 { if (ico.ToLower().EndsWith("svg")) { bbi.ImageOptions.SvgImage = BmpHelper.GetSvg(ico); } else { bbi.LargeGlyph = BmpHelper.GetIco(ico); } bbi.RibbonStyle = RibbonItemStyles.Default; } bbi.Tag = ToFunction(menuList[i]); bbi.ItemClick += new ItemClickEventHandler(this.dynamic_bbi_ItemClick); this.ribbon.Items.Add(bbi); rbPageGroup.ItemLinks.Add(bbi); rbPageGroup.Visible = true; } else { BarSubItem bsimenu = this.CreateMenu(menuList, ref i); // 产生菜单 if (bsimenu.LinksPersistInfo.Count > 0 || bsimenu.Tag != null) // 有子项才加入 { this.ribbon.Items.Add(bsimenu); rbPageGroup.ItemLinks.Add(bsimenu); rbPageGroup.Visible = true; } } } } } this.ribbon.SelectedPage = this.ribbon.Pages[0]; // 找自动打开菜单 if (open_menu_code != null) { DataMenu default_menu = menuList.Find(o => o.Code == open_menu_code); if (default_menu != null && !String.IsNullOrEmpty(default_menu.ObjectName) && !String.IsNullOrEmpty(default_menu.ModuleName)) { Execute(ToFunction(default_menu)); } } return; }
/// <summary> /// 系统初始化处理 /// </summary> public bool Init() { if (EmpInfo.Id <= 0) { this.Close(); return(false); } // 人员基本信息 LogHelper.Info(this, "系统初始化 --- 设置人员有关信息"); this.bsiOper.Caption = EmpInfo.Name + "(" + EmpInfo.BizDeptName + ")"; this.bsiIP.Caption = EnvInfo.ComputerIp; this.bsiUser.Caption = EnvInfo.UserName; this.bbiChangeChoice.Caption = (EmpInfo.InputChoice == "1") ? "首拼" : "五笔"; LinkMacAddress.Caption = "未识别"; for (int i = 0; i < EnvInfo.ComputerMacIpList.Count; i++) { if (i == 0) { LinkMacAddress.Caption = EnvInfo.ComputerMacIpList[i].Mac; } else { var item = new BarHeaderItem { Caption = EnvInfo.ComputerMacIpList[i].Mac, AllowRightClickInMenu = false }; LinkMacAddress.LinksPersistInfo.Add(new LinkPersistInfo(item)); } } //初始化子系统 LogHelper.Info(this, "系统初始化 --- 子系统初始化"); string open_menu_code = InitSubSystem(); //初始化主菜单 LogHelper.Info(this, "系统初始化 --- 生成主菜单"); InitMainMenu(open_menu_code); // 加入可切换的子系统 BarSubItem bsiSystem = new DevExpress.XtraBars.BarSubItem(); bsiSystem.Caption = "系统切换"; bsiSystem.Id = this.ribbon.Items.Count; bsiSystem.Name = "bsiSystem"; this.ribbon.Items.Add(bsiSystem); this.rbPageGroupTools.ItemLinks.Insert(0, bsiSystem); foreach (BDictSystem system in EmpInfo.CanUseSystemList) { if (system.Code != EnvInfo.SystemCode) { BarButtonItem bbi = new BarButtonItem(); bbi.Caption = system.Name; bbi.Id = this.ribbon.Items.Count; bbi.Name = "bbiSystem" + system.Code; bbi.Tag = system.Code; bbi.ItemClick += new ItemClickEventHandler(this.bbiSystem_ItemClick); bbi.RibbonStyle = RibbonItemStyles.Default; if (!string.IsNullOrEmpty(system.Ico)) { bbi.ImageOptions.Image = BmpHelper.GetIco(system.Ico); } this.ribbon.Items.Add(bbi); bsiSystem.LinksPersistInfo.Add(new LinkPersistInfo(bbi)); } } // v9.2以后不加入会出现下拉菜单不能出来!!! ((System.ComponentModel.ISupportInitialize)(this.ribbon)).EndInit(); //初始化外部信息对象, 危机值、关注项由通知 List <string> infoRemoteCodeList = new List <string>(); // TODO: ??? infoRemoteCodeList.Add("foo1"); // 危机值信息 infoRemoteCodeList.Add("foo2"); // 关注项信息 infoRemoteAction = new RemoteInfoReceiver(infoRemoteCodeList, SynCallbackInfo); //RemoteInfoHelper.Subscribe("foo1,foo2"); //初始化内部信息对象 List <string> infoLocalCodeList = new List <string>(); infoLocalCodeList.Add(LocalInfoHelper.OpenForm); // 打开Form infoLocalCodeList.Add(LocalInfoHelper.AddNotice); // 接受通知 infoLocalCodeList.Add(LocalInfoHelper.DelNotice); // 撤销通知 infoLocalAction = new LocalInfoReceiver(infoLocalCodeList, CallbackInfo); for (int index = 0; index < ribbon.Pages.Count; index++) { var item = ribbon.Pages[index]; item.Appearance.Font = new Font(SystemFonts.DefaultFont.Name, SystemFonts.DefaultFont.Size); } for (int index = 0; index < ribbon.Items.Count; index++) { var item = ribbon.Items[index]; item.ItemAppearance.SetFont(new Font(SystemFonts.DefaultFont.Name, SystemFonts.DefaultFont.Size)); } LogHelper.Info(this, "系统初始化 --- 启动定时器"); timer1.Start(); DisplayHelper.Close(); return(true); }
private static StegModel unstegImageByImageType(string path) { var sm = new StegModel(); var trimPath = path.ToLower().Trim(); // Check image type if (trimPath.EndsWith(".jpg") || trimPath.EndsWith(".jpeg")) // JPEG { var stegStruct = JpegHelper.UnstegBinary(path); sm.SecurityLevel = stegStruct.SecurityLevel; sm.TotalSize = stegStruct.TotalSize; sm.ContentFull = stegStruct.ContentFull; sm.IsFile = stegStruct.IsFile; sm.ContentSize = stegStruct.ContentSize; sm.Content = stegStruct.Content; } else if (trimPath.EndsWith(".bmp")) // BITMAP { var stegStruct = BmpHelper.UnstegBinary(path); sm.SecurityLevel = stegStruct.SecurityLevel; sm.TotalSize = stegStruct.TotalSize; sm.ContentFull = stegStruct.ContentFull; sm.IsFile = stegStruct.IsFile; sm.ContentSize = stegStruct.ContentSize; sm.Content = stegStruct.Content; } else if (trimPath.EndsWith(".png")) // PNG { var stegStruct = PngHelper.UnstegBinary(path); sm.SecurityLevel = stegStruct.SecurityLevel; sm.TotalSize = stegStruct.TotalSize; sm.ContentFull = stegStruct.ContentFull; sm.IsFile = stegStruct.IsFile; sm.ContentSize = stegStruct.ContentSize; sm.Content = stegStruct.Content; } else if (trimPath.EndsWith(".gif")) // GIF { var stegStruct = GifHelper.UnstegBinary(path); sm.SecurityLevel = stegStruct.SecurityLevel; sm.TotalSize = stegStruct.TotalSize; sm.ContentFull = stegStruct.ContentFull; sm.IsFile = stegStruct.IsFile; sm.ContentSize = stegStruct.ContentSize; sm.Content = stegStruct.Content; } else if (trimPath.EndsWith(".tif") || trimPath.EndsWith(".tiff")) // TIFF { var stegStruct = TifHelper.UnstegBinary(path); sm.SecurityLevel = stegStruct.SecurityLevel; sm.TotalSize = stegStruct.TotalSize; sm.ContentFull = stegStruct.ContentFull; sm.IsFile = stegStruct.IsFile; sm.ContentSize = stegStruct.ContentSize; sm.Content = stegStruct.Content; } else if (!string.IsNullOrEmpty(trimPath)) { MessageBox.Show("Wrong extension.", "StegImageUI", MessageBoxButton.OK, MessageBoxImage.Information); } return(sm); }