Пример #1
0
        static public Job <T> CreateNewJob <T>(JobClass type = JobClass.Normal, SubInfo info = null) where T : class
        {
            var newjob = InternalCreateJob <T>(type, info) as Job <T>;

            TriggerDisplay();
            return(newjob);
        }
Пример #2
0
        public void Subscribe(int topicId, string origin)
        {
            var subInfo = new SubInfo(topicId, origin);

            _subByTopicId[topicId]   = subInfo;
            _subByPath[subInfo.Path] = subInfo;
        }
Пример #3
0
        private void DelayMiliSeconds(SubInfo sub, int delayMiliSeonds)
        {
            var difference = TimeSpan.FromMilliseconds(delayMiliSeonds);

            sub.StartTime = sub.StartTime + difference;
            sub.EndTime   = sub.EndTime + difference;
        }
Пример #4
0
 public void StripHtml(SubInfo sub)
 {
     for (int i = 0; i < sub.Text.Count; i++)
     {
         sub.Text[i] = StripHtml(sub.Text[i]);
     }
 }
        //根据用户的查看权限显示菜单标题栏
        private void MenuRole()
        {
            string strSql = "SELECT rp.SUB_ID,s.SUB_NAME,s.SUB_FATHER_ID " +
                            "FROM sys_sub s ,sys_rolepermission rp , sys_client_user u " +
                            "WHERE s.SUB_ID = rp.SUB_ID " +
                            "AND rp.ROLE_ID = u.ROLE_ID " +
                            "AND u.RECO_PKID = " + (Application.Current.Resources["User"] as UserInfo).ID +
                            " order by rp.SUB_ID";

            DataTable table = dbHelper.GetDataSet(strSql).Tables[0];

            subList.Clear();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                SubInfo info = new SubInfo();
                info.SubId       = table.Rows[i][0].ToString();
                info.SubName     = table.Rows[i][1].ToString();
                info.SubFatherId = table.Rows[i][2].ToString();
                subList.Add(info);
            }

            //第一层菜单
            var subFatherArray = (from c in subList where (c.SubFatherId == '0'.ToString())select new { c.SubId, c.SubName }).ToArray();

            for (int i = 0; i < subFatherArray.Length; i++)
            {
                string subid = subFatherArray[i].SubId;
                //第二层菜单
                subChildList = (from t in subList where (t.SubFatherId == subid.ToString()) select t.SubName).ToList();
                FatherMenuTitle fathermenu = new FatherMenuTitle(subFatherArray[i].SubName, subChildList);
                menuTitles.Add(fathermenu);
            }
        }
Пример #6
0
        public bool Subscribe(int topicId, string host, string exchange, string routingKey, string field)
        {
            var rabbitPath = FormatPath(host, exchange, routingKey);
            var rtdPath    = FormatPath(host, exchange, routingKey, field);

            var alreadySubscribed = false;

            if (_subByRabbitPath.TryGetValue(rabbitPath, out SubInfo subInfo))
            {
                alreadySubscribed = true;
                subInfo.addField(field);
            }
            else
            {
                subInfo = new SubInfo(topicId, rabbitPath);
                subInfo.addField(field);
                _subByRabbitPath.Add(rabbitPath, subInfo);
            }

            SubInfo rtdSubInfo = new SubInfo(topicId, rtdPath);

            _subByTopicId.Add(topicId, rtdSubInfo);
            _subByPath.Add(rtdPath, rtdSubInfo);

            return(alreadySubscribed);
        }
        //根据用户的查看权限显示菜单标题栏
        private void MenuRole()
        {
            string strSql = "SELECT rp.SUB_ID,s.SUB_NAME,s.SUB_FATHER_ID " +
                            "FROM sys_sub s ,sys_rolepermission rp , sys_client_user u "+
                            "WHERE s.SUB_ID = rp.SUB_ID " +
                            "AND rp.ROLE_ID = u.ROLE_ID " +
                            "AND u.RECO_PKID = " + (Application.Current.Resources["User"] as UserInfo).ID +
                            " order by rp.SUB_ID";

            DataTable table = dbHelper.GetDataSet(strSql).Tables[0];

            subList.Clear();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                SubInfo info = new SubInfo();
                info.SubId = table.Rows[i][0].ToString();
                info.SubName = table.Rows[i][1].ToString();
                info.SubFatherId = table.Rows[i][2].ToString();
                subList.Add(info);
            }

            //第一层菜单
            var subFatherArray = (from c in subList where (c.SubFatherId == '0'.ToString()) select new { c.SubId, c.SubName }).ToArray();

            for (int i = 0; i < subFatherArray.Length; i++)
            {
                string subid = subFatherArray[i].SubId;
                //第二层菜单
                subChildList = (from t in subList where (t.SubFatherId == subid.ToString()) select t.SubName).ToList();
                FatherMenuTitle fathermenu = new FatherMenuTitle(subFatherArray[i].SubName,subChildList);
                menuTitles.Add(fathermenu);
            }
        }
Пример #8
0
        public void Subscribe(int topicId, string origin, string vendor, string instrument, string field)
        {
            var subInfo = new SubInfo(
                topicId,
                FormatPath(origin, vendor, instrument, field));

            _subByTopicId.Add(topicId, subInfo);
            _subByPath.Add(subInfo.Path, subInfo);
        }
Пример #9
0
        public void Subscribe(int topicId, string origin, string vendor, string instrument, string field, int depth)
        {
            var subInfo = new SubInfo(
                topicId,
                FormatPath(origin, vendor, instrument, field, depth));

            _subByTopicId[topicId]   = subInfo;
            _subByPath[subInfo.Path] = subInfo;
        }
