public ASoftware(string name, SoftwareType type, int days, bool advancedDesign)
 {
     Name           = name;
     Type           = type;
     Days           = days;
     AdvancedDesign = advancedDesign;
 }
Exemple #2
0
 /// <summary>
 /// saves the Category
 /// </summary>
 /// <param name="cat"></param>
 /// <param name="swt"></param>
 public void SaveCategory(Category cat, SoftwareType swt)
 {
     if (!swt.Categories.Contains(cat))
     {
         swt.Categories.Add(cat);
     }
 }
Exemple #3
0
        private void WriteDog()
        {
            int ret = -1;

            byte[] rdDate = new byte[100];
            _myRandom.NextBytes(rdDate);
            ret = _Writer.WriteData(0, rdDate, _Key);

            byte[] data = null;
            if (ret == 0)
            {
                data = System.Text.ASCIIEncoding.GetEncoding("GB2312").GetBytes(MydsEncrypt.Encrypt(CHECKSTRING));
                ret  = _Writer.WriteData(CHECKPOSITON, data, _Key);
            }

            if (ret == 0)
            {
                data = SEBinaryConverter.IntToBytes(txtProjectID.IntergerValue);
                ret  = _Writer.WriteData(61, data, _Key);
            }

            if (ret == 0)
            {
                SoftwareType sl = SoftwareType.None;
                if (this.chk汇海中考软件.Checked)
                {
                    sl |= SoftwareType.TYPE_汇海中考软件;
                }
                if (this.chk学生体测.Checked)
                {
                    sl |= SoftwareType.TYPE_汇海学生体测软件;
                }
                if (this.chk国民体测.Checked)
                {
                    sl |= SoftwareType.TYPE_汇海国民体测软件;
                }
                if (this.chk运动会.Checked)
                {
                    sl |= SoftwareType.TYPE_汇海运动会软件;
                }
                data = SEBinaryConverter.IntToBytes((int)sl);
                ret  = _Writer.WriteData(31, data, _Key);
            }

            if (ret == 0)
            {
                data = System.Text.ASCIIEncoding.GetEncoding("GB2312").GetBytes(MydsEncrypt.Encrypt(dtStart.Value.Date.ToString("yyMMdd")));
                ret  = _Writer.WriteData(17, data, _Key);
            }

            if (ret == 0)
            {
                data = System.Text.ASCIIEncoding.GetEncoding("GB2312").GetBytes(MydsEncrypt.Encrypt(dtEnd.Value.Date.ToString("yyMMdd")));
                ret  = _Writer.WriteData(5, data, _Key);
            }
            if (ret != 0)
            {
                throw new InvalidOperationException("写狗失败 errorcode=" + ret.ToString());
            }
        }
        public SoftwareType AddSoftwareType(SoftwareType softwareType)
        {
            var newType = licenceTrackerContext.SoftwareTypes.Add(softwareType);

            licenceTrackerContext.SaveChanges();
            return(newType);
        }
Exemple #5
0
            /// <summary>
            /// Changes the amount of fans for the Phone OS category
            /// </summary>
            /// <param name="amount">The amount of fans</param>
            public static void PhoneOS(int amount)
            {
                SetTypes();
                SoftwareType type = SoftwareTypes.Find(x => x.Name == "Operating System");

                GameSettings.Instance.MyCompany.AddFans(amount, type.Categories["Phone"]);
            }
        public async Task <ActionResult> AddSoftwareType(SoftwareType swType)
        {
            ModelState.Remove(nameof(swType.Id));
            ModelState.Remove(nameof(swType.Created));
            ModelState.Remove(nameof(swType.LastChange));
            ModelState.Remove(nameof(swType.ChangedBy));
            if (ModelState.IsValid)
            {
                var userRepository = new ApplicationUserRepository <Admin>();
                var currentUser    = userRepository.GetByUserNameAsync(User.Identity.Name);

                SoftwareType _swType = new SoftwareType()
                {
                    Name        = swType.Name,
                    Description = swType.Description,
                    Valid       = swType.Valid,
                    Created     = DateTime.Now,
                    LastChange  = DateTime.Now,
                    ChangedBy   = await currentUser
                };

                new SoftwareTypeRepository().Create(_swType);
                TempData["success"] = "Software type was added";
            }
            else
            {
                return(View("CreateSoftwareType", swType));
            }

            return(RedirectToAction("SoftwareTypes"));
        }
        public async Task <ActionResult> UpdateSoftwareType(SoftwareType swType)
        {
            ModelState.Remove(nameof(swType.Id));
            ModelState.Remove(nameof(swType.Created));
            ModelState.Remove(nameof(swType.LastChange));
            ModelState.Remove(nameof(swType.ChangedBy));
            if (ModelState.IsValid)
            {
                var userRepository = new ApplicationUserRepository <Admin>();
                var swTypeRepo     = new SoftwareTypeRepository();
                var currentUser    = userRepository.GetByUserNameAsync(User.Identity.Name);

                swType.LastChange = DateTime.Now;
                swType.ChangedBy  = await currentUser;

                swTypeRepo.Update(swType);
                TempData["success"] = "Software type was edited";
            }
            else
            {
                return(View("EditSoftwareType", swType));
            }

            return(RedirectToAction("SoftwareTypes"));
        }
