コード例 #1
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        public static void GenShelfNumber(InInfo inInfo, ref OutInfo outInfo)
        {
            //总卷数在第一次点击“生成排架号按纽”后确定,以后不再修改。
            if (g_isFirst == false)
            {
                g_isFirst     = true;
                g_totalVolume = inInfo.totalVolume;
            }
            g_isFilled = false; //add 20090921
            if (inInfo.remainWidth >= inInfo.totalWidth)
            {
                GenWithAdequateSpace(inInfo, ref outInfo);
            }
            else    //当前层剩余宽度不够装完所有案卷
            {
                GenWithInadquateSpace(inInfo, ref outInfo);
            }

            int num;

            if (outInfo.errorMsg != null)
            {
                num = outInfo.s.Length - GenNumber.g_midInfo.totalVolume;
                CombineString(outInfo.s, num);
            }
            else
            {
                num = outInfo.s.Length;
                CombineString(outInfo.s, num);
            }
        }
コード例 #2
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        public static bool g_isFilled;    //add 20090921 标识是否已经填充了中间字符串
        #endregion


        private static void GenWithAdequateSpace(InInfo inInfo, ref OutInfo outInfo)
        {
            for (int i = 0; i < inInfo.totalVolume; i++)
            {
                //获取当前排架号的第七、八位数值即个位数与十位数
                int curSingle = Convert.ToInt32(inInfo.curPaiJiaHao.Substring(7, 1));
                int curTen    = Convert.ToInt32(inInfo.curPaiJiaHao.Substring(6, 1));

                //计算新号的个位和十位数值
                int newSingle = (i + 1) % 10 + curSingle;
                int newTen    = (i + 1) / 10 + curTen;
                newTen   += newSingle / 10;
                newSingle = newSingle % 10;

                //向返回字符串中加入起始排号的前六位

                outInfo.s[i + outInfo.changeDraIndex].Append(inInfo.curPaiJiaHao.Substring(0, 6));
                //加入第七位与第八位构成完整的八位排架号
                outInfo.s[i + outInfo.changeDraIndex].Append(Convert.ToString(newTen));
                outInfo.s[i + outInfo.changeDraIndex].Append(Convert.ToString(newSingle));
            }

            //返回除排架号外的额外信息
            g_drawerNum   = Convert.ToInt32(inInfo.curPaiJiaHao.Substring(5, 1));
            g_remainWidth = inInfo.remainWidth - inInfo.totalWidth;
        }
コード例 #3
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        private static void ArrangeArray(InInfo inInfo, ref OutInfo outInfo, int[] array)
        {
            string[] sTemp1 = inInfo.totalMix.Split(',');
            foreach (string s in sTemp1)
            {
                string[] sTemp2 = s.Split('*');

                switch (Int32.Parse(sTemp2[0]))
                {
                case 1:
                    FillInArray(array, Int32.Parse(sTemp2[1]), inInfo.totalVolume, 1);
                    break;

                case 2:
                    FillInArray(array, Int32.Parse(sTemp2[1]), inInfo.totalVolume, 2);
                    break;

                case 3:
                    FillInArray(array, Int32.Parse(sTemp2[1]), inInfo.totalVolume, 3);
                    break;

                case 4:
                    FillInArray(array, Int32.Parse(sTemp2[1]), inInfo.totalVolume, 4);
                    break;

                case 5:
                    FillInArray(array, Int32.Parse(sTemp2[1]), inInfo.totalVolume, 5);
                    break;
                }
            }
        }
