public InstanceServerContext(ISerializer serializer, IServerTransport transport) : base(serializer)
        {
            Transport = transport;

            OperationSystem = new OperationSystem(OperationMap, new SerializationService(Serializer), Transport, new OperationHandlerFactory(Container).CreateHandler);
            OperationSystem.Dispatcher.InitializeContext(ContextType.InstanceServer);
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("OSId,OSName")] OperationSystem operationSystem)
        {
            if (id != operationSystem.OSId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(operationSystem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OperationSystemExists(operationSystem.OSId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(operationSystem));
        }
Example #3
0
        protected ClientContextBase(ISerializer serializer, IClientTransport transport)
        {
            Serializer = serializer;
            Transport  = transport;

            OperationSystem = new OperationSystem(new OperationMap(), new SerializationService(serializer), Transport, HandlerFactory);
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the computer class.
        /// </summary>
        /// <param name="system">System.</param>
        /// <param name="prob">Prob.</param>
        public Computer(int i)
        {
            switch (i)
            {
            case 0:
            {
                OS = new OperationSystem(30);
                //linux
                return;
            }

            case 1:
            {
                OS = new OperationSystem(60);
                //mac
                return;
            }

            case 2:
            {
                OS = new OperationSystem(100);
                //windows
                return;
            }

            case 3:
            {
                OS = new OperationSystem(1);
                //superOS
                return;
            }
            }
            Infected = false;
        }
        protected ClientContextBase(ServerContextBase application, IServerTransport transport)
        {
            Application = application;
            Transport   = transport;

            Scope           = Application.Container.BeginLifetimeScope(this);
            OperationSystem = new OperationSystem(Application.OperationMap, new SerializationService(Application.Serializer), Transport, HandlerFactory);
        }
Example #6
0
  void End()
  {
    if (m_EndOperationWhenFinished)
    {
      m_EndOperationWhenFinished = false;
      OperationSystem.EndOperation();
    }

    AttemptDeactivate();
  }
Example #7
0
    public void BeginBatch(string name = "Operation", bool incrementOperationCounter = true)
    {
        if (OperationSystem.s_Frozen)
        {
            return;
        }

        OperationSystem.BeginOperation(name, incrementOperationCounter);
        m_BatchedIndices = new List <Vector2Int>();
    }
Example #8
0
        public async Task <IActionResult> Create([Bind("OSId,OSName")] OperationSystem operationSystem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(operationSystem);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(operationSystem));
        }
Example #9
0
    public void EndBatch(bool createDialogs = true)
    {
        if (!OperationSystem.s_Frozen)
        {
            var message = "The tile grid was asked to end a batch when " +
                          "no batch had been begun! Proceed with caution.";
            Debug.LogError(message);

            return;
        }

        m_BatchedIndices = null;

        // now, any modal dialogs that want to be spawned by the most
        // recently placed tile will be pushed onto a stack. as long as
        // a modal dialog is still up and running, it is free to modify
        // the deltas in the latest operation. when the last one is
        // closed, the ModalDialogMaster will call OperationSystem.EndOperation,
        // and the user will regain control
        //
        // however, if the latest tile doesn't need to open a dialog
        // window, then we can skip all of that, and we can just call
        // EndOperation here and now

        // the most recently created tile will be null if the last thing
        // the user did was erase something
        if (m_MostRecentlyCreatedTile == null)
        {
            OperationSystem.EndOperation();
            return;
        }

        if (createDialogs)
        {
            var modalDialogAdder = m_MostRecentlyCreatedTile.GetComponent <ModalDialogAdder>();
            if (modalDialogAdder == null)
            {
                OperationSystem.EndOperation();
            }
            else
            {
                modalDialogAdder.RequestDialogsAtTransform();
            }
        }
        else
        {
            OperationSystem.EndOperation();
        }

        // it is understood that the ModalDialogMaster will call
        // EndOperation when the last dialog is closed

        m_MostRecentlyCreatedTile = null;
    }
Example #10
0
        private string GetLineSplit(OperationSystem os)
        {
            switch (os)
            {
                case OperationSystem.Windows:
                    return "\r\n";

                case OperationSystem.MacOS:
                    return "\r";

                case OperationSystem.Linux:
                    return "\n";
            }
            return "\r\n";
        }
Example #11
0
        private string GetLineSplit(OperationSystem os)
        {
            switch (os)
            {
            case OperationSystem.Windows:
                return("\r\n");

            case OperationSystem.MacOS:
                return("\r");

            case OperationSystem.Linux:
                return("\n");
            }
            return("\r\n");
        }
Example #12
0
        private string GetBasePathAccordingSystem(OperationSystem operationSystem)
        {
            var result = string.Empty;

            switch (operationSystem)
            {
            case OperationSystem.Android:
                result = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                break;

            case OperationSystem.Ios:
                result = Directory.GetCurrentDirectory();
                break;
            }

            return(result);
        }
Example #13
0
    private void Awake()
    {
        if (Instance != null)
        {
            var thisGameObjectName     = gameObject.name;
            var instanceGameObjectName = Instance.gameObject.name;
            var messageString          = $"An OperationSystem is being created on {thisGameObjectName}" +
                                         " when one is already present on {instanceGameObjectName}";
            throw new SingletonInstanceAlreadyExistsException(messageString);
        }

        Instance = this;

        s_Operations.Capacity = Instance.m_UndoDepth;
        s_UseAutosaving       = m_UseAutosaving;
        s_AutosaveInterval    = m_AutosaveInterval;
    }
Example #14
0
        public static string SendPushNotification(int templateId, string token, OperationSystem os, Dictionary <string, Object> information = null)
        {
            PushNotificationDistribution messageDistribution = new PushNotificationDistribution()
            {
                Template = new Template {
                    Id = templateId
                },
                To = new List <IContact>()
                {
                    new Contact()
                    {
                        Token = token, OS = os, Info = information
                    }
                }
            };

            return(SendMessage(messageDistribution));
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            switch (cbxCodeType.Text)
            {
            case "拼音":
                SelectedCodeType = CodeType.Pinyin;
                break;

            case "五笔":
                SelectedCodeType = CodeType.Wubi;
                break;

            case "注音":
                SelectedCodeType = CodeType.TerraPinyin;
                break;

            case "仓颉":
                SelectedCodeType = CodeType.Cangjie;
                break;

            case "其他":
                SelectedCodeType = CodeType.Unknown;
                break;

            default:
                SelectedCodeType = CodeType.Unknown;
                break;
            }
            if (rbWin.Checked)
            {
                SelectedOS = OperationSystem.Windows;
            }
            else if (rbMac.Checked)
            {
                SelectedOS = OperationSystem.MacOS;
            }
            else
            {
                SelectedOS = OperationSystem.Linux;
            }
            DialogResult = DialogResult.OK;
        }
Example #16
0
        public async Task <ActionResult> Edit(OperationSystem os)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    await context.UpdatingOperationSystem(os);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View());
                }
            }
            catch
            {
                return(View());
            }
        }