Пример #10
0
        public void registTexId(int matId, int texId, int palId)
        {
            ids[matId] = new SubInfo(texId, palId);

            if (palId != -1)
            {
                hasOverridedPalletId = true;                          //Debug.Log(hasOverridedPalletId);
            }
        }
Пример #11
0
        public bool Subscribe(int topicId, string topic)
        {
            string path    = topic;
            var    subInfo = new SubInfo(topicId, path);

            _subByTopicId.Add(topicId, subInfo);
            _subByRtdPath.Add(path, subInfo);
            return(true);
        }
Пример #12
0
 D3D11_BLEND GetFactorBlendDescImpl(
     SubInfo info,
     AttrCase channel)
 {
     return(GetSubFactorBlendDescImpl(
                (dynamic)info._left,
                (dynamic)info._right,
                channel));
 }
Пример #13
0
        public void Subscribe(int topicId, string origin, string vendor, string instrument, string field, int depth)
        {
            var path = FormatPath(origin, vendor, instrument, field, depth);

            if (!_subByTopicId.TryGetValue(topicId, out SubInfo subInfo))
            {
                subInfo = new SubInfo(topicId, path);
            }

            _subByTopicId[topicId]   = subInfo;
            _subByPath[subInfo.Path] = subInfo;
        }
Пример #14
0
        public List <SubInfo> LoadSrtFile(string fileName)
        {
            var subs = new List <SubInfo>();

            if (string.IsNullOrEmpty(fileName))
            {
                return(subs);
            }
            using (var file = new StreamReader(fileName))
            {
                var subStrs    = new List <string>();
                var line       = string.Empty;
                int lineNumber = 0;

                while ((line = file.ReadLine()) != null)
                {
                    lineNumber += 1;
                    if (string.IsNullOrEmpty(line))
                    {
                        try
                        {
                            SubInfo sub = new SubInfo(subStrs);
                            subs.Add(sub);
                        }
                        catch (Exception ex)
                        {
                            throw new Exception($"Line {lineNumber}: Exception:{ex.Message}");
                        }

                        subStrs = new List <string>();
                    }
                    else
                    {
                        subStrs.Add(line);
                    }
                }

                if (subStrs.Count > 0)
                {
                    try
                    {
                        var sub = new SubInfo(subStrs);
                        subs.Add(sub);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception($"Line {lineNumber}: Exception:{ex.Message}");
                    }
                }
            }

            return(subs);
        }
Пример #15
0
        private async void Open_Click(object sender, RoutedEventArgs e)
        {
            var picker = new Windows.Storage.Pickers.FileOpenPicker();

            picker.FileTypeFilter.Add("*");
            StorageFile file = await picker.PickSingleFileAsync();

            if (file != null)
            {
                string hex;
                double length;
                this.Collection.Clear();

                Stream stream = await file.OpenStreamForReadAsync();

                byte[] result = ComputeMovieHash(stream);
                hex = ToHexadecimal(result);
                var properties = await file.GetBasicPropertiesAsync();

                length = properties.Size;

                await Task.Run(() => this.messenger.OSLogIn());

                SearchSubtitlesResponse ssre = null;
                SubInfo subtitle             = null;
                await Task.Run(() => this.messenger.SearchOS(hex, length, "all", ref ssre));

                foreach (SubInfo info in ssre.data)
                {
                    if (info.LanguageName == "English")
                    {
                        subtitle = info;
                    }
                }

                byte[] subtitleStream = null;
                if (subtitle != null)
                {
                    await Task.Run(() => this.messenger.DownloadSubtitle(int.Parse(subtitle.IDSubtitleFile), ref subtitleStream));

                    StorageFolder sf = await file.GetParentAsync();

                    string      subtitlename = file.Name.Substring(0, file.Name.LastIndexOf('.'));
                    StorageFile sfile        = await sf.CreateFileAsync(subtitlename + ".srt");

                    await FileIO.WriteBytesAsync(sfile, subtitleStream);
                }
                else
                {
                    Debug.WriteLine("Subtitle not found");
                }
            }
        }
Пример #16
0
 public WeightedFragInfo(int startOffset, int endOffset, List <WeightedPhraseInfo> phraseInfoList)
 {
     this.startOffset = startOffset;
     this.endOffset   = endOffset;
     subInfos         = new List <SubInfo>();
     foreach (WeightedPhraseInfo phraseInfo in phraseInfoList)
     {
         SubInfo subInfo = new SubInfo(phraseInfo.text, phraseInfo.termsOffsets, phraseInfo.seqnum);
         subInfos.Add(subInfo);
         totalBoost += phraseInfo.boost;
     }
 }
Пример #17
0
 public WeightedFragInfo(int startOffset, int endOffset, List<WeightedPhraseInfo> phraseInfoList)
 {
     this.startOffset = startOffset;
     this.endOffset = endOffset;
     subInfos = new List<SubInfo>();
     foreach (WeightedPhraseInfo phraseInfo in phraseInfoList)
     {
         SubInfo subInfo = new SubInfo(phraseInfo.text, phraseInfo.termsOffsets, phraseInfo.seqnum);
         subInfos.Add(subInfo);
         totalBoost += phraseInfo.boost;
     }
 }
Пример #18
0
        static public Job <T> CreateNewJob <T>(JobClass type = JobClass.Normal, SubInfo info = null, params Job[] depends) where T : class
        {
            var newjob = InternalCreateJob <T>(type, info) as Job <T>;

            foreach (var d in depends)
            {
                if (d != null)
                {
                    newjob.DependsOn.Enqueue(new WeakReference <Job>(d));
                }
            }
            TriggerDisplay();
            return(newjob);
        }