コード例 #4
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        private static void ArrangeOrder(InInfo inInfo, ref OutInfo outInfo)
        {
            string[] sTemp1 = inInfo.totalMix.Split(',');
            foreach (string s in sTemp1)
            {
                string[] sTemp2 = s.Split('*');

                switch (Int32.Parse(sTemp2[0]))
                {
                case 1:
                    AttachDetailInfo(outInfo.s, Int32.Parse(sTemp2[1]), inInfo.totalVolume, "1");
                    break;

                case 2:
                    AttachDetailInfo(outInfo.s, Int32.Parse(sTemp2[1]), inInfo.totalVolume, "2");
                    break;

                case 3:
                    AttachDetailInfo(outInfo.s, Int32.Parse(sTemp2[1]), inInfo.totalVolume, "3");
                    break;

                case 4:
                    AttachDetailInfo(outInfo.s, Int32.Parse(sTemp2[1]), inInfo.totalVolume, "4");
                    break;

                case 5:
                    AttachDetailInfo(outInfo.s, Int32.Parse(sTemp2[1]), inInfo.totalVolume, "5");
                    break;
                }
            }
        }
コード例 #5
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        private static void CaculateNewInfo(InInfo info, ref InInfo newInfo, int[] array, int index, int usedSumWidth)
        {//
            newInfo.drawerWidth  = info.drawerWidth;
            newInfo.remainWidth  = info.drawerWidth;
            newInfo.totalVolume  = info.totalVolume - (index + 1);
            newInfo.totalWidth   = info.totalWidth - usedSumWidth;
            newInfo.maxDrawerNum = info.maxDrawerNum;
            newInfo.curPaiJiaHao = info.curPaiJiaHao.Substring(0, 5) + (Convert.ToInt32(info.curPaiJiaHao.Substring(5, 1)) + 1).ToString() + "00";
            //计算新的信息字符串(中间数据)
            StringBuilder s       = new StringBuilder();
            int           temp    = array[index + 1];
            int           counter = 1;

            s.Append(Convert.ToString(temp));
            s.Append("*");
            if ((index + 1) == (array.Length - 1))
            {
                s.Append(Convert.ToString(counter));
            }

            for (int i = index + 2; i < array.Length; i++)
            {
                if (temp != array[i])
                {
                    s.Append(Convert.ToString(counter));
                    s.Append(",");
                    temp = array[i];
                    s.Append(Convert.ToString(array[i]));
                    s.Append("*");
                    counter = 1;
                    //add by niutianbo,date:20090924
                    if (i == array.Length - 1)
                    {
                        s.Append(Convert.ToString(counter));
                    }
                }
                else
                {
                    counter++;
                    if (i == array.Length - 1)
                    {
                        s.Append(Convert.ToString(counter));
                    }
                }
            }

            //新字符串totalMix 的结果
            newInfo.totalMix = s.ToString();
        }
コード例 #6
0
        public static void Edge_Draw_Postfix(object __instance)
        {
            object origin = InInfo.GetValue(__instance);

            if (origin != null && ResearchNodesCache.Values.Contains(origin))
            {
                object  next    = OutInfo.GetValue(__instance);
                Vector2 fauxPos = (Vector2)RightInfo.GetValue(origin);
                fauxPos.y -= 2;
                fauxPos   -= push;
                Vector2 size   = new Vector2(push.x, 4f);
                var     line   = new Rect(fauxPos, size);
                Color   backup = GUI.color;
                GUI.color = AltRPal ? (Color)InEdgeColorInfo.Invoke(next, new object[] { InResearchInfo.Invoke(__instance, new object[] { }) }) : (Color)EdgeColorInfo.GetValue(next);
                GUI.DrawTexture(line, ResearchTree_Assets.EW);
                GUI.color = backup;
            }
        }
コード例 #7
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        public static void PreNeed(ref InInfo inInfo, ref OutInfo outInfo)
        {
            inInfo.totalVolume = 0;
            inInfo.totalWidth  = 0;

            //计算案卷的总卷数和总宽度
            string[] sTemp1 = inInfo.totalMix.Split(',');
            foreach (string s in sTemp1)
            {
                string[] sTemp2 = s.Split('*');
                inInfo.totalVolume += Int32.Parse(sTemp2[1]);
                inInfo.totalWidth  += Int32.Parse(sTemp2[0]) * Int32.Parse(sTemp2[1]);
            }
            //根据总卷数定义返回信息字符串的维度
            outInfo.s = new StringBuilder[inInfo.totalVolume];

            //安排次序---给每个字符串预先加入信息 , 如 "二厘米-----"
            ArrangeOrder(inInfo, ref outInfo);
        }