Example #17
0
        public async Task <ActionResult> Create(OperationSystem collection)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    await context.AddingOperationSystem(collection);
                }
                else
                {
                    return(View());
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Example #18
0
        /// <summary>
        /// Read information from file.
        /// </summary>
        /// <param name="fileName"> Name of file. </param>
        private void ReadFromFile(string fileName)
        {
            StreamReader reader = new StreamReader(fileName);
            if (reader == null)
            {
                throw new FileLoadException("Can't open", fileName);
            }

            // Number of comps and matrix.
            numberOfComps = Convert.ToInt32(reader.ReadLine());
            compsMatrix = new Matrix(reader, numberOfComps);

            // Chance of Infection with number os OS.
            int numberOfOS = Convert.ToInt32(reader.ReadLine());
            opSysts = new OperationSystem[numberOfOS];
            for (int i = 0; i < numberOfOS; i++)
            {
                string[] temp = reader.ReadLine().Split(' ');
                opSysts[i] = new OperationSystem(temp[0], 100 / Convert.ToInt32(temp[1]));
            }

            // Computer's OS.
            comps = new Comp[numberOfComps];
            for (int i = 0; i < numberOfComps; i++)
            {
                comps[i] = new Comp(false, OpSystWithName(reader.ReadLine().Split(' ')[1]));
            }

            // Infected.
            numberOfInfected = 0;
            string[] arrayInfected = reader.ReadLine().Split(' ');
            for (int i = 0; i < arrayInfected.Length; i++)
            {
                comps[Convert.ToInt32(arrayInfected[i]) - 1].IsInfected = true;
                numberOfInfected++;
            }

            reader.Close();
        }
Example #19
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     switch (cbxCodeType.Text)
     {
         case "拼音":
             SelectedCodeType = CodeType.Pinyin;
             break;
         case "五笔":
             SelectedCodeType = CodeType.Wubi;
             break;
         case "注音":
             SelectedCodeType = CodeType.TerraPinyin;
             break;
         case "仓颉":
             SelectedCodeType = CodeType.Cangjie;
             break;
         case "其他":
             SelectedCodeType = CodeType.Unknown;
             break;
         default:
             SelectedCodeType = CodeType.Unknown;
             break;
     }
     if (rbWin.Checked)
     {
         SelectedOS = OperationSystem.Windows;
     }
     else if (rbMac.Checked)
     {
         SelectedOS = OperationSystem.MacOS;
     }
     else
     {
         SelectedOS = OperationSystem.Linux;
     }
     DialogResult = DialogResult.OK;
 }