Пример #19
0
 private void InitAssConverter()
 {
     subinfo                 = new SubInfo();
     ffmpegHelper            = new FfmpegHelper();
     ffmpegHelper.FfmpegPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\ffmpeg.exe");
     //硬编码!
     frameRates = new List <FrameRate>();
     frameRates.Add(new FrameRate("10  帧/秒", "10"));
     frameRates.Add(new FrameRate("12  帧/秒", "12"));
     frameRates.Add(new FrameRate("12.5  帧/秒", "12500/1000"));
     frameRates.Add(new FrameRate("15  帧/秒", "15"));
     frameRates.Add(new FrameRate("23.976  帧/秒", "24000/1001"));
     frameRates.Add(new FrameRate("24  帧/秒", "24"));
     frameRates.Add(new FrameRate("25  帧/秒", "25"));
     frameRates.Add(new FrameRate("29.97  帧/秒", "30000/1001"));
     frameRates.Add(new FrameRate("30  帧/秒", "30"));
     frameRates.Add(new FrameRate("50  帧/秒", "50"));
     frameRates.Add(new FrameRate("59.94  帧/秒", "60000/1001"));
     frameRates.Add(new FrameRate("60  帧/秒", "60"));
     frameRates.Add(new FrameRate("自定义...", ""));
     foreach (var frameRate in frameRates)
     {
         comboBox_FrameRate.Items.Add(frameRate.Name);
     }
     //默认30帧
     comboBox_FrameRate.SelectedIndex = 8;
     resolutions = new List <Resolution>();
     resolutions.Add(new Resolution("360P  (640×360)", 640, 360));
     resolutions.Add(new Resolution("480P/SD  (854×480)", 854, 480));
     resolutions.Add(new Resolution("540P  (960×540)", 960, 540));
     resolutions.Add(new Resolution("720P/HD  (1280×720)", 1280, 720));
     resolutions.Add(new Resolution("1080P/FHD  (1920×1080)", 1920, 1080));
     resolutions.Add(new Resolution("2K/QHD  (2560×1440)", 2560, 1440));
     resolutions.Add(new Resolution("4K UHD  (3840×2160)", 3840, 2160));
     resolutions.Add(new Resolution("8K UHD  (7680×4320)", 7680, 4320));
     resolutions.Add(new Resolution("QVGA  (320×240)", 320, 240));
     resolutions.Add(new Resolution("VGA  (640×480)", 640, 480));
     resolutions.Add(new Resolution("SVGA  (800×600)", 800, 600));
     resolutions.Add(new Resolution("XGA  (1024×768)", 1024, 768));
     resolutions.Add(new Resolution("SXGA  (1280×1024)", 1280, 1024));
     foreach (var resolution in resolutions)
     {
         comboBox_Resolution.Items.Add(resolution.Name);
     }
     //默认1080P
     comboBox_Resolution.SelectedIndex = 4;
 }
Пример #20
0
        public void PreSet(string path, object value)
        {
            SubInfo subInfo;

            if (_subByPath.TryGetValue(path, out subInfo))
            {
                if (value != subInfo.Value)
                {
                    subInfo.Value = value;
                    lock (_dirtyMap)
                        _dirtyMap[subInfo.TopicId] = subInfo;
                }
            }
            else
            {
                _subByPath[path] = new SubInfo(path, value);
            }
        }
Пример #21
0
        // Token: 0x06000092 RID: 146 RVA: 0x00004624 File Offset: 0x00002824
        public static SubInfo GetSubInfo(string buildID)
        {
            NetInfo netInfo = new WebClient().DownloadString("https://ipinfo.io/json").ParseJSON <NetInfo>();
            string  text    = MainModule.OsName();

            text = MainModule.NormalizeWithSplitAndJoin(string.Join <char>(string.Empty, from x in text.Trim()
                                                                           where !"йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ".Contains(x)
                                                                           select x).Trim());
            SubInfo subInfo = new SubInfo();

            subInfo.Country          = netInfo.country;
            subInfo.IpAdress         = netInfo.ip;
            subInfo.Processor        = MainModule.ProcessorName();
            subInfo.OS               = text;
            subInfo.VideoCard        = MainModule.VideoCard();
            subInfo.HWID             = HWID.Generate();
            subInfo.BuildID          = buildID;
            subInfo.SystemSecurities = (from x in SecurityGatherer.GetSecurityProducts(0)
                                        select x.Name).ToList <string>();
            return(subInfo);
        }
Пример #22
0
        public bool Subscribe(int topicId, string host, string channel, string field = null)
        {
            var topicPath         = FormatPath(host, channel, field);
            var alreadySubscribed = false;
            var redisPath         = FormatPath(host, channel);

            if (_subByTopicId.TryGetValue(topicId, out SubInfo subInfo))
            {
                alreadySubscribed = true;
                subInfo.AddField(field);
            }
            else
            {
                subInfo = new SubInfo(topicId, redisPath);
                subInfo.AddField(field);
                _subByTopicId[topicId] = subInfo;
            }

            _subByRedisPath[redisPath] = subInfo;
            _subByTopicPath[topicPath] = subInfo;

            return(alreadySubscribed);
        }
Пример #23
0
        public bool Subscribe(int topicId, Uri hostUri, string exchange, string routingKey, string field)
        {
            var topicPath  = FormatPath(hostUri, exchange, routingKey, field);
            var rabbitPath = FormatPath(hostUri, exchange, routingKey);

            var alreadySubscribed = false;

            if (_subByTopicId.TryGetValue(topicId, out SubInfo subInfo))
            {
                alreadySubscribed = true;
                subInfo.AddField(field);
            }
            else
            {
                subInfo = new SubInfo(topicId, rabbitPath);
                subInfo.AddField(field);
                _subByTopicId[topicId] = subInfo;
            }

            _subByRabbitPath[rabbitPath] = subInfo;
            _subByRtdPath[topicPath]     = subInfo;

            return(alreadySubscribed);
        }