コード例 #8
0
 public override int GetHashCode()
 {
     return(this.GetType().FullName.GetHashCode() ^ InInfo.GetHashCode() ^ OutInfo.GetHashCode());
 }
コード例 #9
0
 public bool Equals(VideoMetaTransform other)
 {
     return(true && InInfo.Equals(other.InInfo) && OutInfo.Equals(other.OutInfo));
 }
コード例 #10
0
        public OutInfo GetHtml(InInfo ininfo)
        {
            var hch = new HttpClientHandler
            {
                Proxy                  = new WebProxy(),
                UseProxy               = false,
                AllowAutoRedirect      = false,
                UseCookies             = true,
                AutomaticDecompression = DecompressionMethods.GZip
            };
            var outinfo = new OutInfo();
            var hr      = new HttpRequestMessage();

            hr.RequestUri = new Uri(ininfo.Url);

            var httphandler = ininfo.HttpHandler ?? hch;

            if (ininfo.Cookie != null && ininfo.Cookie.Count > 0)
            {
                ininfo.Cookie.ForEach(x =>
                {
                    var ckas = x.Split(';');
                    string cka;
                    if (ckas.Length == 1)
                    {
                        cka = ckas[0] + ";Path=/";
                    }
                    else
                    {
                        cka = string.Join(";", ckas);
                    }
                    httphandler.CookieContainer.SetCookies(new Uri(ininfo.Url), cka);
                });
            }

            var hc = new HttpClient(httphandler);

            //hc.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("*/*"));
            if (string.IsNullOrWhiteSpace(ininfo.UserAgent))
            {
                ininfo.UserAgent = "Jakarta Commons-HttpClient/3.1";
            }
            try
            {
                hc.DefaultRequestHeaders.UserAgent.ParseAdd(ininfo.UserAgent.Replace("/DKKJ_TOWER_1.0 DKKJ_TOWER_1.0", ""));
            }
            catch
            {
                hc.DefaultRequestHeaders.UserAgent.ParseAdd(
                    "Mozilla/5.0 (Linux; Android 7.0; KNT-AL10 Build/HUAWEIKNT-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36");
            }



            if (ininfo.RequestHeaders != null)
            {
                foreach (var entry in ininfo.RequestHeaders)
                {
                    if (entry.Key.ToLower() == "authorization")
                    {
                        hc.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", entry.Value);
                    }
                    if (entry.Key.ToLower() == "user-agent" || entry.Key.ToLower() == "content-length" || entry.Key.ToLower() == "content-type" || entry.Key.ToLower() == "authorization")
                    {
                        continue;
                    }
                    try
                    {
                        hc.DefaultRequestHeaders.Add(entry.Key, entry.Value);
                    }
                    catch
                    {
                        //hc.DefaultRequestHeaders.Add(entry.Key,
                        //    "Mozilla/5.0 (Linux; Android 7.0; KNT-AL10 Build/HUAWEIKNT-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/59.0.3071.125 Mobile Safari/537.36");
                    }
                }
            }
            hc.DefaultRequestHeaders.ExpectContinue = false;

            ininfo.Timeout = ininfo.Timeout == 0 ? 15000 : ininfo.Timeout;
            hc.Timeout     = DateTime.Now.AddMilliseconds(ininfo.Timeout) - DateTime.Now;
            Task <HttpResponseMessage> tres = null;
            HttpContent postDataTemp        = null;

            try
            {
                if (ininfo.RequestType == RequestType.Post)
                {
                    //ininfo.PostData = new StringContent(ininfo.PostDataString);
                    //ininfo.PostData.Headers.ContentType = ininfo.ContentTypeObj;

                    HttpContent postdata = new StringContent(ininfo.PostDataString);
                    postdata.Headers.ContentType = ininfo.ContentTypeObj;
                    tres = hc.PostAsync(hr.RequestUri, postdata);
                }
                else
                {
                    tres = hc.SendAsync(hr);
                }
            }
            catch (Exception ee)
            {
                outinfo.Result = ee + "-发送错误";
            }
            if (ininfo.TaskType == TaskType.Sync)
            {
                try
                {
                    if (tres != null)
                    {
                        var res = tres.Result;
                        outinfo.StatusCode = res.StatusCode;
                        if (res.StatusCode == HttpStatusCode.OK)
                        {
                            switch (ininfo.OutType)
                            {
                            case OutType.OutString:
                                outinfo.Result = res.Content.ReadAsStringAsync().Result;
                                break;

                            case OutType.OutByte:
                                outinfo.Result = res.Content.ReadAsByteArrayAsync().Result;
                                break;

                            case OutType.OutStream:
                                outinfo.Result = res.Content.ReadAsStreamAsync().Result;
                                break;
                            }
                        }
                        outinfo.Headers = res.Headers;
                        try
                        {
                            outinfo.Cookie = res.Headers.GetValues("Set-Cookie").ToList();
                        }
                        catch
                        {
                            // ignored
                        }
                    }
                }
                catch (Exception ee)
                {
                    outinfo.Result = ee + "-接收错误";
                }
            }
            ininfo.PostData = postDataTemp;
            return(outinfo);
        }