Example #20
0
 public ComputerInfo(OperationSystem operatingSystem, string processor, int ram)
 {
     this.os        = operatingSystem;
     this.processor = processor;
     this.ram       = ram;
 }
Example #21
0
 public Comp(bool isInfected, OperationSystem opSyst)
 {
     this.IsInfected = isInfected;
     this.opSyst = opSyst;
 }
Example #22
0
    void AddRequestHelper(Vector2Int gridIndex, TileState state, bool cloning,
                          bool recomputeBounds)
    {
        // Get now always returns an element, it just might be empty
        var oldElement = Get(gridIndex);
        var tileType   = state.Type;

        // here is where i would put the code that would ignore a
        // request for an identical tile to the one already present
        // IF IT WERE POSSIBLE >:(((
        //
        // the problem is that you should be able to replace one
        // coded tile with another of a different code, but we don't
        // yet know the code of the incoming tile, and we won't know
        // it until the user has selected it from the modal dialog
        // that we haven't made yet. so just forget about it already

        // are we erasing?
        if (tileType == TileType.EMPTY)
        {
            // if the requested index is already empty, forget it
            if (oldElement.m_Type == TileType.EMPTY)
            {
                return;
            }

            // newElement is null
            OperationSystem.AddDelta(oldElement, null);
            EraseTile(gridIndex);

            if (recomputeBounds)
            {
                RecomputeBoundsGivenRemovalAtIndex(gridIndex);
            }
        }
        else
        {
            // are we replacing or just creating?
            if (oldElement.m_Type == TileType.EMPTY)
            {
                // creating without replacing
                var newElement = CreateTile(gridIndex, state, cloning);
                var tile       = newElement.m_GameObject;

                // oldElement is null
                OperationSystem.AddDelta(null, newElement, tile);

                if (recomputeBounds)
                {
                    RecomputeBoundsGivenNewIndex(gridIndex);
                }
            }
            else
            {
                // replacing an existing tile
                var oldState = oldElement.ToState();
                EraseTile(gridIndex);
                var newElement = CreateTile(gridIndex, state, cloning);
                var newState   = newElement.ToState();
                var tile       = newElement.m_GameObject;
                OperationSystem.AddDelta(gridIndex, oldState, newState, tile);

                // there's no need to recompute bounds in this case,
                // even if it's asked for, because we're replacing,
                // so there was necessarily already something here
                // that bounds computation has already accounted for
            }
        }
    }