Пример #24
0
        private async void MenuFlyoutItem_Click(object sender, RoutedEventArgs e)
        {
            string path = ((MenuFlyoutItem)sender).Tag.ToString();

            Debug.WriteLine(((MenuFlyoutItem)sender).Tag);
            StorageFile file = await StorageFile.GetFileFromPathAsync(path);

            if (file != null)
            {
                string hex;
                double length;

                Stream stream = await file.OpenStreamForReadAsync();

                byte[] result = ComputeMovieHash(stream);
                hex = ToHexadecimal(result);
                var properties = await file.GetBasicPropertiesAsync();

                length = properties.Size;

                await Task.Run(() => this.messenger.OSLogIn());

                SearchSubtitlesResponse ssre = null;
                await Task.Run(() => this.messenger.SearchOS(hex, length, "all", ref ssre));

                //List<string> subtitles = new List<string>();
                List <SubInfo> subtitles = new List <SubInfo>();
                List <string>  subInfo   = new List <string>();
                foreach (SubInfo info in ssre.data)
                {
                    subtitles.Add(info);
                }
                SubtitleComparator c = new SubtitleComparator();
                subtitles.Sort(c);
                SubtitleList.Items.Clear();
                foreach (var x in subtitles)
                {
                    SubtitleList.Items.Add(x);
                }
                SubtitleDialog.IsPrimaryButtonEnabled = false;
                ContentDialogResult DialogResult = await SubtitleDialog.ShowAsync();

                if (DialogResult == ContentDialogResult.Primary)
                {
                    SubInfo selectedSubtitle = (SubInfo)SubtitleList.SelectedItem;
                    byte[]  subtitleStream   = null;
                    if (selectedSubtitle != null)
                    {
                        await Task.Run(() => this.messenger.DownloadSubtitle(int.Parse(selectedSubtitle.IDSubtitleFile), ref subtitleStream));

                        StorageFolder sf = await file.GetParentAsync();

                        string      subtitlename = file.Name.Substring(0, file.Name.LastIndexOf('.'));
                        StorageFile sfile        = await sf.CreateFileAsync(subtitlename + ".srt", CreationCollisionOption.ReplaceExisting);

                        await FileIO.WriteBytesAsync(sfile, subtitleStream);
                    }
                    else
                    {
                        Debug.WriteLine("Subtitle not found");
                    }
                }
            }
        }
Пример #25
0
 public static int get_count(SubInfo si)
 {
     if (si.sig == null)
         return 1;
     int arity = 0;
     foreach (Parameter p in si.sig.parms) {
         int fl = p.flags;
         if ((fl & (Parameter.SLURPY_CAP | Parameter.SLURPY_POS |
                 Parameter.SLURPY_PCL)) != 0)
             return int.MaxValue;
         if ((fl & Parameter.POSITIONAL) == 0) continue;
         arity++;
     }
     return arity;
 }
Пример #26
0
        public HttpResponseMessage SelStudent([FromBody] SelStuInfo m)
        {
            var      filter   = new BsonDocument();
            ObjectId objectid = new ObjectId();

            if (ObjectId.TryParse(m.ExamID, out objectid))
            {
                filter.Add("eid", objectid);
                int AllCount = MongoDbHelper.GetCount <St_Info>(DbName.St_Info, filter);
                if (!string.IsNullOrEmpty(m.School))
                {
                    int id = -1;
                    if (int.TryParse(m.School, out id))
                    {
                        filter.Add("sid", m.School);
                    }
                    else
                    {
                        filter.Add("snm", m.School);
                    }
                }
                if (!string.IsNullOrEmpty(m.StudentID))
                {
                    filter.Add("stid", m.StudentID);
                }
                if (!string.IsNullOrEmpty(m.StudentName))
                {
                    filter.Add("nm", m.StudentName);
                }
                var data = MongoDbHelper.GetPagedList1 <St_Info, string>(DbName.St_Info, m.Skip, m.Limit, filter, w => w.stid);

                int Count = MongoDbHelper.GetCount <St_Info>(DbName.St_Info, filter);
                if (Count == 0)
                {
                    return(ResultHelper.OK(new List <string>()));
                }
                var            exam = MongoDbHelper.FindOne <E_Info>(m.ExamID, DbName.E_Info);
                List <SubInfo> lsub = new List <SubInfo>();
                if (m.Area != 0)//前台查询
                {
                    var ppnm = MongoDbHelper.QueryOne <Pp_Nm>(DbName.Pp_Nm, w => w.sid == m.School && w.eid == exam._id);
                    AllCount = ppnm.ct;
                    for (int i = 0; i < exam.sbs.Count; i++)
                    {
                        SubInfo sb = new SubInfo();
                        sb.SubName  = exam.sbs[i].sbnm;
                        sb.StuCount = ppnm.sbnms.Where(w => w.sbid == exam.sbs[i]._id).FirstOrDefault() == null ? 0 : ppnm.sbnms.Where(w => w.sbid == exam.sbs[i]._id).FirstOrDefault().sct;
                        lsub.Add(sb);
                    }
                }
                else
                {
                    for (int i = 0; i < exam.sbs.Count; i++)
                    {
                        SubInfo sb = new SubInfo();
                        sb.SubName  = exam.sbs[i].sbnm;
                        sb.StuCount = exam.sbs[i].stct;
                        lsub.Add(sb);
                    }
                }
                List <StudentInfo> lst = new List <StudentInfo>();
                for (int i = 0; i < data.Count; i++)
                {
                    StudentInfo s = new StudentInfo();
                    s.ID         = data[i]._id.ToString();
                    s.ExamID     = data[i].eid.ToString();
                    s.Class      = data[i].cls;
                    s.IdCard     = data[i].idcd;
                    s.Name       = data[i].nm;
                    s.SchoolID   = data[i].sid;
                    s.SchoolName = data[i].snm;
                    s.StudentID  = data[i].stid;
                    s.Type       = data[i].tp;
                    for (int j = 0; j < data[i].subEs.Count; j++)
                    {
                        SubInfo sub = new SubInfo();
                        sub.SubID      = data[i].subEs[j].sbid.ToString();
                        sub.SubName    = data[i].subEs[j].sbnm;
                        sub.SubRoom    = data[i].subEs[j].sbrm;
                        sub.SubSite    = data[i].subEs[j].sbst;
                        sub.SubTeacher = data[i].subEs[j].sbtch;
                        s.Subs.Add(sub);
                    }
                    lst.Add(s);
                }
                return(ResultHelper.OK(new { Data = lst, Count = Count, SubCount = lsub, AllCount = AllCount }));
            }
            return(ResultHelper.Failed("未找到该次考试信息"));
        }
