Exemplo n.º 1
0
        //重新设置 trial info 信息
        private void btInfoModify_Click(object sender, EventArgs e)
        {
            FmWriteInfo fm = new FmWriteInfo(false, service, ref trialInfo, isNewUpld);

            if (fm.ShowDialog() == DialogResult.OK)
            {
                labActivator.Text = trialInfo.Activator;
                labOperator.Text  = trialInfo.Operator;
                labPltfm.Text     = trialInfo.Pltfm;
                labPdct.Text      = trialInfo.Pdct;
                labInfo.Text      = trialInfo.Info;
                labOther.Text     = trialInfo.Other;
                groupInfo.Visible = true;
            }
            else
            {
                groupInfo.Visible = false;
            }
        }
Exemplo n.º 2
0
        private void btBrowser_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dia = new FolderBrowserDialog();

            if (dia.ShowDialog() == DialogResult.OK)
            {
                upldPath       = dia.SelectedPath;
                txtFolder.Text = upldPath;

                int checkUpldDirCode = 0;
                if (FileHandle.checkUpldDir(upldPath, ref checkUpldDirCode))
                {
                    #region 检查upldhist.hist
                    FileInfo histFile = new FileInfo(upldPath + "\\.upldhist.hist");
                    if (histFile.Exists)
                    {
                        isNewUpld = false; //不是新的上传
                        using (FileStream fs = new FileStream(histFile.FullName, FileMode.Open))
                        {
                            using (StreamReader sr = new StreamReader(fs))
                            {
                                string line = "";
                                while ((line = sr.ReadLine()) != null)
                                {
                                    if (line.StartsWith("token="))
                                    {
                                        upldHistStr = line.Split('=')[1];
                                    }
                                    if (line.StartsWith("pltfmpdct="))
                                    {
                                        pltfmpdctStr = line.Split('=')[1];
                                    }
                                }
                            }
                        }
                        //处理upldHistStr 还原出真实信息
                        if (!upldHistStr.Equals("")) // userid_datestring
                        {
                            try
                            {
                                upldHistStr         = EnDeCode.decode(upldHistStr);
                                trialInfo.Activator = upldHistStr.Split('_')[0];
                                trialInfo.Unique    = upldHistStr;
                            }
                            catch (Exception ex)
                            {
                                isNewUpld = true;
                                MyLogger.WriteLine(ex.Message);
                            }
                        }
                        else //
                        {
                            isNewUpld = true;
                        }

                        if (!pltfmpdctStr.Equals(""))
                        {
                            trialInfo.Pltfm = pltfmpdctStr.Split('_')[0];
                            trialInfo.Pdct  = pltfmpdctStr.Split('_')[1];
                        }
                        else
                        {
                            isNewUpld = true;
                        }
                    }
                    #endregion

                    //填写Trial info
                    FmWriteInfo fm = new FmWriteInfo(false, service, ref trialInfo, isNewUpld);
                    if (fm.ShowDialog() == DialogResult.OK)
                    {
                        labActivator.Text = trialInfo.Activator;
                        labOperator.Text  = trialInfo.Operator;
                        labPltfm.Text     = trialInfo.Pltfm;
                        labPdct.Text      = trialInfo.Pdct;
                        labInfo.Text      = trialInfo.Info;
                        labOther.Text     = trialInfo.Other;
                        groupInfo.Visible = true;
                    }
                    else
                    {
                        txtFolder.Text    = "";
                        groupInfo.Visible = false;
                    }
                }
                else
                {
                    txtFolder.Text = "";
                    MessageBox.Show("upload dir error:\r\n" + ContantInfo.UpldDir.upldDirErrDict[checkUpldDirCode], "message");
                }
            }
            else
            {
                MyLogger.WriteLine("Upload Canceld !");
            }
        }