コード例 #1
0
        private void bUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Config.OrgXY.X = float.Parse(this.tCircleX.Text);
                Config.OrgXY.Y = float.Parse(this.tCircleY.Text);
                Config.MinR    = int.Parse(this.tMinR.Text);
                Config.MaxR    = int.Parse(this.tMaxR.Text);
                Config.Exp     = int.Parse(this.tExp.Text);

                Config.D_Exp  = int.Parse(this.tD_Exp.Text);
                Config.D_MinR = int.Parse(this.tD_MinR.Text);
                Config.D_MaxR = int.Parse(this.tD_MaxR.Text);

                Config.D_Org1XY.X = float.Parse(this.tD_Org1X.Text);
                Config.D_Org1XY.Y = float.Parse(this.tD_Org1Y.Text);
                Config.D_Org2XY.X = float.Parse(this.tD_Org2X.Text);
                Config.D_Org2XY.Y = float.Parse(this.tD_Org2Y.Text);
                Config.CheckSpace = (int)this.nSpace.Value;
                Config.UpLimit    = (double)this.nLimit.Value;

                Config.EnableMachineOrg = this.EnableMachineOrg.Checked;

                SerializableHelper <MachineOrgConfig> helper = new SerializableHelper <MachineOrgConfig>(Config);
                helper.XMLSerialize(System.AppDomain.CurrentDomain.BaseDirectory + "Configure\\MachineOrg.xml");
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
コード例 #2
0
        public fmSetMachineOrg()
        {
            InitializeComponent();

            SerializableHelper <MachineOrgConfig> helper = new SerializableHelper <MachineOrgConfig>(Config);

            Config = helper.DeXMLSerialize(System.AppDomain.CurrentDomain.BaseDirectory + "Configure\\MachineOrg.xml");
            Form_Main.Instance.LightON_U();
            Form_Main.Instance.SetShutter(Config.Exp, Camera.CAM.Top);
            this.tCircleX.Text = Config.OrgXY.X.ToString();
            this.tCircleY.Text = Config.OrgXY.Y.ToString();
            this.tMinR.Text    = Config.MinR.ToString();
            this.tMaxR.Text    = Config.MaxR.ToString();
            this.tExp.Text     = Config.Exp.ToString();

            this.tD_MinR.Text = Config.D_MinR.ToString();
            this.tD_MaxR.Text = Config.D_MaxR.ToString();
            this.tD_Exp.Text  = Config.D_Exp.ToString();

            this.tD_Org1X.Text = Config.D_Org1XY.X.ToString();
            this.tD_Org1Y.Text = Config.D_Org1XY.Y.ToString();

            this.tD_Org2X.Text = Config.D_Org2XY.X.ToString();
            this.tD_Org2Y.Text = Config.D_Org2XY.Y.ToString();

            this.nLimit.Value = (decimal)Config.UpLimit;
            this.nSpace.Value = (decimal)Config.CheckSpace;

            this.EnableMachineOrg.Checked = Config.EnableMachineOrg;
        }