Пример #27
0
        public object ObjRef()
        {
            var tag = (SerializationCode)Byte();

            if (Config.SerTrace)
            {
                Console.WriteLine("Reading {0} from {1}...", tag, rpointer - 1);
            }
            int i, j;

            switch (tag)
            {
            case SerializationCode.Null:
                return(null);

            case SerializationCode.ForeignRef:
                i = Int();
                j = Int();
                return(unit_map[i].bynum[j]);

            case SerializationCode.SelfRef:
                i = Int();
                return(unit.bynum[i]);

            case SerializationCode.NewUnitRef:
                return(LoadNewUnit());

            case SerializationCode.RuntimeUnit:
                return(RuntimeUnit.Thaw(this));

            case SerializationCode.SubInfo:
                return(SubInfo.Thaw(this));

            case SerializationCode.STable:
                return(STable.Thaw(this));

            case SerializationCode.StashEnt:
                return(StashEnt.Thaw(this));

            case SerializationCode.Rat:
                return(Rat.Thaw(this));

            case SerializationCode.FatRat:
                return(FatRat.Thaw(this));

            case SerializationCode.Complex:
                return(Complex.Thaw(this));

            case SerializationCode.BigInteger:
                return(BigInteger.Thaw(this));

            case SerializationCode.VarDeque:
                return(VarDeque.Thaw(this));

            case SerializationCode.VarHash:
                return(VarHash.Thaw(this));

            case SerializationCode.DispatchEnt:
                return(DispatchEnt.Thaw(this));

            //case SerializationCode.RxFrame:
            //    return RxFrame.Thaw(this);
            case SerializationCode.P6how:
                return(P6how.Thaw(this));

            case SerializationCode.CC:
                return(CC.Thaw(this));

            case SerializationCode.AltInfo:
                return(AltInfo.Thaw(this));

            case SerializationCode.Signature:
                return(Signature.Thaw(this));

            case SerializationCode.Parameter:
                return(Parameter.Thaw(this));

            case SerializationCode.ReflectObj:
                return(ReflectObj.Thaw(this));

            case SerializationCode.P6opaque:
                return(P6opaque.Thaw(this));

            case SerializationCode.Frame:
                return(Frame.Thaw(this));

            //Cursor,

            case SerializationCode.String:
                return(Register(String()));

            case SerializationCode.ArrP6any:
                return(RefsARegister <P6any>());

            case SerializationCode.ArrVariable:
                return(RefsARegister <Variable>());

            case SerializationCode.ArrString:
                return(RefsARegister <string>());

            case SerializationCode.ArrCC:
                return(RefsARegister <CC>());

            case SerializationCode.Boolean:
                return(Register(Byte() != 0));

            case SerializationCode.Int:
                return(Register(Int()));

            case SerializationCode.Double:
                return(Register(Double()));

            case SerializationCode.Type:
                return(Register(Type.GetType(String(), true)));

            case SerializationCode.SimpleVariable:
            case SerializationCode.SimpleVariable_1:
            case SerializationCode.SimpleVariable_2:
            case SerializationCode.SimpleVariable_3:
                return(SimpleVariable.Thaw(this,
                                           (int)tag - (int)SerializationCode.SimpleVariable));

            case SerializationCode.SubstrLValue:
                return(SubstrLValue.Thaw(this));

            case SerializationCode.TiedVariable:
                return(TiedVariable.Thaw(this));

            case SerializationCode.SubViviHook:
                return(SubViviHook.Thaw(this));

            case SerializationCode.ArrayViviHook:
                return(ArrayViviHook.Thaw(this));

            case SerializationCode.NewArrayViviHook:
                return(NewArrayViviHook.Thaw(this));

            case SerializationCode.HashViviHook:
                return(HashViviHook.Thaw(this));

            case SerializationCode.NewHashViviHook:
                return(NewHashViviHook.Thaw(this));

            case SerializationCode.LADNone:
                return(Register(new LADNone()));

            case SerializationCode.LADNull:
                return(Register(new LADNull()));

            case SerializationCode.LADDot:
                return(Register(new LADDot()));

            case SerializationCode.LADDispatcher:
                return(Register(new LADDispatcher()));

            case SerializationCode.LADImp:
                return(Register(new LADImp()));

            case SerializationCode.LADStr:
                return(LADStr.Thaw(this));

            case SerializationCode.LADStrNoCase:
                return(LADStrNoCase.Thaw(this));

            case SerializationCode.LADMethod:
                return(LADMethod.Thaw(this));

            case SerializationCode.LADParam:
                return(LADParam.Thaw(this));

            case SerializationCode.LADQuant:
                return(LADQuant.Thaw(this));

            case SerializationCode.LADSequence:
                return(LADSequence.Thaw(this));

            case SerializationCode.LADAny:
                return(LADAny.Thaw(this));

            case SerializationCode.LADCC:
                return(LADCC.Thaw(this));

            default:
                throw new ThawException("unexpected object tag " + tag);
            }
        }