Exemple #8
0
            /// <summary>
            /// Changes the amount of fans for the FPS Game category
            /// </summary>
            /// <param name="amount">The amount of fans</param>
            public static void GameFPS(int amount)
            {
                SetTypes();
                SoftwareType type = SoftwareTypes.Find(x => x.Name == "Game");

                GameSettings.Instance.MyCompany.AddFans(amount, type.Categories["FPS"]);
            }
 public ProgramInfo(Version version, string author, string programName, SoftwareType softwareType)
 {
     _version      = version;
     _author       = author;
     _programName  = programName;
     _softwareType = softwareType;
 }
        public IActionResult Edit(long id, [Bind("SoftwareTypeID,Name")] SoftwareType softwareType)
        {
            if (id != softwareType.SoftwareTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    service.Update(softwareType);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SoftwareTypeExists(softwareType.SoftwareTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(softwareType));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] SoftwareType softwareType)
        {
            if (id != softwareType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(softwareType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SoftwareTypeExists(softwareType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(softwareType));
        }
Exemple #12
0
            /// <summary>
            /// Changes the amount of fans for the Antivirus category
            /// </summary>
            /// <param name="amount">The amount of fans</param>
            public static void Antivirus(int amount)
            {
                SetTypes();
                SoftwareType type = SoftwareTypes.Find(x => x.Name == "Antivirus");

                GameSettings.Instance.MyCompany.AddFans(amount, type.Categories["Default"]);
            }
 public Builder(string name)
 {
     this.name           = name;
     this.type           = SoftwareType.BASIC;
     this.osType         = OSType.WINDOWS;
     this.days           = 30;
     this.advancedDesign = true;
 }
        public Tuple <long, SoftwareType, List <Software> > GetAllSoftwareTypesWithSoftware(long softwareTypeID)
        {
            SoftwareType softwareType = FindById(softwareTypeID);

            List <Software> softwares = repositorySoftware.GetAllSoftwareOfSoftwareType(softwareTypeID);

            return(new Tuple <long, SoftwareType, List <Software> >(softwareTypeID, softwareType, softwares));
        }
 public IActionResult Create([Bind("SoftwareTypeID,Name")] SoftwareType softwareType)
 {
     if (ModelState.IsValid)
     {
         service.Add(softwareType);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(softwareType));
 }
        // GET: License/SelectSoftwareType
        public IActionResult SelectSoftwareType(long assetID)
        {
            SoftwareType softwareType = new SoftwareType();

            ViewData["AssetID"]        = assetID;
            ViewData["SoftwareTypeID"] = new List <SelectListItem>(service.GetSelectListSoftwareTypes());

            return(View(softwareType));
        }
Exemple #17
0
        public static void AddRepAction(string input)
        {
            GameSettings.Instance.MyCompany.ChangeBusinessRep(5f, "", 1f);
            SoftwareType random1 = GameSettings.Instance.SoftwareTypes.Values.Where(x => !x.OneClient).GetRandom();
            string       random2 = random1.Categories.Keys.GetRandom();

            GameSettings.Instance.MyCompany.AddFans(input.ConvertToIntDef(10000), random1.Name, random2);
            HUD.Instance.AddPopupMessage("Trainer: Reputation has been added for SoftwareType: " + random1.Name + ", Category: " + random2, "Cogs", PopupManager.PopUpAction.None, 0, 0, 0, 0, 1);
        }
Exemple #18
0
 /// <summary>
 /// removes the feature from the softwaretype
 /// </summary>
 /// <param name="feature"></param>
 /// <param name="swt"></param>
 public void RemoveFeature(Feature feature, SoftwareType swt)
 {
     swt.Features.Remove(feature);
     foreach (var f in swt.Features)
     {
         if (f.From == feature.Name)
         {
             f.From = "";
         }
     }
 }
Exemple #19
0
 public SoftwareIdentification(string id, string name, SoftwareType type, string mainVersion, string developerName, string developerContact, string developerCountry = null, string developerTaxNumber = null)
 {
     Id                 = Check.NotNull(id, nameof(id));
     Name               = Check.NotNull(name, nameof(name));
     Type               = type;
     MainVersion        = Check.NotNull(mainVersion, nameof(mainVersion));
     DeveloperName      = Check.NotNull(developerName, nameof(developerName));
     DeveloperContact   = Check.NotNull(developerContact, nameof(developerContact));
     DeveloperCountry   = developerCountry;
     DeveloperTaxNumber = developerTaxNumber;
 }
        public async Task <IActionResult> Create([Bind("Id,Name")] SoftwareType softwareType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(softwareType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(softwareType));
        }
Exemple #21
0
        /// <summary>
        /// 检查程序版本
        /// </summary>
        /// <param name="type"></param>
        /// <returns>
        /// true 表示版本一致不需要更新
        /// false 表示有异常,需要更新
        /// </returns>
        public static bool Update(SoftwareType type)
        {
            //if (SysConfig.IsTest)
            //    return true;
            VersionsInfo vi = LocalDataService.GetVersionsInfo((int)type);

            if (vi == null)
            {
                MessageBox.Show("检查软件版本时异常,软件即将关闭,请检查网络连接是否正常,再重启软件",
                                "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return(false);
            }

            string currentVersion = Application.ProductVersion;

            if (vi.Version != currentVersion)
            {
                //需要更新版本
                MessageBox.Show(
                    string.Format("当前程序有更新版本,点击确定开始更新,请耐心等待...\r\n(升级完成后程序将自动重启)"),
                    "提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                string path = Application.StartupPath + @"\" + "HLAUpdate.exe";
                if (File.Exists(path))
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(vi.DownloadUrl);
                    sb.Append(" ");
                    sb.Append(currentVersion);
                    sb.Append(" ");
                    sb.Append(vi.Version);
                    sb.Append(" ");
                    string log = vi.UpdateLog.Replace(' ', '_');
                    if ("" == log)
                    {
                        log = "log";
                    }
                    sb.Append(log);
                    sb.Append(" ");
                    sb.Append(Application.ProductName);
                    var process = Process.Start(path, sb.ToString());
                    Application.Exit();
                }
                else
                {
                    MessageBox.Show("自动升级模块损坏,或已不存在,请联系开发商解决!",
                                    "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                return(false);
            }
            else
            {
                return(true);
            }
        }
Exemple #22
0
        internal void AddRep()
        {
            if (!((UnityEngine.Object)GameSettings.Instance != (UnityEngine.Object)null))
            {
                return;
            }
            GameSettings.Instance.MyCompany.BusinessReputation = 1f;
            SoftwareType random1 = Utilities.GetRandom <SoftwareType>(Enumerable.Where <SoftwareType>((IEnumerable <SoftwareType>)GameSettings.Instance.SoftwareTypes.Values, (Func <SoftwareType, bool>)(x => !x.OneClient)));
            string       random2 = Utilities.GetRandom <string>((IEnumerable <string>)random1.Categories.Keys);

            GameSettings.Instance.MyCompany.AddFans(100000000, random1.Name, random2);
        }
        public IActionResult SelectSoftwareType(long assetID, SoftwareType softwareType)
        {
            if (softwareType.SoftwareTypeID > 0 && assetID > 0)
            {
                return(RedirectToAction("SelectLicense", "License", new { assetID, selectedSoftwareTypeID = softwareType.SoftwareTypeID }));
            }

            ViewData["AssetID"]        = assetID;
            ViewData["SoftwareTypeID"] = new List <SelectListItem>(service.GetSelectListSoftwareTypes());

            return(View(softwareType));
        }
Exemple #24
0
        public ActionResult FinishedTests(int?page, Guid?swTypeGuid, Guid?testCatGuid, string searchTerm)
        {
            TestsRepository testsRepo = new TestsRepository();

            SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository();

            ViewBag.SoftTypes = swTypeRepo.GetAllValid();

            TestCategoryRepository testCatRepo = new TestCategoryRepository();

            ViewBag.TestCategories = testCatRepo.GetAllValid();

            ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>();
            Tester tester = userRepo.GetByUserName(User.Identity.Name);

            int itemsOnPage = 8;
            int pg          = page ?? 1;
            int startIndex  = (pg * itemsOnPage) - itemsOnPage;

            SoftwareType swType = null;

            if (swTypeGuid != null)
            {
                swType           = swTypeRepo.GetById((Guid)swTypeGuid);
                ViewBag.SoftType = swType;
            }

            TestCategory testCat = null;

            if (testCatGuid != null)
            {
                testCat = testCatRepo.GetById((Guid)testCatGuid);
                ViewBag.TestCategory = testCat;
            }

            ViewBag.CurrentSearch = searchTerm;
            IList <TestsStatus> statuses = new List <TestsStatus>();

            statuses.Add(TestsStatus.Finished);
            statuses.Add(TestsStatus.Reviewed);
            IList <DataAccess.Model.Tests.Tests> tests = testsRepo.GetAvailableEntities(out var totalTests, tester, statuses, swType, testCat, startIndex, itemsOnPage, searchTerm);

            ViewBag.Pages       = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage);
            ViewBag.CurrentPage = pg;

            if (Request.IsAjaxRequest())
            {
                return(PartialView(tests));
            }

            return(View(tests));
        }
Exemple #25
0
 public WorkRequest(DbWorkRequest dbWorkRequest)
 {
     WorkRequestId = dbWorkRequest.DbWorkRequestId;
     RequestNumber = dbWorkRequest.RequestNumber;
     RequestDate   = dbWorkRequest.RequestDate;
     Description   = dbWorkRequest.Description;
     WorkType      = new WorkType(dbWorkRequest.DbWorkType);
     WorkStatus    = new WorkStatus(dbWorkRequest.DbWorkStatus);
     SoftwareType  = new SoftwareType(dbWorkRequest.DbSoftwareType);
     RequestNumber = dbWorkRequest.RequestNumber;
     CreatedByUser = new User(dbWorkRequest.DbCreatedByUser);
     UsersAssigned = dbWorkRequest.DbUserWorkRequests.Select(dbUserWorkRequest => dbUserWorkRequest.DbUser).ToList().Select(dbUser => new User(dbUser)).ToList();
     Customer      = new Customer(dbWorkRequest.DbCustomer);
 }
        public IActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            SoftwareType softwareType = service.FindById(id.Value);

            if (softwareType == null)
            {
                return(NotFound());
            }
            return(View(softwareType));
        }
Exemple #27
0
        public async Task <ActionResult> TesterTests(int?page, Guid?swTypeGuid, Guid?testCatGuid, string searchTerm)
        {
            TestCaseRepository testCaseRepo = new TestCaseRepository();

            ApplicationUserRepository <Tester> userRepo = new ApplicationUserRepository <Tester>();
            var testerTask = userRepo.GetByUserNameAsync(User.Identity.Name);

            SoftwareTypeRepository swTypeRepo = new SoftwareTypeRepository();

            ViewBag.SoftTypes = swTypeRepo.GetAllValid();

            TestCategoryRepository testCatRepo = new TestCategoryRepository();

            ViewBag.TestCategories = testCatRepo.GetAllValid();

            int itemsOnPage = 8;
            int pg          = page ?? 1;
            int startIndex  = (pg * itemsOnPage) - itemsOnPage;

            SoftwareType swType = null;

            if (swTypeGuid != null)
            {
                swType           = swTypeRepo.GetById((Guid)swTypeGuid);
                ViewBag.SoftType = swType;
            }

            TestCategory testCat = null;

            if (testCatGuid != null)
            {
                testCat = testCatRepo.GetById((Guid)testCatGuid);
                ViewBag.TestCategory = testCat;
            }

            ViewBag.CurrentSearch = searchTerm;
            IList <TestCase> testCases = testCaseRepo.GetAvailableEntities(out var totalTests, DateTime.Today, await testerTask, swType, testCat, startIndex, itemsOnPage, searchTerm);

            ViewBag.Pages       = (int)Math.Ceiling((double)totalTests / (double)itemsOnPage);
            ViewBag.CurrentPage = pg;

            if (Request.IsAjaxRequest())
            {
                return(PartialView(testCases));
            }

            return(View(testCases));
        }
 /// <summary>
 /// Fills the DetailBoxes with the selectedSoftwaretype
 /// </summary>
 /// <param name="type"></param>
 public void Update(SoftwareType type)
 {
     updateProcess = true;
     if (type != null)
     {
         tbName.Text              = type.Name;
         tbDescription.Text       = type.Description;
         slRandom.Value           = type.Random * 100;
         ratPopularity.Value      = type.Popularity * 10;
         cbOSSpecific.IsChecked   = type.OSSpecific;
         cbOneClient.IsChecked    = type.OneClient;
         cbInHouse.IsChecked      = type.InHouse;
         tbOSLimit.Text           = type.OSLimit;
         tbCategory.Text          = type.Category;
         tbOSLimit.Text           = type.OSLimit;
         dgCategories.ItemsSource = null;
         dgCategories.ItemsSource = type.Categories;
         Main.SoftwareTypeManager.SoftwareTypes.SetCurrent(type);
     }
     else
     {
         Main.SoftwareTypeManager.SoftwareTypes.ClearCurrent();
         tbName.Text              = "";
         tbDescription.Text       = "";
         slRandom.Value           = 5;
         ratPopularity.Value      = 0;
         cbOSSpecific.IsChecked   = false;
         cbOneClient.IsChecked    = false;
         cbInHouse.IsChecked      = false;
         tbOSLimit.Text           = "";
         tbCategory.Text          = "";
         tbOSLimit.Text           = "";
         dgCategories.ItemsSource = null;
         dgTypes.SelectedItem     = null;
     }
     dgTypes.ItemsSource = Main.SoftwareTypeManager.SoftwareTypes;
     ucFeatureManager.Update();
     Changeable    = true;
     updateProcess = false;
 }
Exemple #29
0
 public override string ToString()
 {
     return
         ("HardwareVendorID = " + HardwareVendorID.ToString() + Environment.NewLine +
          "HardwareType = " + HardwareType.ToString() + Environment.NewLine +
          "HardwareSubType = " + HardwareSubType.ToString() + Environment.NewLine +
          "HardwareMajorVersion = " + HardwareMajorVersion.ToString() + Environment.NewLine +
          "HardwareMinorVersion = " + HardwareMinorVersion.ToString() + Environment.NewLine +
          "HardwareStorageSize = " + HardwareStorageSize.ToString() + Environment.NewLine +
          "HardwareProtocolType = " + HardwareProtocolType.ToString() + Environment.NewLine +
          "SoftwareVendorID = " + SoftwareVendorID.ToString() + Environment.NewLine +
          "SoftwareType = " + SoftwareType.ToString() + Environment.NewLine +
          "SoftwareSubType = " + SoftwareSubType.ToString() + Environment.NewLine +
          "SoftwareMajorVersion = " + SoftwareMajorVersion.ToString() + Environment.NewLine +
          "SoftwareMinorVersion = " + SoftwareMinorVersion.ToString() + Environment.NewLine +
          "SoftwareStorageSize = " + SoftwareStorageSize.ToString() + Environment.NewLine +
          "SoftwareProtocolType = " + SoftwareProtocolType.ToString() + Environment.NewLine +
          "UID = " + BitConverter.ToString(UID) + Environment.NewLine +
          "ProductionBatchNumber = " + BitConverter.ToString(ProductionBatchNumber) + Environment.NewLine +
          "WeekOfProduction = " + WeekOfProduction.ToString() + Environment.NewLine +
          "YearOfProduction = " + YearOfProduction.ToString() + Environment.NewLine);
 }
        /// <summary>
        /// opens the Mod From the path
        /// </summary>
        /// <param name="path"></param>
        public void Open(string rootPath)
        {
            Mod.Path = rootPath;
            var path = Path.Combine(rootPath, "SoftwareTypes");

            if (Functions.CheckDirectoryOrFile(path))
            {
                var files = Directory.GetFiles(path);

                var xmlManager = new XmlManager <SoftwareType>();
                foreach (var f in files)
                {
                    SoftwareType st = xmlManager.ReadFile(f);
                    SoftwareTypeManager.SoftwareTypes.Add(st);
                }
            }

            //TODO: Read Other Components


            OnNeedUpdate();
        }
Exemple #31
0
 public SoftwareType AddSoftwareType(SoftwareType softwareType)
 {
     var newType = licenceTrackerContext.SoftwareTypes.Add(softwareType);
     licenceTrackerContext.SaveChanges();
     return newType;
 }