Example #23
0
        // 对象进入场景,在这里初始化各种数据, 资源, 模型等
        // 传入数据。
        override public void OnEnterWorld()
        {
            base.OnEnterWorld();
            LoggerHelper.Info("Avatar name: " + name);
            // 在调用该函数前, 数据已经通过EntityAttach 和 EntityCellAttach 同步完毕
            CreateModel();
            inventoryManager = new InventoryManager(this);
            bodyenhanceManager = new BodyEnhanceManager(this);
            skillManager = new PlayerSkillManager(this);
            battleManger = new PlayerBattleManager(this, skillManager as PlayerSkillManager);

            doorOfBurySystem = new DoorOfBurySystem();
            runeManager = new RuneManager(this);
            towerManager = new TowerManager(this);
            missionManager = new MissionManager(this);
            taskManager = new TaskManager(this, (int)taskMain);
            marketManager = new MarketManager(this);
            friendManager = new FriendManager(this);
            operationSystem = new OperationSystem(this);
            sanctuaryManager = new SanctuaryManager(this);
            arenaManager = new ArenaManager(this);
            dailyEventSystem = new DailyEventSystem(this);
            rankManager = new RankManager(this);
            campaignSystem = new CampaignSystem(this);
            wingManager = new WingManager(this);
            rewardManager = new RewardManager(this);
            occupyTowerSystem = new OccupyTowerSystem(this);

            TipManager.Init();
            DragonMatchManager.Init();
            fumoManager = new FumoManager(this);

            MailManager.Instance.IsMailInfoDirty = true;
            TongManager.Instance.Init();
            GuideSystem.Instance.AddListeners();
            StoryManager.Instance.AddListeners();
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnNormalAttack, NormalAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeStart, PowerChargeStart);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeInterrupt, PowerChargeInterrupt);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnPowerChargeComplete, PowerChargeComplete);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellOneAttack, SpellOneAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellTwoAttack, SpellTwoAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellThreeAttack, SpellThreeAttack);
            EventDispatcher.AddEventListener(Events.UIBattleEvent.OnSpellXPAttack, SpecialAttack);
            EventDispatcher.AddEventListener<int>(Events.UIBattleEvent.OnSpriteSkill, OnSpriteSkill);

            EventDispatcher.AddEventListener<uint>(Events.GearEvent.Teleport, Teleport);
            EventDispatcher.AddEventListener<uint, int, int, int>(Events.GearEvent.Damage, SetDamage);

            EventDispatcher.AddEventListener<int, bool>(Events.InstanceEvent.InstanceLoaded, InstanceLoaded);
            EventDispatcher.AddEventListener<ushort>(Events.OtherEvent.MapIdChanged, OnMapChanged);
            EventDispatcher.AddEventListener<ulong>(Events.OtherEvent.Withdraw, Withdraw);
            EventDispatcher.AddEventListener(Events.OtherEvent.DiamondMine, DiamondMine);
            EventDispatcher.AddEventListener(Events.OtherEvent.CheckCharge, CheckCharge);
            EventDispatcher.AddEventListener(Events.OtherEvent.Charge, Charge);

            EventDispatcher.AddEventListener(ON_TASK_GUIDE, TaskGuide);
            EventDispatcher.AddEventListener(ON_END_TASK_GUIDE, EndTaskGuide);
            EventDispatcher.AddEventListener<int, int>(ON_TASK_MISSION, MissionOpen);

            EventDispatcher.AddEventListener(Events.AIEvent.DummyThink, DummyThink);
            EventDispatcher.AddEventListener(Events.StoryEvent.CGBegin, ProcCGBegin);
            EventDispatcher.AddEventListener(Events.StoryEvent.CGEnd, ProcCGEnd);
            EventDispatcher.AddEventListener<string>(Events.GearEvent.TrapBegin, ProcTrapBegin);
            EventDispatcher.AddEventListener<string>(Events.GearEvent.TrapEnd, ProcTrapEnd);
            EventDispatcher.AddEventListener(Events.GearEvent.LiftEnter, ProcLiftEnter);
            EventDispatcher.AddEventListener<int>(Events.GearEvent.PathPointTrigger, PathPointTrigger);
            EventDispatcher.AddEventListener(Events.DirecterEvent.DirActive, DirActive);

            EventDispatcher.AddEventListener<int>(Events.EnergyEvent.BuyEnergy, BuyEnergy);
            EventDispatcher.AddEventListener(ON_VIP_REAL_STATE, OnVIPRealState);

            EventDispatcher.AddEventListener<int>(Events.DiamondToGoldEvent.GoldMetallurgy, GoldMetallurgy);

            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.AFFECTUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.OUTPUTUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.MOVEUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.NORMALATTACK, OnBattleBtnPressed);
            EventDispatcher.AddEventListener(MainUIDict.MainUIEvent.PLAYERINFOBGUP, OnBattleBtnPressed);
            EventDispatcher.AddEventListener("MainUIControllStickPressed", OnBattleBtnPressed);

            EventDispatcher.AddEventListener<Vector3>(Events.GearEvent.CrockBroken, CrockBroken);
            EventDispatcher.AddEventListener<bool, bool, Vector3>(Events.GearEvent.ChestBroken, ChestBroken);

            EventDispatcher.AddEventListener<GameObject, Vector3, float>(MogoMotor.ON_MOVE_TO_FALSE, OnMoveToFalse);
            EventDispatcher.AddEventListener(Events.OtherEvent.BossDie, BossDie);

            EventDispatcher.AddEventListener<int, bool>(Events.InstanceEvent.InstanceLoaded, SetCampControl);

            timerID = TimerHeap.AddTimer<bool>(1000, 100, SyncPos, true);
            checkDmgID = TimerHeap.AddTimer(0, 1000, CheckDmgBase);
            syncHpTimerID = TimerHeap.AddTimer(10000, 5000, SyncHp);
            skillFailoverTimer = TimerHeap.AddTimer(1000, 3000, SkillFailover);
            TimerHeap.AddTimer(5000, 0, GetServerTickReq);
            //rateTimer = TimerHeap.AddTimer(1000, 3000, CheckRate);
            CheckCharge();
            GetWingBag();
            MogoTime.Instance.InitTimeFromServer();

            MogoUIManager.Instance.LoadUIResources();
            TimerHeap.AddTimer(500, 0, EventDispatcher.TriggerEvent, Events.RuneEvent.GetBodyRunes);
            TimerHeap.AddTimer(500, 0, marketManager.GiftRecordReq);

            if (IsNewPlayer)
            {
                CurMissionID = 10100;
                CurMissionLevel = 1;

                missionManager.EnterMissionReq(CurMissionID, CurMissionLevel);
            }


            if (PlatformSdkManager.Instance)
                TimerHeap.AddTimer(1000, 60000, PlatformSdkManager.Instance.OnSetupNotification);
        }