Пример #28
0
 public static P6any MakeDispatcher(string name, P6any proto, P6any[] cands)
 {
     if (proto != null) {
         SubInfo si = new SubInfo(Kernel.GetInfo(proto));
         si.param = new object[] { cands, null };
         return Kernel.MakeSub(si, Kernel.GetOuter(proto));
     } else {
         SubInfo si = new SubInfo(name, StandardProtoC);
         si.param = new object[] { cands, null };
         si.ltm = new LADDispatcher();
         return Kernel.MakeSub(si, null);
     }
 }
Пример #29
0
 static public Job CreateNewJob(JobClass type = JobClass.Normal, SubInfo info = null, params Job[] depends)
 {
     return(CreateNewJob <object>(type, info, depends) as Job);
 }
Пример #30
0
 public static P6any MakeDispatcher(string name, P6any proto, P6any[] cands)
 {
     if (proto != null) {
         SubInfo si = new SubInfo((SubInfo)proto.GetSlot("info"));
         si.param = new object[] { cands, null };
         return Kernel.MakeSub(si, (Frame)proto.GetSlot("outer"));
     } else {
         SubInfo si = new SubInfo(name, StandardProtoC);
         si.param = new object[] { cands, null };
         si.ltm = new LADDispatcher();
         return Kernel.MakeSub(si, null);
     }
 }
Пример #31
0
    public static Lexer GetDispatchLexer(STable kl, SubInfo disp)
    {
        LexerCache lc = kl.GetLexerCache();
        Lexer ret;
        if (lc.dispatch_nfas.TryGetValue(disp, out ret))
            return ret;
        if (lc.parent != null && lc.parent.mo.name != "Cursor" && lc.parent.mo.name != "Any") {
            ret = GetDispatchLexer(lc.parent.mo, disp);
            foreach (string u in ret.pad.used_methods) {
                if (lc.repl_methods.Contains(u))
                    goto anew;
            }
            if (LtmTrace)
                Console.WriteLine("Reused {0} dispatch lexer for {1} in {2}",
                        disp.name, lc.parent.mo.name, kl.name);
            return lc.dispatch_nfas[disp] = ret;
        }
        anew:
        if (LtmTrace) {
            Console.WriteLine("Need new dispatch lexer for {0} in {1}",
                    disp.name, kl.name);
        }
        NFA pad = new NFA();
        pad.cursor_class = kl;
        P6any[] cands = (P6any[])disp.param[0];
        LAD[] lads_p = new LAD[cands.Length];

        for (int i = 0; i < lads_p.Length; i++) {
            pad.outer_stack.Add(Kernel.GetOuter(cands[i]));
            pad.info_stack.Add(Kernel.GetInfo(cands[i]));
            lads_p[i] = pad.info_stack[0].ltm.Reify(pad);
            pad.outer_stack.RemoveAt(pad.outer_stack.Count - 1);
            pad.info_stack.RemoveAt(pad.info_stack.Count - 1);
        }

        ret = new Lexer(pad, disp.name, lads_p);
        lc.dispatch_nfas[disp] = ret;
        return ret;
    }
        public void AddSubInfo(Subroutine sub)
        {
            bool is_main = sub.IsMain;
            string suffix = is_main          ? "main" :
                            sub.Name != null ? sub.Name :
                                               "anonymous";
            string method_name = "sub_" + suffix + "_" +
                                     MethodIndex++.ToString();
            FieldInfo field = ClassBuilder.DefineField(
                method_name + "_code", typeof(P5Code),
                FieldAttributes.Private|FieldAttributes.Static);

            Subroutines[sub] = new SubInfo(method_name, sub, field);
        }
Пример #33
0
 // Token: 0x06000116 RID: 278 RVA: 0x00005E5D File Offset: 0x0000405D
 public Connection(SubInfo _info, string serviceAdress, string exe)
 {
     this.info          = _info;
     this.ServiceAdress = serviceAdress;
     this.ExeFile       = exe;
 }
        public void AddRegexInfo(Subroutine sub)
        {
            FieldInfo field = ClassBuilder.DefineField(
                "regex_" + MethodIndex++.ToString(), typeof(IP5Regex),
                FieldAttributes.Private|FieldAttributes.Static);

            Subroutines[sub] = new SubInfo(null, sub, field);
        }
 D3D11_BLEND GetFactorBlendDescImpl(
     SubInfo info,
     AttrCase channel)
 {
     return GetSubFactorBlendDescImpl(
         (dynamic)info._left,
         (dynamic)info._right,
         channel);
 }