コード例 #11
0
ファイル: GenNumber.cs プロジェクト: LvMingss/test1
        private static void GenWithInadquateSpace(InInfo inInfo, ref OutInfo outInfo)
        {
            //以输入的字符串的顺序把案卷厚度装入数组array中
            int[] array = new int[inInfo.totalVolume];
            ArrangeArray(inInfo, ref outInfo, array);

            //查找当前层剩余宽度能装到第几份案卷
            int sum   = 0;
            int index = 0;

            for (int i = 0; i < inInfo.totalVolume; i++)
            {
                sum += array[i];
                if (sum > inInfo.remainWidth)
                {
                    index = i - 1;
                    sum  -= array[i];
                    break;
                }
            }
            //本抽屉不足以放宽度最小的,下移一个抽屉
            if (index == -1)
            {
                InInfo newInfo = new InInfo();
                newInfo = inInfo;
                //重新计算起始排架号
                newInfo.curPaiJiaHao = inInfo.curPaiJiaHao.Substring(0, 5) + (Convert.ToInt32(inInfo.curPaiJiaHao.Substring(5, 1)) + 1).ToString() + "00";
                if (Convert.ToInt32(newInfo.curPaiJiaHao.Substring(5, 1)) > inInfo.maxDrawerNum) //modify 20090831
                {
                    outInfo.errorMsg = "此柜已满,请换下一柜。";
                    return;
                }
                else
                {
                    newInfo.remainWidth = inInfo.drawerWidth;
                    GenShelfNumber(newInfo, ref outInfo);
                }
            }
            //本抽屉至少能放一个宽度最小的
            else
            {
                for (int i = 0; i <= index; i++)
                {
                    //获取当前排架号的第七、八位数值即个位数与十位数
                    int curSingle = Convert.ToInt32(inInfo.curPaiJiaHao.Substring(7, 1));
                    int curTen    = Convert.ToInt32(inInfo.curPaiJiaHao.Substring(6, 1));

                    //计算新号的个位和十位数值
                    int newSingle = (i + 1) % 10 + curSingle;
                    int newTen    = (i + 1) / 10 + curTen;
                    newTen   += newSingle / 10;
                    newSingle = newSingle % 10;

                    //向返回字符串中加入起始排号的前六位
                    outInfo.s[i + outInfo.changeDraIndex].Append(inInfo.curPaiJiaHao.Substring(0, 6));
                    //加入第七位与第八位构成完整的八位排架号
                    outInfo.s[i + outInfo.changeDraIndex].Append(Convert.ToString(newTen));
                    outInfo.s[i + outInfo.changeDraIndex].Append(Convert.ToString(newSingle));
                }
                InInfo newInfo = new InInfo();
                CaculateNewInfo(inInfo, ref newInfo, array, index, sum);
                if (Convert.ToInt32(newInfo.curPaiJiaHao.Substring(5, 1)) > inInfo.maxDrawerNum) //modify 20090831
                {
                    outInfo.errorMsg      = "此柜已满,请换下一柜。";
                    g_midInfo.totalVolume = inInfo.totalVolume - (index + 1); //modify 20090831 --换柜子后的中间信息
                    g_midInfo.totalMix    = newInfo.totalMix;
                    g_isChangeCab         = true;
                    return;
                }
                else
                {
                    outInfo.changeDraIndex += index + 1;
                    GenShelfNumber(newInfo, ref outInfo);
                }
            }
        }