Example #24
0
        public void SetInListPC(string name, string processor, string videocard, string memory, string drive, string systemName, string systemVersion)
        {
            CalculatorRank Rank = new CalculatorRank();

            connection.Open();
            string           sql = "";
            SQLiteCommand    command;
            SQLiteDataReader dataReader;

            name = name + "  #" + DateTimeOffset.Now.ToUnixTimeSeconds() + "";

            sql        = "select * from InfoCPU where Name = '" + processor + "'";
            command    = new SQLiteCommand(sql, connection);
            dataReader = command.ExecuteReader();
            Processor Processor = null;

            while (dataReader.Read())
            {
                Processor = new Processor(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), dataReader.GetString(4), dataReader.GetString(5), dataReader.GetInt32(6));
            }

            sql        = "select * from InfoGPU where Name = '" + videocard + "'";
            command    = new SQLiteCommand(sql, connection);
            dataReader = command.ExecuteReader();
            Videocard Videocard = null;

            while (dataReader.Read())
            {
                Videocard = new Videocard(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), dataReader.GetInt32(4), dataReader.GetString(5));
            }

            sql        = "select * from RAM where Name = '" + memory + "'";
            command    = new SQLiteCommand(sql, connection);
            dataReader = command.ExecuteReader();
            PhysicalMemory Memory = null;

            while (dataReader.Read())
            {
                Memory = new PhysicalMemory(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetInt32(3), dataReader.GetInt32(4), dataReader.GetInt32(5));
            }

            sql        = "select * from InfoHARD where Name = '" + drive + "'";
            command    = new SQLiteCommand(sql, connection);
            dataReader = command.ExecuteReader();
            HardDrive Drive = null;

            while (dataReader.Read())
            {
                Drive = new HardDrive(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), dataReader.GetString(4), dataReader.GetInt32(5));
            }

            OperationSystem System = new OperationSystem(systemName, systemVersion);

            int RankPC = Rank.GetComputerRank(Processor.Rank, Videocard.Rank, Memory.Rank, Drive.Rank);

            Singleton.Computers.Add(
                new Computer
            {
                Name      = name,
                Processor = Processor,
                Videocard = Videocard,
                Memory    = Memory,
                Drive     = Drive,
                System    = System,
                RankPC    = RankPC
            });
            connection.Close();
            Singleton.ComputerName = name;
        }