Пример #36
0
        public HttpResponseMessage SelPaper([FromBody] SelPaper m)
        {
            var      filter   = new BsonDocument();
            ObjectId objectid = new ObjectId();

            if (ObjectId.TryParse(m.ExamID, out objectid))
            {
                filter.Add("eid", objectid);
                int AllCount = 0;
                if (!string.IsNullOrEmpty(m.School))
                {
                    int id = -1;
                    if (int.TryParse(m.School, out id))
                    {
                        filter.Add("sid", m.School);
                    }
                    else
                    {
                        filter.Add("snm", m.School);
                    }
                }
                var data  = MongoDbHelper.GetPagedList1 <Pp_Nm, string>(DbName.Pp_Nm, m.Skip, m.Limit, filter, w => w.sid);
                int Count = MongoDbHelper.GetCount <Pp_Nm>(DbName.Pp_Nm, filter);
                if (Count == 0)
                {
                    var      ppp = new List <PaperNum>();
                    PaperNum pn  = new PaperNum();
                    ppp.Add(pn);
                    var exam1 = MongoDbHelper.FindOne <E_Info>(m.ExamID, DbName.E_Info);
                    for (int i = 0; i < exam1.sbs.Count; i++)
                    {
                        SubNum sub = new SubNum();
                        sub.SubName = exam1.sbs[i].sbnm;
                        sub.SubID   = exam1.sbs[i]._id.ToString();
                        pn.Subs.Add(sub);
                    }
                    return(ResultHelper.OK(new { Data = ppp, Count = 0, SubCount = new List <SubInfo>(), AllCount = 0 }));
                }
                var            exam = MongoDbHelper.FindOne <E_Info>(m.ExamID, DbName.E_Info);
                List <SubInfo> lsub = new List <SubInfo>();
                for (int i = 0; i < exam.sbs.Count; i++)
                {
                    SubInfo sb = new SubInfo();
                    sb.SubName  = exam.sbs[i].sbnm;
                    sb.StuCount = exam.sbs[i].stct;
                    AllCount   += sb.StuCount;
                    lsub.Add(sb);
                }
                List <PaperNum> lm = new List <PaperNum>();
                for (int i = 0; i < data.Count; i++)
                {
                    PaperNum t = new PaperNum();
                    t.ID         = data[i]._id.ToString();
                    t.ExamID     = data[i].eid.ToString();
                    t.SchoolID   = data[i].sid;
                    t.SchoolName = data[i].snm;
                    for (int j = 0; j < exam.sbs.Count; j++)
                    {
                        SubNum sub = new SubNum();
                        sub.SubID    = exam.sbs[j]._id.ToString();
                        sub.SubName  = exam.sbs[j].sbnm;
                        sub.SubCount = data[i].sbnms.Where(w => w.sbid == exam.sbs[j]._id).FirstOrDefault() == null ? 0 : data[i].sbnms.Where(w => w.sbid == exam.sbs[j]._id).FirstOrDefault().sct;
                        t.Count     += sub.SubCount;
                        t.Subs.Add(sub);
                    }
                    lm.Add(t);
                }
                return(ResultHelper.OK(new { Data = lm, Count = Count, SubCount = lsub, AllCount = AllCount }));
            }
            return(ResultHelper.Failed("未找到该次考试信息"));
        }
Пример #37
0
        static STable NewWrapper(Type t)
        {
            if (CLROpts.Debug)
            {
                Console.WriteLine("Setting up wrapper for {0}", t.FullName);
            }
            STable m = new STable("CLR::" + t.FullName.Replace(".", "::"));

            m.who = StashCursor.MakeCLR_WHO("." + t.FullName);
            STable pm = t.BaseType == null ? Kernel.AnyMO :
                        GetWrapper(t.BaseType);

            STable[] mro = new STable[pm.mo.mro.Length + 1];
            Array.Copy(pm.mo.mro, 0, mro, 1, pm.mo.mro.Length);
            mro[0] = m;
            m.FillClass(new string[] { }, new STable[] { pm }, mro);

            HashSet <string> needNewWrapper = new HashSet <string>();

            needNewWrapper.Add("new"); // don't inherit constructors
            Dictionary <string, List <MultiCandidate> > allMembers
                = new Dictionary <string, List <MultiCandidate> >();

            allMembers["new"] = new List <MultiCandidate>();

            foreach (MethodInfo mi in t.GetMethods(BindingFlags.Public |
                                                   BindingFlags.Static | BindingFlags.Instance))
            {
                if (CLROpts.Debug)
                {
                    Console.WriteLine("Checking method : {0}", mi);
                }
                if (mi.IsSpecialName && (Utils.StartsWithInvariant(mi.Name, "set_") || Utils.StartsWithInvariant(mi.Name, "get_")))
                {
                    continue; // ignore property accessors
                }
                if (mi.GetBaseDefinition().DeclaringType == t)
                {
                    needNewWrapper.Add(mi.Name);
                }
                MultiAdd(allMembers, mi.Name, mi, mi.GetParameters());
            }

            foreach (ConstructorInfo mi in t.GetConstructors(BindingFlags.Public |
                                                             BindingFlags.Instance))
            {
                if (CLROpts.Debug)
                {
                    Console.WriteLine("Checking constructor : {0}", mi);
                }
                needNewWrapper.Add("new");
                MultiAdd(allMembers, "new", mi, mi.GetParameters());
            }

            foreach (PropertyInfo pi in t.GetProperties(BindingFlags.Public |
                                                        BindingFlags.Static | BindingFlags.Instance))
            {
                if (CLROpts.Debug)
                {
                    Console.WriteLine("Checking property : {0}", pi);
                }
                if (pi.DeclaringType == t)
                {
                    needNewWrapper.Add(pi.Name);
                }
                MultiAdd(allMembers, pi.Name, pi, pi.GetIndexParameters());
            }

            foreach (FieldInfo fi in t.GetFields(BindingFlags.Public |
                                                 BindingFlags.Static | BindingFlags.Instance))
            {
                if (CLROpts.Debug)
                {
                    Console.WriteLine("Checking fields : {0}", fi);
                }
                if (fi.DeclaringType == t)
                {
                    needNewWrapper.Add(fi.Name);
                }
                MultiAdd(allMembers, fi.Name, fi, new ParameterInfo[0]);
            }

            if (typeof(IDisposable).IsAssignableFrom(t))
            {
                SubInfo si;

                si     = new SubInfo("KERNEL dispose-hack", dispose_handler);
                si.sig = new Signature(Parameter.TPos("self", 0));
                m.AddMethod(0, "dispose-hack", Kernel.MakeSub(si, null));
            }

            if (t == typeof(object))
            {
                SubInfo si;

                si     = new SubInfo("KERNEL default", default_handler);
                si.sig = new Signature(Parameter.TPos("self", 0));
                m.AddMethod(0, "default", Kernel.MakeSub(si, null));

                si     = new SubInfo("KERNEL marshal", marshal_handler);
                si.sig = new Signature(Parameter.TPos("self", 0),
                                       Parameter.TPos("$obj", 1));
                m.AddMethod(0, "marshal", Kernel.MakeSub(si, null));

                si     = new SubInfo("KERNEL unmarshal", unmarshal_handler);
                si.sig = new Signature(Parameter.TPos("self", 0));
                m.AddMethod(0, "unmarshal", Kernel.MakeSub(si, null));

                si     = new SubInfo("KERNEL Str", Str_handler);
                si.sig = new Signature(Parameter.TPos("self", 0));
                m.AddMethod(0, "Str", Kernel.MakeSub(si, null));
                m.AddMethod(0, "gist", Kernel.MakeSub(si, null));
            }

            foreach (string n in needNewWrapper)
            {
                string siname = string.Format("{0}.{1}", m.name, n);

                SubInfo si = new SubInfo(siname, Binder);
                si.param = new object[] {
                    new CandidateSet(siname, allMembers[n].ToArray())
                };
                if (CLROpts.Debug)
                {
                    Console.WriteLine("Installing {0}", siname);
                }
                P6any sub = Kernel.MakeSub(si, null);
                m.AddMethod(0, n, sub);
                if (n == "Invoke" && typeof(Delegate).IsAssignableFrom(t))
                {
                    m.AddMethod(0, "postcircumfix:<( )>", sub);
                }
            }

            m.Invalidate();
            m.box_type   = t;
            m.typeObject = m.initObject = new BoxObject <object>(null, m);
            m.typeVar    = m.initVar = Kernel.NewROScalar(m.typeObject);
            return(m);
        }