コード例 #12
0
        public InInfo GetinInfoBySession(SessionTemp oS)
        {
            var headers = oS.headers;
            var fullUrl = oS.fullUrl;
            var body    = oS.body;
            var inInfo  = new InInfo();

            inInfo.RequestType    = RequestType.Post;
            inInfo.Url            = fullUrl;
            inInfo.PostData       = new StringContent(body);
            inInfo.PostDataString = body;
            foreach (var header in headers)
            {
                var hName  = header.Key;
                var hValue = header.Value;
                //AddTXT(hname);
                inInfo.RequestHeaders = headers;
                switch (hName)
                {
                case "Connection":
                    //inInfo.
                    break;


                case "Content-Length":

                    break;


                case "Pragma":

                    break;


                case "Cache-Control":

                    break;


                case "Accep":

                    break;


                case "Origin":

                    break;


                case "X-Requested-With":

                    break;


                case "User-Agent":
                    inInfo.UserAgent = hValue;
                    break;


                case "Content-Type":
                case "content-type":

                    try
                    {
                        var contentTypes       = hValue.Split(';');
                        var contentTypeValue   = contentTypes.FirstOrDefault(x => x.Contains("/"));
                        var contentTypeCharSet = contentTypes.FirstOrDefault(x => x.Contains("charset="));


                        var contenttype = MediaTypeHeaderValue.Parse(contentTypeValue);
                        if (contentTypeCharSet != null)
                        {
                            contenttype.CharSet = contentTypeCharSet.Replace("charset=", "");
                        }
                        else
                        {
                            contenttype.CharSet = "UTF-8";
                        }
                        inInfo.ContentTypeObj = contenttype;
                        inInfo.PostData.Headers.ContentType = contenttype;
                    }
                    catch
                    {
                        //inInfo.PostData.Headers.ContentType =
                        //MediaTypeHeaderValue.Parse("application/x-www-form-urlencoded");
                        //inInfo.PostData.Headers.ContentType.CharSet = "UTF-8";

                        var contenttype = MediaTypeHeaderValue.Parse("application/x-www-form-urlencoded");
                        contenttype.CharSet   = "UTF-8";
                        inInfo.ContentTypeObj = contenttype;

                        inInfo.PostData.Headers.ContentType = contenttype;
                    }
                    break;


                case "Referer":

                    break;


                case "Accept-Encoding":

                    break;


                case "Accept-Language":

                    break;


                case "Cookie":
                case "cookie":
                    inInfo.Cookie = hValue.Split(';').ToList();
                    break;
                }
            }
            return(inInfo);
        }
コード例 #13
0
        private static void AddCellInQty(this CellInProfile profile, DateTime matTime, int matQty, ShopInTarget inTarget)
        {
            InInfo info = CreateHelper.CreateInInfo(profile, matTime, matQty, inTarget);

            AddInfo(profile.CellInfos, info);
        }