Example #25
0
 public FileSystemProvider(OperationSystem operationSystem)
 {
     _folderPrefix = GetBasePathAccordingSystem(operationSystem);
 }
Example #26
0
 public void AttemptUndo()
 {
     OperationSystem.AttemptUndo();
 }
Example #27
0
        public void SetInListPC(string name, string processor, string videocard, string memory, string drive, string systemName, string systemVersion)
        {
            PowerShell     powerShell = PowerShell.Create();
            Scripts        sc         = new Scripts();
            CalculatorRank Rank       = new CalculatorRank();

            connection.Open();
            string           sql = "";
            SQLiteCommand    command;
            SQLiteDataReader dataReader;

            /// <summary>
            /// Получение системного имени компьютера
            /// </summary>
            name = Environment.MachineName;
            /// <summary>
            /// Получение названия процессора из системы и по этому названию остальных параметров
            /// </summary>
            this.mos = new ManagementObjectSearcher("root\\CIMV2", sc.scriptProcessor);
            foreach (ManagementObject mo in mos.Get())
            {
                processor = mo["Name"].ToString();
            }
            Processor Processor = null;

            if (processor.Contains("Intel(R)"))
            {
                sql        = "select * from CPU where Name = '" + processor + "'";
                command    = new SQLiteCommand(sql, connection);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    Processor = new Processor(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), null, null, dataReader.GetInt32(4));
                }
            }
            else
            {
                string[] str = processor.Split(' ');
                sql        = "select Name from CPU where Name like '%" + str[0] + " " + str[1] + "%'";
                command    = new SQLiteCommand(sql, connection);
                dataReader = command.ExecuteReader();
                List <string> Names = new List <string>();
                while (dataReader.Read())
                {
                    Names.Add(dataReader.GetString(0));
                }
                foreach (string item in Names)
                {
                    if (processor.Contains(item))
                    {
                        processor = item;
                    }
                }
                sql        = "select * from CPU where Name = '" + processor + "'";
                command    = new SQLiteCommand(sql, connection);
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    Processor = new Processor(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), null, null, dataReader.GetInt32(4));
                }
            }
            /// <summary>
            /// Получение названия видеокарты из системы и остальных параметров из бд (по названию)
            /// </summary>
            this.mos = new ManagementObjectSearcher("root\\CIMV2", sc.scriptVideocard);
            List <string> vs = new List <string>();

            foreach (ManagementObject mo in mos.Get())
            {
                vs.Add(mo["Name"].ToString());
            }
            videocard = vs.FirstOrDefault();
            Videocard Videocard = null;

            sql        = "select * from GPU where Name like '%" + videocard + "%'";
            command    = new SQLiteCommand(sql, connection);
            dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                Videocard = new Videocard(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), dataReader.GetInt32(4), null);
            }
            /// <summary>
            /// Получение характеристик оперативной памяти из системы и остальных параметров из бд (по названию)
            /// </summary>
            string ddr4         = "DDR4";
            string ddr3         = "DDR3";
            string ddr2         = "DDR2";
            int    MaxCapacity  = 0;
            int    Speed        = 0;
            string TypeOfMemory = String.Empty;

            //List<String> DataList = new List<string>();
            powerShell.AddScript(sc.scriptMemory);
            Collection <PSObject> results = powerShell.Invoke();

            results = powerShell.Invoke();
            foreach (var item in results)
            {
                int tempSize = 0;
                if (item.ToString().Contains("Size, GB"))
                {
                    int.TryParse(string.Join("", item.ToString().Where(c => char.IsDigit(c))), out tempSize);
                }
                MaxCapacity += tempSize;

                int tempFreq = 0;
                if (item.ToString().Contains("Speed, MHz"))
                {
                    int.TryParse(string.Join("", item.ToString().Where(c => char.IsDigit(c))), out tempFreq);
                    Speed = tempFreq;
                }

                if (item.ToString().Contains(ddr4))
                {
                    TypeOfMemory = ddr4;
                }
                if (item.ToString().Contains(ddr3))
                {
                    TypeOfMemory = ddr3;
                }
                if (item.ToString().Contains(ddr2))
                {
                    TypeOfMemory = ddr2;
                }
            }
            memory = TypeOfMemory + ", " + MaxCapacity + " GB, " + Speed + " MHz";
            PhysicalMemory Memory = null;

            sql        = "select * from RAM where Name like '" + memory + "'";
            command    = new SQLiteCommand(sql, connection);
            dataReader = command.ExecuteReader();
            while (dataReader.Read())
            {
                Memory = new PhysicalMemory(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetInt32(3), dataReader.GetInt32(4), dataReader.GetInt32(5));
            }
            /// <summary>
            /// Получение характеристик жёсткого диска из системы и остальных параметров
            /// </summary>
            mos = new ManagementObjectSearcher("root\\CIMV2", sc.scriptHardDrive);
            Dictionary <string, string> dict = new Dictionary <string, string>();

            foreach (ManagementObject mo in mos.Get())
            {
                string size = String.Empty;
                drive = mo["Model"].ToString();
                if (Math.Round(Convert.ToDouble(mo["Size"]) / 1073741824, 1) > 1000)
                {
                    size = Math.Round((Convert.ToDouble(mo["Size"]) / 1073741824) / 1024, 1) + " TB";
                }
                else
                {
                    size = Math.Round(Convert.ToDouble(mo["Size"]) / 1073741824, 1) + " GB";
                }
                dict.Add(drive, size);
            }
            HardDrive Drive   = null;
            int       maxRank = 0;

            foreach (var item in dict)
            {
                string[] str = item.Key.Split(' ');
                if (str.Length < 2)
                {
                    sql        = "select * from HARD where Name like '%" + str[0] + "%' and Value = '" + item.Value + "'";
                    command    = new SQLiteCommand(sql, connection);
                    dataReader = command.ExecuteReader();
                    while (dataReader.Read())
                    {
                        if (dataReader.GetInt32(5) > maxRank)
                        {
                            Drive   = new HardDrive(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), dataReader.GetString(4), dataReader.GetInt32(5));
                            maxRank = dataReader.GetInt32(5);
                        }
                    }
                }
                else
                {
                    sql        = "select * from HARD where Name like '%" + str[0] + " " + str[1] + "%' and Value = '" + item.Value + "'";
                    command    = new SQLiteCommand(sql, connection);
                    dataReader = command.ExecuteReader();
                    while (dataReader.Read())
                    {
                        if (dataReader.GetInt32(5) > maxRank)
                        {
                            Drive   = new HardDrive(dataReader.GetInt32(0), dataReader.GetString(1), dataReader.GetString(2), dataReader.GetString(3), dataReader.GetString(4), dataReader.GetInt32(5));
                            maxRank = dataReader.GetInt32(5);
                        }
                    }
                }
            }
            /// <summary>
            /// Получение параметров операционной системы
            /// </summary>
            String          subKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion";
            RegistryKey     key    = Registry.LocalMachine;
            RegistryKey     skey   = key.OpenSubKey(subKey);
            OperationSystem System = null;

            System = new OperationSystem(skey.GetValue("ProductName").ToString(), (Environment.Is64BitOperatingSystem ? 64 : 32) + " Bit");
            /// <summary>
            /// Расчёт рейтинга системы
            /// </summary>
            int RankPC = Rank.GetComputerRank(Processor.Rank, Videocard.Rank, Memory.Rank, Drive.Rank);

            Singleton.Computers.Add(
                new Computer
            {
                Name      = name,
                Processor = Processor,
                Videocard = Videocard,
                Memory    = Memory,
                Drive     = Drive,
                System    = System,
                RankPC    = RankPC
            });
            Singleton.ComputerName = name;
            connection.Close();
        }