Exemplo n.º 1
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 protected void BindData()
 {
     MaxTime = DateTime.MinValue;
     ///选择所筛选的所有软件
     for (int softid = 0; softid < SelectedSofts.Count; softid++)
     {
         Soft SingleSoftInfo = SelectedSofts[softid];
         for (int i = 0; i < SelectedPlatforms.Count; i++)
         {
             foreach (MobileOption tempplat in SingleSoftInfo.Platforms)
             {
                 ///他选出的平台加上和自己支持平台的交集
                 if (tempplat == SelectedPlatforms[i] || SelectedPlatforms[i] == 0)
                 {
                     List <SoftUser> users = null;
                     users = Sjqd_StatUsersService.GetInstance().GetSoftUserListCache(BeginTime, EndTime, SingleSoftInfo.ID, (int)SelectedPlatforms[i], Period, loginService, CacheTimeOption.TenMinutes).OrderBy(p => p.StatDate)
                             .Where(p => p.LostNum != -1).ToList();
                     if (users != null && users.Count != 0)
                     {
                         DateTime maxTime = users.Max(p => p.StatDate);
                         if (maxTime > MaxTime)
                         {
                             MaxTime = maxTime;
                         }
                         ListAll.Add(users);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 private void EditSoft(bool adding, DirectEventArgs e)
 {
     try
     {
         Soft   soft  = new Soft();
         string plats = e.ExtraParams[0].Value.TrimEnd('-');
         soft.Platforms    = plats.Split('-').Select(p => (MobileOption)Convert.ToInt32(p)).ToList();
         soft.Name         = SoftName.Text;
         soft.SoftType     = (SoftTypeOptions)Convert.ToInt32(softType.SelectedItem.Value);
         soft.OutID        = Convert.ToInt32(SoftOutID.Text);
         soft.ID           = Convert.ToInt32(SoftPID.Text == "" ? "0" : SoftPID.Text);
         soft.SortIndex    = Convert.ToInt32(SortNumID.Text);
         soft.Status       = StatusOptions.Valid;
         soft.OnlyInternal = Convert.ToInt32(onlyinternalselect.SelectedItem.Value) > 0 ? true : false;
         soft.SoftAreaType = Convert.ToInt32(softareatype.SelectedItem.Value);
         if (adding)
         {
             biService.AddSoft(soft);
         }
         else
         {
             biService.UpdateSoft(soft);
         }
         e.ExtraParamsResponse.Add(new Ext.Net.Parameter("success", "1", false));
         X.Msg.Alert("消息", "操作成功").Show();
     }
     catch (ToUserException ex)
     {
         e.ExtraParamsResponse.Add(new Ext.Net.Parameter("success", "0", false));
         X.Msg.Alert("消息", ex.Message).Show();
     }
 }
        /// <summary>
        /// 读取程序列表
        /// </summary>
        public void LoadSoftList()
        {
            Task.Factory.StartNew(() =>
            {
                List <Soft> temp = new List <Soft>();
                int index        = 1;
                foreach (Process p in Process.GetProcesses(Environment.MachineName))
                {
                    //此进程主窗口句柄不为NULL
                    if (p.MainWindowHandle != IntPtr.Zero)
                    {
                        Soft soft = new Soft
                        {
                            Handle = p.MainWindowHandle,
                            Title  = p.MainWindowTitle,
                            Name   = p.ProcessName,
                            Index  = index
                        };
                        temp.Add(soft);
                        index++;
                    }
                }

                //委托UI线程
                Execute.OnUIThread(() =>
                {
                    //将缓存中的进程列表加入显示列表集合中
                    temp.ForEach(p => SoftList.Add(p));
                });
            });
        }
Exemplo n.º 4
0
        /// <summary>
        /// 导出皮肤
        /// </summary>
        /// <param name="model"></param>
        public void SkinExport(Skin model)
        {
            var file = Soft.SkinFile(model);

            if (!File.Exists(file))
            {
                MessageBox.Show("皮肤文件丢失!", "导出失败");
                return;
            }
            生成带皮肤信息的压缩包(model);
            var dialog = new FolderBrowserDialog {
                Description = @"请选择导出路径"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string foldPath = dialog.SelectedPath + "\\" + model.FileName;
                try
                {
                    File.Copy(file, foldPath, true);
                    Process.Start("explorer.exe", dialog.SelectedPath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("文件被占用或导出路径出错!!", "导出失败!");
                    Log.LogError("导出失败!", ex);
                }
            }
        }
Exemplo n.º 5
0
        public long check(long nowBuild)
        {
            this.applicationRootPath = Application.StartupPath + @"\";

            this.backupPath        = String.Format(@"{0}\backup\", this.applicationRootPath);
            this.updatePackagePath = String.Format(@"{0}\update\", this.applicationRootPath);

            Soft soft = this.checkUpdate(nowBuild);

            if (soft == null)
            {
                return(nowBuild);
            }

            if (!this.downloadPackage(soft))
            {
                return(nowBuild);
            }

            this.unZipPackage(soft.Packages[0].Name, "update", soft.Packages[0].Password);

            UpdateInfo updateContent = this.getPackageConfig(soft.Packages[0].Name);

            this.update(updateContent);
            return(soft.Build);
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,IndividualId,SoftType,Tissue,Comment,Count,Degree")] Soft soft)
        {
            if (soft == null || id != soft.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(soft);
                    await _context.SaveChangesAsync().ConfigureAwait(false);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SoftExists(soft.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["IndividualId"] = new SelectList(_context.Individual, "Id", "Id", soft.IndividualId);
            return(View(soft));
        }
Exemplo n.º 7
0
        private void 获取各种图片(List <string> files)
        {
            Comment = "获取各种图片";
            //原画
            var splash = files.FirstOrDefault(d => d.EndsWith(".jpg") && d.Contains("Splash"));

            if (!string.IsNullOrWhiteSpace(splash) && File.Exists(splash))
            {
                Skin.Original = Path.GetFileName(splash);
                File.Copy(splash, Soft.SkinOriginalPath(Skin), true);
            }
            //载入图
            var load = files.FirstOrDefault(d => d.ToLower().EndsWith("loadscreen.dds"));

            if (!string.IsNullOrWhiteSpace(load) && File.Exists(load))
            {
                using (var image = DevIL.DevIL.LoadBitmap(load))
                {
                    Skin.LoadPic = Path.GetFileNameWithoutExtension(load) + ".png";
                    DevIL.DevIL.SaveBitmap(Soft.SkinLoadPath(Skin), image);
                }
            }
            //背景图
            var back = files.FirstOrDefault(d => (d.EndsWith("*.png") || d.EndsWith("*.jpg") || d.EndsWith("*.jpeg") || d.EndsWith("*.bmp")) && !d.ToLower().Contains("splash") && !d.ToLower().Contains("circle") && !d.ToLower().Contains("square"));

            if (!string.IsNullOrWhiteSpace(back) && File.Exists(back))
            {
                Skin.BackImage = Path.GetFileName(back);
                File.Copy(back, Soft.SkinBackImagePath(Skin), true);
            }
        }
Exemplo n.º 8
0
        public void CheckUpdate(long build)
        {
            Soft soft = null;

            try {
                text = "正在连接服务器...";
                soft = NetApi.GetSoft(2);
            } catch (System.Net.WebException ex) {
                text = "获取数据时发生异常:" + ex.Message;
            }

            if (soft == null || soft.Build <= build)
            {
                text     = "未找到相关数据";
                overFlag = true;
                return;
            }

            text = "发现新版本!";
            Tools.AppConfigHelper.RootPath = Application.ExecutablePath;
            Tools.AppConfigHelper.SetAppSettingsValue("UpdateFlag", "true");
            Tools.AppConfigHelper.SetAppSettingsValue("Ver", soft.Version);
            Tools.AppConfigHelper.SetAppSettingsValue("UpdatePackageFileName", soft.Packages[0].Name);
            Tools.AppConfigHelper.SetAppSettingsValue("UpdatePackagePassword", soft.Packages[0].Password);

            String host = AppConfigHelper.GetAppSettingsValue("domain");
            String url  = String.Format("{0}/api/product/service/download_package/{1}?access_token=123", host, soft.Packages[0].Id);

            text = "正在下载更新包...";
            DownloadFile(url, soft.Packages[0].Name + ".zip", null);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 挂载皮肤
        /// </summary>
        /// <param name="model"></param>
        public Skin SkinMount(Skin model)
        {
            var gameskin = Game.SkinFile(model);
            var softskin = Soft.SkinFile(model);

            if (!File.Exists(softskin))
            {
                MessageBox.Show("皮肤 [" + model.SkinName + "]文件丢失", "挂载失败");
            }
            try
            {
                if (FileOperations.CreateFileDir(gameskin) && ReadOrWriteClientZipstxt(model, true))
                {
                    File.Copy(softskin, gameskin, true);
                    model.MountType = "已挂载";
                    _skin.ChangeMountType(model);
                }
                else
                {
                    MessageBox.Show("ClientZips.txt文件读写失败!请确认改文件未被锁定", "挂载失败!");
                }
            }
            catch (Exception ex)
            {
                ReadOrWriteClientZipstxt(model, false);
                MessageBox.Show("皮肤复制出错!\r\n文件被占用或无权限操作", "挂载失败!");
                Log.LogError("挂载皮肤", ex);
            }
            return(model);
        }
Exemplo n.º 10
0
        public void CheckUpdate(long build)
        {
            String  softID = ConfigurationManager.AppSettings["SoftID"];
            IniFile file   = new IniFile(String.Format("{0}/application.cache", Application.StartupPath));

            Soft soft = null;

            try {
                Callback?.Invoke("正在连接服务器...", -1);
                soft = NetApi.GetSoft(Convert.ToInt32(softID), file.IniReadValue("AccessToken", "token"));
            } catch (System.Net.WebException ex) {
                Callback?.Invoke("获取数据时发生异常:" + ex.Message, 1);
                return;
            }

            if (soft == null || soft.Build <= build)
            {
                Callback?.Invoke("未发现新版本", 0);
                return;
            }

            Callback?.Invoke("发现新版本!", -1);
            Tools.AppConfigHelper.RootPath = Application.ExecutablePath;
            Tools.AppConfigHelper.SetAppSettingsValue("UpdateFlag", "true");
            Tools.AppConfigHelper.SetAppSettingsValue("Ver", soft.Version);
            Tools.AppConfigHelper.SetAppSettingsValue("UpdatePackageFileName", soft.Packages[0].Name);
            Tools.AppConfigHelper.SetAppSettingsValue("UpdatePackagePassword", soft.Packages[0].Password);

            String host = AppConfigHelper.GetAppSettingsValue("domain");
            String url  = String.Format("{0}/api/product/download/{1}?access_token={2}", host, soft.Packages[0].Id, file.IniReadValue("AccessToken", "token"));

            Callback?.Invoke("正在下载更新包...", -1);
            DownloadFile(url, soft.Packages[0].Name + ".zip", null);
        }
Exemplo n.º 11
0
 // Инициализация иконки в записи ПО
 private void initImageIcon(ref Soft programm)
 {
     if (!_isRemoteMode)
     {
         if (programm.IconImagePath.IndexOf("default") >= 0)
         {
             programm.Icon = _defaultIcon;
         }
         else if (programm.IconImagePath.IndexOf(".exe") >= 0)
         {
             programm.Icon = GetIcon(programm.IconImagePath);
         }
         else if (programm.IconImagePath.IndexOf(".ico") >= 0)
         {
             programm.Icon = new BitmapImage(new Uri(programm.IconImagePath, UriKind.RelativeOrAbsolute));
         }
         else
         {
             programm.Icon = _defaultIcon;
         }
     }
     else
     {
         programm.Icon = _defaultIcon;
     }
 }
Exemplo n.º 12
0
Arquivo: frmMain.cs Projeto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmMain_Load(object sender, EventArgs e)
        {
            Init();

            //
            //
            this.mnuView.Visible    = false;
            this.toolStrip1.Visible = false;

            Soft   soft = SoftManager.GetSoft();
            object o2   = soft.Hardware;
            int    n    = soft.Hardware.Stations.Count;

            n = soft.SocketListenerManager.SocketListeners.Count;

            //this.Text = n.ToString();

            // spu
            //
            //this.ucSpus1.SPUs = App.Soft.SPUs;
            //this.ucSpus1.RefreshSPUs();

            this.mnuToolbar.Checked   = this.toolStrip1.Visible;
            this.mnuStatusbar.Checked = this.statusStrip1.Visible;

            foreach (IDPU dpu in this.Soft.DPUs)
            {
                if (dpu.UIEntry != null)
                {
                    dpu.UIEntry.Create(this.mnuSetting);
                }
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 检测是否有新版本
        /// </summary>
        /// <param name="build">当前版本</param>
        /// <returns>有新版本则返回软件信息,无新版本时则返回null</returns>
        public Soft checkUpdate(long build)
        {
            String  softID = ConfigurationManager.AppSettings["SoftID"];
            IniFile file   = new IniFile(String.Format("{0}/application.cache", Application.StartupPath));

            Soft soft = null;

            try
            {
                UpdateStatusCallback?.Invoke("正在连接服务器...", -1);
                soft = NetApi.GetSoft(Convert.ToInt32(softID), file.IniReadValue("AccessToken", "token"));
            }
            catch (System.Net.WebException ex)
            {
                UpdateStatusCallback?.Invoke("获取数据时发生异常:" + ex.Message, 1);
                return(null);
            }

            if (soft == null || soft.Build <= build)
            {
                UpdateStatusCallback?.Invoke("未发现新版本", 0);
                return(null);
            }

            UpdateStatusCallback?.Invoke("发现新版本!", -1);

            return(soft);
        }
Exemplo n.º 14
0
 public void StartImport(string filepath)
 {
     Skin    = new Skin();
     Comment = "导入中……";
     if (string.IsNullOrWhiteSpace(filepath) || !File.Exists(filepath))
     {
         MessageBox.Show("源文件不存在或找不到!");
     }
     FilePath = filepath;
     获取皮肤信息();
     if (!_canGoOn)
     {
         return;
     }
     检查重复皮肤();
     if (!_canGoOn)
     {
         return;
     }
     查看压缩包结构();
     if (FileOperations.CreateDir(Soft.SkinPath(Skin)) && _canGoOn)
     {
         解压压缩包的图片();
         制各种文件到皮肤文件夹();
         保存皮肤信息();
     }
     if (Directory.Exists(TempPath))
     {
         try
         {
             Directory.Delete(TempPath, true);
         }
         catch { throw; }
     }
 }
Exemplo n.º 15
0
        public async Task <bool> Update(Soft soft)
        {
            var sql = @"update softs Set Name = @Name, Description = @Description, Price = @Price, Count = @Count where  Id = @Id";

            using (var bd = new SqliteConnection(_connectStr))
            {
                return((await bd.ExecuteAsync(sql, soft)) > 0);
            }
        }
Exemplo n.º 16
0
        public async Task <bool> Create(Soft soft)
        {
            var sql = @"Insert into softs (Name, Description, Price, Count) values (@Name, @Description, @Price, @Count)";

            using (var bd = new SqliteConnection(_connectStr))
            {
                return((await bd.ExecuteAsync(sql, soft)) != 0);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// 根据版本号下载更新包
        /// </summary>
        /// <param name="build">最新版更新包实体</param>
        private bool downloadPackage(Soft build)
        {
            IniFile file = new IniFile(String.Format("{0}/application.cache", Application.StartupPath));

            AppConfigHelper.RootPath = Application.StartupPath;

            String host = ConfigurationManager.AppSettings["domain"];
            String url  = String.Format("{0}/api/product/download/{1}.json?access_token={2}", host, build.Packages[0].Id, file.IniReadValue("AccessToken", "token"));

            UpdateStatusCallback?.Invoke("正在下载更新包...", -1);

            String fileName = build.Packages[0].Name + ".zip";

            System.Windows.Forms.ProgressBar prog = null;
            float percent = 0;

            try
            {
                System.Net.HttpWebRequest  Myrq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url);
                System.Net.HttpWebResponse myrp = (System.Net.HttpWebResponse)Myrq.GetResponse();
                long totalBytes = myrp.ContentLength;
                if (prog != null)
                {
                    prog.Maximum = (int)totalBytes;
                }
                System.IO.Stream st = myrp.GetResponseStream();
                System.IO.Stream so = new System.IO.FileStream(fileName, System.IO.FileMode.Create);
                long             totalDownloadedByte = 0;
                byte[]           by = new byte[1024];
                int osize           = st.Read(by, 0, (int)by.Length);
                while (osize > 0)
                {
                    totalDownloadedByte = osize + totalDownloadedByte;
                    System.Windows.Forms.Application.DoEvents();
                    so.Write(by, 0, osize);
                    if (prog != null)
                    {
                        prog.Value = (int)totalDownloadedByte;
                    }
                    osize = st.Read(by, 0, (int)by.Length);

                    percent = (float)totalDownloadedByte / (float)totalBytes * 100;
                    UpdateStatusCallback?.Invoke("当前补丁下载进度" + percent.ToString() + "%", -1);
                    System.Windows.Forms.Application.DoEvents(); //必须加注这句代码,否则text将因为循环执行太快而来不及显示信息
                }
                so.Close();
                st.Close();
            }
            catch (System.Exception e)
            {
                UpdateStatusCallback?.Invoke("下载失败:" + e.Message, 10);
                return(false);
            }
            UpdateStatusCallback?.Invoke("更新包下载完成,请稍候...", 0);

            return(true);
        }
Exemplo n.º 18
0
            //нашел 188 прог - делал через реестр
            public Soft[] GetDeviceReg()
            {
                List <Soft> arraySoft = new List <Soft>();

                //А если система x64, то будет еще одна ветка HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall
                using (RegistryKey rk = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"))
                {
                    foreach (string skName in rk.GetSubKeyNames())
                    {
                        using (RegistryKey sk = rk.OpenSubKey(skName))
                        {
                            try
                            {
                                /*
                                 * if (!(sk.GetValue("DisplayName") == null))
                                 * {
                                 *  Console.WriteLine("-----------------" + i++);
                                 *  if (sk.GetValue("InstallLocation") == null)
                                 *      Console.WriteLine(sk.GetValue("DisplayName") + " - Install path not known\n");
                                 *  else
                                 *      Console.WriteLine(sk.GetValue("DisplayName") + " - " + sk.GetValue("InstallLocation") + "\n");
                                 * }
                                 */

                                Soft tempSoft = new Soft();
                                if (!(sk.GetValue("DisplayName") == null))
                                {
                                    tempSoft.Caption = sk.GetValue("DisplayName").ToString();
                                    if (!(sk.GetValue("DisplayVersion") == null))
                                    {
                                        tempSoft.Version = sk.GetValue("DisplayVersion").ToString();
                                    }
                                    if (!(sk.GetValue("Publisher") == null))
                                    {
                                        tempSoft.Vendor = sk.GetValue("Publisher").ToString();
                                    }
                                    if (!(sk.GetValue("InstallDate") == null))
                                    {
                                        tempSoft.InstallDate = sk.GetValue("InstallDate").ToString();
                                    }
                                    if (!(sk.GetValue("InstallLocation") == null))
                                    {
                                        tempSoft.InstallLocation = sk.GetValue("InstallLocation").ToString();
                                    }
                                    arraySoft.Add(tempSoft);
                                }
                            }
                            catch (Exception e)
                            {
                                ;
                            }
                        }
                    }
                }
                return(arraySoft.ToArray());
            }
Exemplo n.º 19
0
        public static void softParser(ManagementObjectSearcher searcher)
        {
            Soft myList = new Soft();

            foreach (ManagementObject queryObj in searcher.Get())
            {
                Item currentItem = new Item(queryObj["Caption"].ToString(), queryObj["InstallDate"].ToString());
                myList.softList.Add(currentItem);
            }
            SoftData.EventHandler(myList);
        }
Exemplo n.º 20
0
        private void CheckMountSkinFile(Skin skin)
        {
            var file = Game.SkinFile(skin);

            if (File.Exists(file))
            {
                return;
            }
            File.Copy(Soft.SkinFile(skin), file, true);
            ReadOrWriteClientZipstxt(skin, true);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 将上次选中的软件和平台默认存储到cookie中
        /// </summary>
        protected void SetRequestCookie(int p_softid, int plat)
        {
            Soft        soft          = GetSoft(p_softid);
            List <Soft> selectedSofts = new List <Soft>();

            selectedSofts.Add(soft);
            List <MobileOption> selectedPlatforms = new List <MobileOption>();

            selectedPlatforms.Add((MobileOption)plat);
            UtilityHelp.SetDefaultSoftsToCookie(selectedSofts, selectedPlatforms);
        }
Exemplo n.º 22
0
        public void SoftDelete(object sender, RoutedEventArgs e)
        {
            Soft soft = (Soft)SoftGrid.SelectedItem;
            var  name = soft.SoftName;

            if (MessageBox.Show($"Вы действительно хотите удалить {name}", "Удаление элемента", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                XMLWorker.DeleteSoft(SoftType.Text, name);
                SoftGrid.Items.Remove(SoftGrid.SelectedItem);
            }
        }
Exemplo n.º 23
0
        public void UsingKeywordAnalyzing()
        {
            using (var store = GetDocumentStore())
                using (var session = store.OpenSession())
                {
                    var fieldOptions1 = new IndexFieldOptions {
                        Indexing = FieldIndexing.Exact
                    };
                    var fieldOptions2 = new IndexFieldOptions {
                        Indexing = FieldIndexing.Exact,
                    };
                    var fieldOptions3 = new IndexFieldOptions {
                        Indexing = FieldIndexing.Search, Analyzer = typeof(KeywordAnalyzer).AssemblyQualifiedName
                    };

                    store.Admin.Send(new PutIndexesOperation(new[] { new IndexDefinition
                                                                     {
                                                                         Maps = { @"from s in docs.Softs select new { s.f_platform, s.f_name, s.f_alias,s.f_License,s.f_totaldownload}" },

                                                                         Fields =
                                                                         {
                                                                             { "f_platform",      fieldOptions1 },
                                                                             { "f_License",       fieldOptions2 },
                                                                             { "f_totaldownload", fieldOptions2 },
                                                                             { "f_name",          fieldOptions3 },
                                                                             { "f_alias",         fieldOptions3 }
                                                                         },
                                                                         Name = "test"
                                                                     } }));

                    Soft entity = new Soft
                    {
                        f_platform      = 1,
                        f_name          = "hello Shrek",
                        f_alias         = "world",
                        f_License       = "agpl",
                        f_totaldownload = -1
                    };
                    session.Store(entity);
                    session.Advanced.GetMetadataFor(entity)["@collection"] = "Softs";
                    session.SaveChanges();

                    List <Soft> tmps = session.Advanced.DocumentQuery <Soft>("test").
                                       WaitForNonStaleResults(TimeSpan.FromHours(1))
                                       .WhereStartsWith("f_name", "s")
                                       .OrderByDescending("f_License")
                                       .OrderBy("f_totaldownload")
                                       .ToList();

                    Assert.Empty(tmps);
                }
        }
Exemplo n.º 24
0
        public void UsingKeywordAnalyzing()
        {
            using (var store = NewDocumentStore())
                using (var session = store.OpenSession())
                {
                    store.DatabaseCommands.PutIndex("test", new IndexDefinition
                    {
                        Map =
                            @"from s in docs.Softs select new { s.f_platform, s.f_name, s.f_alias,s.f_License,s.f_totaldownload}",
                        Analyzers =
                        {
                            { "f_name",  typeof(KeywordAnalyzer).AssemblyQualifiedName },
                            { "f_alias", typeof(KeywordAnalyzer).AssemblyQualifiedName },
                        },
                        Indexes =
                        {
                            { "f_platform",      FieldIndexing.NotAnalyzed },
                            { "f_License",       FieldIndexing.NotAnalyzed },
                            { "f_totaldownload", FieldIndexing.NotAnalyzed },
                            { "f_name",          FieldIndexing.Analyzed    },
                            { "f_alias",         FieldIndexing.Analyzed    },
                        },
                        SortOptions =
                        {
                            { "f_totaldownload", SortOptions.Int },
                            { "f_License",       SortOptions.Int },
                        }
                    }, true);

                    Soft entity = new Soft
                    {
                        f_platform      = 1,
                        f_name          = "hello Shrek",
                        f_alias         = "world",
                        f_License       = "agpl",
                        f_totaldownload = -1
                    };
                    session.Store(entity);
                    session.Advanced.GetMetadataFor(entity)["Raven-Entity-Name"] = "Softs";
                    session.SaveChanges();

                    List <Soft> tmps = session.Advanced.LuceneQuery <Soft>("test").
                                       WaitForNonStaleResults(TimeSpan.FromHours(1))
                                       .WhereStartsWith("f_name", "s")
                                       .OrderBy(new[] { "-f_License", "f_totaldownload" })
                                       .ToList();


                    Assert.Empty(tmps);
                }
        }
Exemplo n.º 25
0
 public IActionResult Index(string id)
 {
     using (var context = new SqlConnection(DB.constring))
     {
         Soft soft        = context.Query <Soft>($"select * from Soft where SoftIdentity='{id}'").FirstOrDefault();
         var  CommentList = context.Query <Comment>($"select * from Comments where SoftID='{id}'");
         foreach (var item in CommentList.ToList())
         {
             item.Login = context.Query <string>($"select Login from Acount where ID={item.AccountID}").FirstOrDefault();
         }
         ViewBag.Comments = CommentList.ToList();
         return(View(soft));
     }
 }
Exemplo n.º 26
0
        public static NetResult GetAccessToken(String appId, String appSecret)
        {
            Soft   soft = null;
            String url  = String.Format("{0}{1}.json", domain, GetUrl);

            String time = TimeStamp.GetNowTimeStamp().ToString();

            System.String nonce = Encryption.MD5(time);

            IDictionary <String, String> param = new Dictionary <String, String>();

            param.Add("app_id", appId);
            param.Add("nonce", nonce);
            param.Add("timestamp", time);
            param.Add("signature", Encryption.MD5(String.Format("{0}{1}{2}&key={3}", appId, nonce, time, appSecret)));

            String       json   = null;
            Stream       stream = null;
            StreamReader reader = null;

            try
            {
                HttpWebResponse response = HttpWebResponseUtility.CreatePostHttpResponse(url, param, 30000, "WinFormFeiyu", Encoding.UTF8, null);

                stream = response.GetResponseStream();
                reader = new StreamReader(stream);
                json   = reader.ReadToEnd();
                reader.Close();
                stream.Close();
            }
            catch (System.Net.WebException e)
            {
                MessageBox.Show(e.Message, "获取Token时发生异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            finally
            {
                reader?.Close();
                stream?.Close();
            }

            if (String.IsNullOrEmpty(json))
            {
                return(null);
            }
            NetResult result = JsonHelper.DeserializeJsonToObject <NetResult>(json);

            return(result);
        }
Exemplo n.º 27
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void XD1100Dpu_HardwareCreated(object sender, EventArgs e)
 {
     int id = DBI.Instance.GetOutsideTemperatureProviderDevice();
     if (id > 0)
     {
         Soft soft = sender as Soft;
         IDevice d = soft.Hardware.FindDevice(id);
         if (d != null)
         {
             DeviceOTProvider provider = new DeviceOTProvider((IOutside)d);
             OutsideTemperatureProviderManager.Provider = provider;
             _log.Info("deviceOT provider is '{0}->{1}'", d.Station.Name, d.GetType().Name);
         }
     }
 }
Exemplo n.º 28
0
        public void 生成带皮肤信息的压缩包(Skin skin)
        {
            var file = Config.SkinConfigSave(skin);

            if (string.IsNullOrWhiteSpace(file))
            {
                return;
            }
            var skinfile = Soft.SkinFile(skin);

            if (File.Exists(file) && File.Exists(skinfile))
            {
                Zip.ZipAddFile(file, skinfile, "skin.cfg");
            }
        }
Exemplo n.º 29
0
        private void begin()
        {
            this.setLabel("请稍等...");

            long build = Convert.ToInt64(ConfigurationManager.AppSettings["SoftBuild"]);

            this.check = new SoftUpdate();
            this.check.UpdateStatusCallback = this.updatingCallback;
            Soft soft = this.check.checkUpdate(build);

            if (soft.Build > build)
            {
                MessageBox.Show("发现新版本,请重启软件升级!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// 提取皮肤
        /// </summary>
        /// <param name="heroname"></param>
        public void HeroExtract(string heroname)
        {
            var path = Config.SoftSet("Extraction") ?? (Soft.ZipTemp + "\\" + heroname);

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
            var list = Soft.ZipList();

            foreach (var item in list)
            {
                Zip.UnZipFile(item, path, heroname);
            }
            Process.Start("explorer.exe", path);
        }
Exemplo n.º 31
0
        public Soft GetSoft(int SoftId)
        {
            Soft soft = new Soft();
            DbCommand command = DbProviderHelper.CreateCommand("SELECTSoft",CommandType.StoredProcedure);
            command.Parameters.Add(DbProviderHelper.CreateParameter("@SoftId",DbType.Int32,SoftId));
            DbDataReader dataReader = DbProviderHelper.ExecuteReader(command);
            while (dataReader.Read())
            {
                soft.SoftId = Convert.ToInt32(dataReader["SoftId"]);
                soft.SoftGuid = (Guid) dataReader["SoftGuid"];

                if(dataReader["SoftType"] != DBNull.Value)
                    soft.SoftType = Convert.ToString(dataReader["SoftType"]);

                if(dataReader["Version"] != DBNull.Value)
                    soft.Version = Convert.ToString(dataReader["Version"]);

                if(dataReader["Language"] != DBNull.Value)
                    soft.Language = Convert.ToString(dataReader["Language"]);

                if(dataReader["Copyright"] != DBNull.Value)
                    soft.Copyright = Convert.ToString(dataReader["Copyright"]);

                if(dataReader["OperatingSystem"] != DBNull.Value)
                    soft.OperatingSystem = Convert.ToString(dataReader["OperatingSystem"]);

                if(dataReader["DemoUri"] != DBNull.Value)
                    soft.DemoUri = Convert.ToString(dataReader["DemoUri"]);

                if(dataReader["RegUri"] != DBNull.Value)
                    soft.RegUri = Convert.ToString(dataReader["RegUri"]);

                if(dataReader["UnzipPassword"] != DBNull.Value)
                    soft.UnzipPassword = Convert.ToString(dataReader["UnzipPassword"]);
            }
            dataReader.Close();
            return soft;
        }
Exemplo n.º 32
0
		public void UsingKeywordAnalyzing()
		{
			using(var store = NewDocumentStore())
			using (var session = store.OpenSession())
			{
				store.DatabaseCommands.PutIndex("test", new IndexDefinition
				{
					Map =
						@"from s in docs.Softs select new { s.f_platform, s.f_name, s.f_alias,s.f_License,s.f_totaldownload}",
					Analyzers =
						{
							{"f_name", typeof (KeywordAnalyzer).AssemblyQualifiedName},
							{"f_alias", typeof (KeywordAnalyzer).AssemblyQualifiedName},
						},
					Indexes =
						{
							{"f_platform", FieldIndexing.NotAnalyzed},
							{"f_License", FieldIndexing.NotAnalyzed},
							{"f_totaldownload", FieldIndexing.NotAnalyzed},
							{"f_name", FieldIndexing.Analyzed},
							{"f_alias", FieldIndexing.Analyzed},
						},
					SortOptions =
						{
							{"f_totaldownload", SortOptions.Int},
							{"f_License", SortOptions.Int},
						}

				}, true);

				Soft entity = new Soft
				{
					f_platform = 1,
					f_name = "hello Shrek",
					f_alias = "world",
					f_License = "agpl",
					f_totaldownload = -1
				};
				session.Store(entity);
				session.Advanced.GetMetadataFor(entity)["Raven-Entity-Name"] = "Softs";
				session.SaveChanges();

                List<Soft> tmps = session.Advanced.DocumentQuery<Soft>("test").
										WaitForNonStaleResults(TimeSpan.FromHours(1))
										.WhereStartsWith("f_name", "s")
										.OrderBy(new[] { "-f_License", "f_totaldownload" })
										.ToList();

				
				Assert.Empty(tmps);
			}
		}