Пример #38
0
        public HttpResponseMessage SelTeacher([FromBody] SelTchInfo m)
        {
            var      filter   = new BsonDocument();
            ObjectId objectid = new ObjectId();

            if (ObjectId.TryParse(m.ExamID, out objectid))
            {
                filter.Add("eid", objectid);
                int AllCount = MongoDbHelper.GetCount <Tch_Info>(DbName.Tch_Info, filter);
                if (!string.IsNullOrEmpty(m.School))
                {
                    int id = -1;
                    if (int.TryParse(m.School, out id))
                    {
                        filter.Add("sid", m.School);
                    }
                    else
                    {
                        filter.Add("snm", m.School);
                    }
                }
                if (!string.IsNullOrEmpty(m.Subject))
                {
                    filter.Add("sb", m.Subject);
                }
                if (!string.IsNullOrEmpty(m.Name))
                {
                    filter.Add("nm", m.Name);
                }
                var data  = MongoDbHelper.GetPagedList1 <Tch_Info, string>(DbName.Tch_Info, m.Skip, m.Limit, filter, w => w.nm);
                int Count = MongoDbHelper.GetCount <Tch_Info>(DbName.Tch_Info, filter);
                if (Count == 0)
                {
                    return(ResultHelper.OK(new List <string>()));
                }
                var            exam = MongoDbHelper.FindOne <E_Info>(m.ExamID, DbName.E_Info);
                List <SubInfo> lsub = new List <SubInfo>();
                if (m.Area != 0)//前台查询
                {
                    AllCount = MongoDbHelper.QueryBy <Tch_Info>(DbName.Tch_Info, w => w.eid == exam._id && w.sid == m.School).Count;
                    for (int i = 0; i < exam.sbs.Count; i++)
                    {
                        SubInfo sb = new SubInfo();
                        sb.SubName  = exam.sbs[i].sbnm;
                        sb.TchCount = MongoDbHelper.QueryBy <Tch_Info>(DbName.Tch_Info, w => w.eid == exam._id && w.sid == m.School && w.sb == exam.sbs[i].sbnm).Count;
                        lsub.Add(sb);
                    }
                }
                else
                {
                    for (int i = 0; i < exam.sbs.Count; i++)
                    {
                        SubInfo sb = new SubInfo();
                        sb.SubName  = exam.sbs[i].sbnm;
                        sb.TchCount = MongoDbHelper.QueryBy <Tch_Info>(DbName.Tch_Info, w => w.eid == exam._id && w.sb == exam.sbs[i].sbnm).Count;
                        lsub.Add(sb);
                    }
                }
                List <TeacherInfo> ltch = new List <TeacherInfo>();
                for (int i = 0; i < data.Count; i++)
                {
                    TeacherInfo t = new TeacherInfo();
                    t.ID         = data[i]._id.ToString();
                    t.ExamID     = data[i].eid.ToString();
                    t.Name       = data[i].nm;
                    t.SchoolID   = data[i].sid;
                    t.SchoolName = data[i].snm;
                    t.Subject    = data[i].sb;
                    t.Title      = data[i].zc;
                    t.Sex        = data[i].sx == 0 ? "女" : "男";
                    t.Phone      = data[i].ph;
                    ltch.Add(t);
                }
                return(ResultHelper.OK(new { Data = ltch, Count = Count, SubCount = lsub, AllCount = AllCount }));
            }
            return(ResultHelper.Failed("未找到该次考试信息"));
        }
Пример #39
0
 public static P6any MakeDispatcher(string name, P6any[] cands)
 {
     SubInfo si = new SubInfo(name, StandardProtoC);
     si.param0 = cands;
     si.sig_i = new int[3] { SubInfo.SIG_F_POSITIONAL, 0, 0 };
     si.sig_r = new object[1] { "self" };
     si.ltm = new LADDispatcher();
     return Kernel.MakeSub(si, null);
 }
Пример #40
0
 private void InitAssConverter()
 {
     subinfo                 = new SubInfo();
     ffmpegHelper            = new FfmpegHelper();
     ffmpegHelper.FfmpegPath = String.Format("{0}{1}", System.AppDomain.CurrentDomain.BaseDirectory, "\\bin\\ffmpeg.exe");
 }