コード例 #3
0
ファイル: FiddlerFreeHttp.cs プロジェクト: soniczone/FreeHttp
        public void OnLoad()
        {
            AddFiddlerObjectLog("OnLoad");
            //string workPath = string.Format("{0}\\FreeHttp", System.Windows.Forms.Application.StartupPath);
            //System.Threading.Tasks.Task.Run(OnLoad);
            string workPath = string.Format("{0}\\FreeHttp", Directory.GetCurrentDirectory());

            if (!isOnLoad)
            {
                tabPage      = new TabPage();
                tabPage.Text = "Free Http";
                if (FiddlerApplication.UI.tabsViews.ImageList != null)
                {
                    myIco = FreeHttp.Resources.MyResource.freehttp;
                    FiddlerApplication.UI.tabsViews.ImageList.Images.Add(myIco);
                    tabPage.ImageIndex = FiddlerApplication.UI.tabsViews.ImageList.Images.Count - 1;
                }
                try
                {
                    if (!Directory.Exists(workPath))
                    {
                        AddFiddlerObjectLog(string.Format("Create working directory {0}", workPath));
                        Directory.CreateDirectory(workPath);
                    }
                    AddFiddlerObjectLog(string.Format("load configuration"));
                    myFreeHttpWindow = new FreeHttpWindow(SerializableHelper.DeserializeRuleList(), SerializableHelper.DeserializeData <FiddlerModificSettingInfo>("FreeHttp\\FreeHttpSetting.xml"), SerializableHelper.DeserializeContractData <FreeHttp.AutoTest.RunTimeStaticData.ActuatorStaticDataCollection>("FreeHttp\\FreeHttpStaticDataCollection.xml"));
                }
                catch (Exception ex)
                {
                    AddFiddlerObjectLog(string.Format("load configuration fial ,{0}", ex.Message));
                }
                finally
                {
                    if (myFreeHttpWindow == null)
                    {
                        myFreeHttpWindow = new FreeHttpWindow(null, null, null);
                    }
                }
                myFreeHttpWindow.OnUpdataFromSession       += myFreeHttpWindow_OnUpdataFromSession;
                myFreeHttpWindow.OnGetSessionRawData       += myFreeHttpWindow_OnGetSessionRawData;
                myFreeHttpWindow.OnGetSessionEventArgs     += MyFreeHttpWindow_OnGetSessionEventArgs;
                myFreeHttpWindow.OnGetSessionSeekHead      += myFreeHttpWindow_OnGetSessionSeekHead;
                myFreeHttpWindow.OnShowInIndependentWindow += MyFreeHttpWindow_OnShowInIndependentWindow;
                myFreeHttpWindow.Dock   = DockStyle.Fill;
                myFreeHttpWindow.Enter += myFreeHttpWindow_Enter;
                tabPage.Controls.Add(myFreeHttpWindow);
                FiddlerApplication.UI.tabsViews.TabPages.Add(tabPage);
                Fiddler.FiddlerApplication.UI.Deactivate             += UI_Deactivate;
                FiddlerApplication.UI.tabsViews.SelectedIndexChanged += tabsViews_SelectedIndexChanged;
                FiddlerApplication.OnWebSocketMessage         += FiddlerApplication_OnWebSocketMessage;
                FiddlerApplication.UI.tabsViews.ParentChanged += TabsViews_ParentChanged;

                upgradeService = new UpgradeService();
                upgradeService.GetUpgradeMes += upgradeService_GetUpgradeMes;
                operationReportService        = new OperationReportService();
                isOnLoad = true;
            }
        }
        /// <summary>
        ///  只有程序加载的第一次可以使用
        /// </summary>
        public static void Load()
        {
            SerializableHelper <ReportHelper> helper = new SerializableHelper <ReportHelper>();
            var temp = helper.DeJsonSerialize(PathDefine.sPathReport + "Report.json");

            CreatePath(DateTime.Now);

            if (temp != null)
            {
                ReportHelper.Instance = temp;
            }
            ReportHelper.Instance[Module.Front] = LoadReport(Module.Front, DateTime.Now);
            ReportHelper.Instance[Module.After] = LoadReport(Module.After, DateTime.Now);
        }
コード例 #5
0
        public void Deserialize(BinaryReader reader)
        {
            int  size        = reader.ReadInt32();
            int  offset      = reader.ReadInt32();
            long oldPosition = reader.BaseStream.Position;

            reader.BaseStream.Position = offset;
            Capacity = size;

            for (int i = 0; i != size; ++i)
            {
                SerializableHelper.Deserialize(reader, out T val);
                Add(val);
            }
            reader.BaseStream.Position = oldPosition;
        }
コード例 #6
0
ファイル: ConfigManage.cs プロジェクト: HaiqTop/HWallpaper
 /// <summary>
 /// 保存配置
 /// </summary>
 public static void Save()
 {
     try
     {
         byte[] bytes = SerializableHelper.SerializeObject(ConfigManage.Data);
         //创建文件写入对象
         using (FileStream fileWrite = new FileStream(filePath, FileMode.Create))
         {
             fileWrite.Write(bytes, 0, bytes.Length);
         }
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex.Message, EnumLogLevel.Error);
         //throw;
     }
 }
        private static MachineStatistic LoadReport(Module module, DateTime time)
        {
            bool isCurDay = true;
            bool isDay    = true;

            if (time.Hour < ReportHelper.Instance.DayShfitTime.Hours) // 上一天的夜班
            {
                isDay    = false;
                isCurDay = false;
            }
            else if (time.Hour >= ReportHelper.Instance.DayShfitTime.Hours &&
                     time.Hour < ReportHelper.Instance.NightShfitTime.Hours)
            {
            }
            else if (time.Hour >= ReportHelper.Instance.NightShfitTime.Hours)
            {
                isDay = false;
            }

            string ss     = isDay ? "白班" : "夜班";
            var    curDay = time;

            if (!isCurDay)
            {
                curDay = time.AddDays(-1);
            }

            var sP = $"{ReportHelper.Instance.ReportPath}{curDay.ToString("yyyy-MM-dd")}\\{module}\\{ss}.txt";

            if (File.Exists(sP))
            {
                SerializableHelper <MachineStatistic> szHelper = new SerializableHelper <MachineStatistic>();
                var rep = szHelper.DeJsonSerialize(sP);
                if (rep != null)
                {
                    return(rep);
                }
                else
                {
                    return(new MachineStatistic(DateTime.Now));
                }
            }

            return(new MachineStatistic(DateTime.Now));
        }
        public static bool Load()
        {
            if (!File.Exists(PathDefine.sPathConfigure + "Speed.json"))
            {
                SpeedDefine.Instance.Init();
                return(true);
            }
            SerializableHelper <SpeedDefine> helper = new SerializableHelper <SpeedDefine>();
            var temp = helper.DeJsonSerialize(PathDefine.sPathConfigure + "Speed.json");

            if (temp != null)
            {
                SpeedDefine.Instance = temp;
            }
            else
            {
                return(false);
            }
            return(true);
        }