Exemplo n.º 1
0
 public void Poll_PotNotEmptyClosesValve(
     [Frozen]Mock<ICoffeeMaker> coffeeMaker,
     Valve sut)
 {
     sut.Poll(WarmerPlateStatus.POT_NOT_EMPTY);
     coffeeMaker.Verify(cm => cm.SetReliefValveState(ReliefValveState.CLOSED));
 }
Exemplo n.º 2
0
	public void Set(SteamVR vr, Valve.VR.EVREye eye)
	{
		int i = (int)eye;
		if (hiddenAreaMeshes[i] == null)
			hiddenAreaMeshes[i] = SteamVR_Utils.CreateHiddenAreaMesh(vr.hmd.GetHiddenAreaMesh(eye), vr.textureBounds[i]);
		meshFilter.mesh = hiddenAreaMeshes[i];
	}
Exemplo n.º 3
0
 public void Poll_WarmerEmptyOpensValve(
     [Frozen]Mock<ICoffeeMaker> coffeeMaker,
     Valve sut)
 {
     sut.Poll(WarmerPlateStatus.WARMER_EMPTY);
     coffeeMaker.Verify(cm => cm.SetReliefValveState(ReliefValveState.OPEN));
 }
Exemplo n.º 4
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_RemoteStorageEnumerateWorkshopFilesResult_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CRemoteStorageEnumerateWorkshopFilesResult_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CRemoteStorageEnumerateWorkshopFilesResult_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 5
0
 public override Result PatternWeightExecute(Directive directive, Valve valve)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
        /// <summary>
        /// 称重打胶
        /// </summary>
        public Result Spray(Valve valve)
        {
            Result ret = FluiderFactory.Instance.CreatFluider(this.Valve).GetLinable().PatternWeightExecute(this, valve);

            return(ret);
        }
Exemplo n.º 7
0
 public ValveLabelsControl(Valve uo) : this()
 {
     this.InitializeVariableLabels(uo);
 }
Exemplo n.º 8
0
 public abstract Result PatternWeightExecute(Directive directive, Valve valve);
Exemplo n.º 9
0
 public override Result PatternWeightExecute(Directive directive, Valve valve)
 {
     return(Result.OK);
 }
Exemplo n.º 10
0
        public void Write(IDataReader reader)
        {
            var organization     = db.Organizations.Find(organizationId);
            HashSet <string> map = new HashSet <string>();

            while (reader.Read())
            {
                // columns
                // mfg, model, size, ValveIntCode

                // get the valve interface
                int    valveIntCode = reader.GetInt32(3);
                string mfg          = reader.GetString(0);
                string model        = reader.GetString(1);
                string size         = reader.GetString(2);

                var valveInterface = db.ValveInterfaceCodes.Find(valveIntCode);
                if (valveInterface == null)
                {
                    valveInterface = new ValveInterfaceCode()
                    {
                        InterfaceCode = valveIntCode
                    };
                    db.ValveInterfaceCodes.Add(valveInterface);
                }

                var valve = db.Valves
                            .Where(v => v.Manufacturer == mfg)
                            .Where(v => v.Model == model)
                            .Where(v => v.Size == size).FirstOrDefault();

                if (valve == null)
                {
                    if (!map.Contains($"{mfg} {model} {size}"))
                    {
                        map.Add($"{mfg} {model} {size}");
                        valve = new Valve()
                        {
                            Manufacturer  = reader.GetString(0),
                            Model         = reader.GetString(1),
                            Size          = reader.GetString(2),
                            InterfaceCode = valveIntCode
                        };
                        db.Valves.Add(valve);
                        organization.Valves.Add(valve);
                    }
                }

                // link this valve to the organization
                if (valve != null)
                {
                    if (valve.ValveId > 0)
                    {
                        if (!organization.Valves.Where(v => v.ValveId == valve.ValveId).Any())
                        {
                            organization.Valves.Add(valve);
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Get the content-detectable protections associated with a single path
        /// </summary>
        /// <param name="file">Path to the file to scan</param>
        /// <returns>Dictionary of list of strings representing the found protections</returns>
        private ConcurrentDictionary <string, ConcurrentQueue <string> > GetInternalProtections(string file)
        {
            // Quick sanity check before continuing
            if (!File.Exists(file))
            {
                return(null);
            }

            // Initialze the protections found
            var protections = new ConcurrentDictionary <string, ConcurrentQueue <string> >();

            // Get the extension for certain checks
            string extension = Path.GetExtension(file).ToLower().TrimStart('.');

            // Open the file and begin scanning
            using (FileStream fs = File.OpenRead(file))
            {
                // Get the first 16 bytes for matching
                byte[] magic = new byte[16];
                try
                {
                    fs.Read(magic, 0, 16);
                    fs.Seek(-16, SeekOrigin.Current);
                }
                catch
                {
                    // We don't care what the issue was, we can't read or seek the file
                    return(null);
                }

                #region Non-Archive File Types

                // Executable
                if (ScanAllFiles || new Executable().ShouldScan(magic))
                {
                    var subProtections = new Executable().Scan(this, fs, file);
                    Utilities.AppendToDictionary(protections, subProtections);
                }

                // Text-based files
                if (ScanAllFiles || new Textfile().ShouldScan(magic, extension))
                {
                    var subProtections = new Textfile().Scan(this, fs, file);
                    Utilities.AppendToDictionary(protections, subProtections);
                }

                #endregion

                #region Archive File Types

                // If we're scanning archives, we have a few to try out
                if (ScanArchives)
                {
                    // 7-Zip archive
                    if (new SevenZip().ShouldScan(magic))
                    {
                        var subProtections = new SevenZip().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // BFPK archive
                    if (new BFPK().ShouldScan(magic))
                    {
                        var subProtections = new BFPK().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // BZip2
                    if (new BZip2().ShouldScan(magic))
                    {
                        var subProtections = new BZip2().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // GZIP
                    if (new GZIP().ShouldScan(magic))
                    {
                        var subProtections = new GZIP().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // InstallShield Archive V3 (Z)
                    if (file != null && new InstallShieldArchiveV3().ShouldScan(magic))
                    {
                        var subProtections = new InstallShieldArchiveV3().Scan(this, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // InstallShield Cabinet
                    if (file != null && new InstallShieldCAB().ShouldScan(magic))
                    {
                        var subProtections = new InstallShieldCAB().Scan(this, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // Microsoft Cabinet
                    if (file != null && new MicrosoftCAB().ShouldScan(magic))
                    {
                        var subProtections = new MicrosoftCAB().Scan(this, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // MSI
                    if (file != null && new MSI().ShouldScan(magic))
                    {
                        var subProtections = new MSI().Scan(this, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // MPQ archive
                    if (file != null && new MPQ().ShouldScan(magic))
                    {
                        var subProtections = new MPQ().Scan(this, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // PKZIP archive (and derivatives)
                    if (new PKZIP().ShouldScan(magic))
                    {
                        var subProtections = new PKZIP().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // RAR archive
                    if (new RAR().ShouldScan(magic))
                    {
                        var subProtections = new RAR().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // Tape Archive
                    if (new TapeArchive().ShouldScan(magic))
                    {
                        var subProtections = new TapeArchive().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // Valve archive formats
                    if (file != null && new Valve().ShouldScan(magic))
                    {
                        var subProtections = new Valve().Scan(this, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }

                    // XZ
                    if (new XZ().ShouldScan(magic))
                    {
                        var subProtections = new XZ().Scan(this, fs, file);
                        Utilities.PrependToKeys(subProtections, file);
                        Utilities.AppendToDictionary(protections, subProtections);
                    }
                }

                #endregion
            }

            // Clear out any empty keys
            Utilities.ClearEmptyKeys(protections);

            return(protections);
        }
        public async Task <int> Handle(CreateHardwareCommand request, CancellationToken cancellationToken)
        {
            var contract = await _context.Contracts.FirstOrDefaultAsync(c => c.Id == request.ContractId);

            if (contract == null)
            {
                throw new NullReferenceException("Договор с таким Id не найден.");
            }

            Hardware entity;

            switch (request.HardwareType)
            {
            case HardwareType.Cabinet:
                entity = new Cabinet
                {
                    Position      = request.Position,
                    SerialNumber  = request.SerialNumber,
                    Constructed   = (DateTime)request.Constructed,
                    ConstructedBy = request.ConstructedBy
                };
                break;

            case HardwareType.FlowComputer:
                entity = new FlowComputer
                {
                    Position        = request.Position,
                    SerialNumber    = request.SerialNumber,
                    DeviceModel     = request.DeviceModel,
                    IP              = request.IPAddress,
                    AssemblyVersion = request.AssemblyVersion,
                    CRC32           = request.CRC32,
                    LastConfigDate  = request.LastConfigDate
                };
                break;

            case HardwareType.Flowmeter:
                entity = new Flowmeter
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType,
                    MinValue     = request.MinValue,
                    MaxValue     = request.MaxValue,
                    EU           = request.EU,
                    Kfactor      = request.KFactor,
                    SignalType   = request.SignalType,
                    Settings     = new ModbusSettings
                    {
                        Address  = request.ModbusSettings.Address,
                        BoudRate = request.ModbusSettings.BoudRate,
                        DataBits = request.ModbusSettings.DataBits,
                        Parity   = Enum.GetName(typeof(Parity), request.ModbusSettings.Parity),
                        StopBit  = request.ModbusSettings.StopBit
                    }
                };
                break;

            case HardwareType.Network:
                entity = new NetworkHardware
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceType   = request.DeviceType,
                    DeviceModel  = request.DeviceModel,
                    Mask         = request.Mask
                };
                foreach (var item in request.NetworkDevices)
                {
                    ((NetworkHardware)entity).NetworkDevices.Add(new NetworkDevice
                    {
                        IP         = item.IP,
                        MacAddress = item.MacAddress,
                        Name       = item.Name
                    });
                }
                break;

            case HardwareType.PLC:
                entity = new PLC
                {
                    Position        = request.Position,
                    SerialNumber    = request.SerialNumber,
                    DeviceModel     = request.DeviceModel,
                    IP              = request.IPAddress,
                    AssemblyVersion = request.AssemblyVersion
                };
                break;

            case HardwareType.Pressure:
                entity = new Pressure
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType,
                    MinValue     = request.MinValue,
                    MaxValue     = request.MaxValue,
                    EU           = request.EU,
                    SignalType   = request.SignalType
                };
                break;

            case HardwareType.Temperature:
                entity = new Temperature
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType,
                    MinValue     = request.MinValue,
                    MaxValue     = request.MaxValue,
                    EU           = request.EU,
                    SignalType   = request.SignalType
                };
                break;

            case HardwareType.DiffPressure:
                entity = new DiffPressure
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType,
                    MinValue     = request.MinValue,
                    MaxValue     = request.MaxValue,
                    EU           = request.EU,
                    SignalType   = request.SignalType
                };
                break;

            case HardwareType.GasAnalyzer:
                entity = new GasAnalyzer
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType,
                    MinValue     = request.MinValue,
                    MaxValue     = request.MaxValue,
                    EU           = request.EU,
                    SignalType   = request.SignalType
                };
                break;

            case HardwareType.InformPanel:
                entity = new InformPanel
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType,
                    PanelType    = request.PanelType
                };
                break;

            case HardwareType.FireSensor:
                entity = new FireSensor
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType
                };
                break;

            case HardwareType.FireModule:
                entity = new FireModule
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceType   = request.DeviceType
                };
                break;

            case HardwareType.Valve:
                entity = new Valve
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceType   = request.DeviceType,
                    DeviceModel  = request.DeviceModel,
                    SignalType   = request.SignalType,
                    Settings     = new ModbusSettings
                    {
                        Address  = request.ModbusSettings.Address,
                        BoudRate = request.ModbusSettings.BoudRate,
                        DataBits = request.ModbusSettings.DataBits,
                        Parity   = Enum.GetName(typeof(Parity), request.ModbusSettings.Parity),
                        StopBit  = request.ModbusSettings.StopBit
                    }
                };
                break;

            case HardwareType.ARM:
                entity = new ARM
                {
                    Position     = request.Position,
                    Name         = request.ArmName,
                    SerialNumber = request.SerialNumber,
                    Monitor      = request.Monitor,
                    MonitorSN    = request.MonitorSN,
                    Keyboard     = request.Keyboard,
                    KeyboardSN   = request.KeyboardSN,
                    Mouse        = request.Mouse,
                    MouseSN      = request.MouseSN,
                    OS           = request.OS,
                    ProductKeyOS = request.ProductKeyOS,
                    HasRAID      = request.HasRAID
                };
                foreach (var item in request.NetworkAdapters)
                {
                    ((ARM)entity).NetworkAdapters.Add(new NetworkAdapter
                    {
                        IP         = item.IP,
                        MacAddress = item.MacAddress
                    });
                }
                break;

            case HardwareType.APC:
                entity = new APC
                {
                    Position     = request.Position,
                    SerialNumber = request.SerialNumber,
                    DeviceModel  = request.DeviceModel,
                    DeviceType   = request.DeviceType
                };
                break;

            default:
                entity = null;
                break;
            }

            contract.HardwareList.Add(entity);
            contract.HasProtocol = false;
            _context.Update(contract);

            try
            {
                await _context.SaveChangesAsync(cancellationToken);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(entity.Id);
        }
Exemplo n.º 13
0
        public ActionResult ChangeValve(VChange_VM model)
        {
            //валидация введенных пользователем данных
            ModelState.Clear();
            //диаметр должен быть в пределах 15 - 200 либо не введен вообще
            int intDy = 0;
            try
            {
                if (model.Dy != null)
                {
                    intDy = Int32.Parse(model.Dy); //если введена фигня, то не распарсит
                    if (intDy < 15 || intDy > 200)
                    {
                        ModelState.AddModelError("DyError", "Введен недостоверный Дy!");
                    }
                }

            }
            catch
            {
                ModelState.AddModelError("DyError", "Введен недостоверный Дy!");
            }
            //Kv должен быть в пределах 0,1 - 450 либо не введен вообще
            double doubleKv = 0;
            try
            {
                if (model.Kv != null)
                {
                    string stringKv = model.Kv.Replace('.', ','); //для того, чтобы пользователь имел возможность вводить и через точку и через запятую
                    doubleKv = Double.Parse(stringKv); //если введена фигня, то не распарсит
                    if (doubleKv <= 0.1 || doubleKv > 450)
                    {
                        ModelState.AddModelError("KvError", "Введен недостоверный Kv!");
                    }
                }

            }
            catch
            {
                ModelState.AddModelError("DyError", "Введен недостоверный Kv!");
            }
            //год производства должен быть в пределах 1980 - н.в. либо не введен вообще
            int intYear = 0;
            try
            {
                if (model.ProdYear != null)
                {
                    intYear = Int32.Parse(model.ProdYear); //если ввели совсем уж хуйню, то не распарсит
                    if (intYear < 1980 || intYear > DateTime.Now.Year)
                    {
                        ModelState.AddModelError("DateError", "Введен недостоверный год!");
                    }
                }
            }
            catch
            {
                ModelState.AddModelError("DateError", "Введен недостоверный год!");
            }

            //проверяем длину инвентарного номера и заводского номера - должны быть меньше 30 символов
            if ((model.InvNo != null && model.InvNo.Length > 30) || (model.SerialNo != null && model.SerialNo.Length > 30))
            {
                ModelState.AddModelError("DateError", "Ошибка: слишком длинный номер!");
            }

            //проверяем длинну примечания, должна быть не менее 1000 символов
            if (model.Comment != null && model.Comment.Length > 1000)
            {
                ModelState.AddModelError("ExtError", "Слишком длинное примечание!");
            }

            //конец валидации

            if (ModelState.IsValid)
            {
                //валидация успешна создаем и сохраняем в БД новый экземпляр Valve
                Valve tempV = new Valve
                {
                    V_ID = model.ID,
                    V_model = model.ModelName,
                    V_comment = model.Comment,
                    V_invNo = model.InvNo,
                    V_ownerEnterprise = model.Enterprise,
                    V_serNo = model.SerialNo
                };

                if (model.Dy != null) tempV.V_diam = intDy;
                if (model.Kv != null) tempV.V_KV = doubleKv;
                if (model.ProdYear != null) tempV.V_prodDate = new DateTime(intYear, 1, 1);

                try
                {
                    repositorie.SaveValve(tempV);
                }
                catch (Exception e)
                {
                    //не удалось изменить
                    ModelState.AddModelError("err", e.Message);
                    ModelState.AddModelError("err", "Не удалось изменить КЗР!");
                }
            }

            if (ModelState.IsValid)
            {
                //изенение успешно, возвращаем страницу из которой был вызов на создание нового КЗР
                return Redirect(model.ReturnURL);
            }
            else
            {
                //валидация неудачна
                model.Enterprises = repositorie.Enterprises;
                model.Valve = repositorie.Valves.SingleOrDefault(v => v.V_ID == model.ID);
                return View(model);
            }
        }
Exemplo n.º 14
0
        public Valve Update(Valve entity)
        {
            _accessor.Update(entity);

            return(entity);
        }
Exemplo n.º 15
0
 public Valve Insert(Valve entity)
 {
     entity = _accessor.Insert(entity);
     return(entity);
 }
Exemplo n.º 16
0
        public Valve Get(long id)
        {
            Valve valveItem = _accessor.Get <Valve>(x => x.IsActive && x.Id == id);

            return(valveItem);
        }
Exemplo n.º 17
0
 public SvDualValve(Card card, Valve valve1, Valve valve2) : base(card, valve1, valve2)
 {
     this.svValve1 = (SvValve)valve1;
     this.svValve2 = (SvValve)valve2;
 }
Exemplo n.º 18
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_RemoteStoragePublishFileProgress_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CRemoteStoragePublishFileProgress_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CRemoteStoragePublishFileProgress_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 19
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_SetPersonaNameResponse_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CSetPersonaNameResponse_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CSetPersonaNameResponse_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 20
0
        internal async Task <bool> LoadDataAsync()
        {
            var homesData = await _aPICommands.GetHomesData().ConfigureAwait(false);

            if (homesData == null)
            {
                return(false);
            }
            Mail                = homesData.Body.User.Email;
            Language            = homesData.Body.User.Language;
            CultureInfo         = new CultureInfo(homesData.Body.User.Locale);
            Unit                = homesData.Body.User.UnitSystem.ToUnitSystem();
            WindUnit            = homesData.Body.User.UnitWind.ToWindUnit();
            PressureUnit        = homesData.Body.User.UnitPressure.ToPressureUnit();
            FeelLikeTemperature = homesData.Body.User.FeelLikeAlgorithm.ToFeelLikeAlgo();
            foreach (HomesData.HomeData home in homesData.Body.Homes)
            {
                EnergyDevice energyDevice = new EnergyDevice(_aPICommands);

                // Search for relays.
                foreach (HomesData.HomesModule module in home.Modules)
                {
                    if (module.Type.ToModuleType() == ModuleType.Relay)
                    {
                        energyDevice.Relay.Id        = module.Id;
                        energyDevice.Relay.Name      = module.Name;
                        energyDevice.Relay.SetupDate = module.SetupDate.ToLocalDateTime();
                        break;
                    }
                }
                // Search for thermostats and valves.
                foreach (HomesData.HomesModule module in home.Modules)
                {
                    switch (module.Type.ToModuleType())
                    {
                    case ModuleType.Valve:
                        Valve valve = new Valve
                        {
                            Id        = module.Id,
                            Name      = module.Name,
                            RoomId    = module.RoomId,
                            SetupDate = module.SetupDate.ToLocalDateTime()
                        };
                        energyDevice.Relay.Valves.Add(valve);
                        break;

                    case ModuleType.Thermostat:
                        Thermostat thermostat = new Thermostat()
                        {
                            Id        = module.Id,
                            Name      = module.Name,
                            RoomId    = module.RoomId,
                            SetupDate = module.SetupDate.ToLocalDateTime()
                        };
                        energyDevice.Relay.Thermostats.Add(thermostat);
                        break;
                    }
                }
                Devices.Add(energyDevice);
            }
            return(true);
        }
Exemplo n.º 21
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     WarpSpaceManager.RemoveProviderValve(___valveBase);
     return;
 }
Exemplo n.º 22
0
        //обновляет в БД Valve, переданный в качестве параметра, либо вносит новую запись
        public int SaveValve(Valve valve)
        {
            //ищем в бд КЗР
            Valve dbEntry = context.Valves.FirstOrDefault(v => v.V_ID == valve.V_ID);
            if (dbEntry == null) //записи нет, надо добавить
            {
                //удалим лишние пробельчики
                TrimValveFields(valve);
                context.Valves.InsertOnSubmit(valve);
            }
            else //обновляем существующую систему
            {
                dbEntry.V_comment = valve.V_comment;
                dbEntry.V_deletedBy = valve.V_deletedBy;
                dbEntry.V_diam= valve.V_diam;
                dbEntry.V_invNo = valve.V_invNo;
                dbEntry.V_KV = valve.V_KV;
                dbEntry.V_model = valve.V_model;
                dbEntry.V_ownerEnterprise = valve.V_ownerEnterprise;
                dbEntry.V_prodDate = valve.V_prodDate;
                dbEntry.V_serNo = valve.V_serNo;

                //удалим лишние пробельчики
                TrimValveFields(dbEntry);
            }
            context.SubmitChanges();
            return valve.V_ID; //при добавлении нового контроллера возвратит присвоенный SQL ID
        }
Exemplo n.º 23
0
 public Result Spray(Valve valve)
 {
     return(FluiderFactory.Instance.CreatFluider(this.Valve).GetArcable().PatternWeightExecute(this, valve));
 }
Exemplo n.º 24
0
 public void TrimValveFields(Valve valve)
 {
     if(valve.V_model!=null) valve.V_model = valve.V_model.Trim();
     if (valve.V_serNo != null) valve.V_serNo = valve.V_serNo.Trim();
     if (valve.V_invNo != null) valve.V_invNo = valve.V_invNo.Trim();
 }
Exemplo n.º 25
0
 public ValveControl(Flowsheet flowsheet, Point location, Valve valve)
     : base(flowsheet, location, valve)
 {
 }
Exemplo n.º 26
0
    /// <summary>
    /// Identifies the class/type of the device and returns it.
    /// </summary>
    /// <param name="plantTag">Plant tag</param>
    /// <param name="module">Name of the module in plant</param>
    /// <param name="istIds">Mapping of opc ua node id's</param>
    /// <returns></returns>
    public Device Validator(string plantTag, string module, IstOPCUANodeIds istIds)
    {
        Device local;

        switch (plantTag[0].ToString())
        {
        case "P":
            switch (plantTag)
            {
            case "PIC":
                local = new Device(plantTag);
                break;

            case "PROP_V":
                local = new Device(plantTag);
                break;

            default:
                local = new Pump(plantTag);
                break;
            }
            break;

        case "V":
            // Valve modeld in opc ua
            if (istIds.TagToNodeId[module].ContainsKey(plantTag))
            {
                // RelayValve
                if (istIds.TagToNodeId[module][plantTag].Core.Contains("#"))
                {
                    local = new RelayValve(plantTag);
                }
                else                     // Normal valve
                {
                    local = new Valve(plantTag);
                }
            }
            else                 // only modeld in Linked Data
                                 // Handventil. Achtung codedopplung.
            {
                local = new HandValve(plantTag);
            }
            break;

        case "F":
            // TODO: Fix device typ
            local = new Device(plantTag);
            break;

        case "L":
            // TODO: NIcht eindeutig ob binär oder linear
            local = new BinarySensor(plantTag);
            break;

        case "R":
            local = new Mixer(plantTag);
            break;

        case "T":
            local = new TemperatureSensor(plantTag);
            break;

        case "B":
            local = new Tank(plantTag);
            break;

        case "W":
            // Spechial case: WT
            if (plantTag [1].ToString() == "T")
            {
                local = new DeviceGUI(plantTag);
            }
            else
            {
                local = new Device(plantTag);
            }
            break;

        default:
            local = new Device(plantTag);
            break;
        }
        return(local);
    }
Exemplo n.º 27
0
        public async Task <IActionResult> Edit(int id, [Bind("Addr,Caption,BoilerEnabled,Temperature,TimeTable,Wanted,Auto,Locked")] ValveView valveView)
        {
            if (ModelState.IsValid && valveView.Addr > 0)
            {
                var valve = await db.Valves.SingleOrDefaultAsync(v => v.Addr == valveView.Addr);

                if (valve == null)
                {
                    valve = new Valve()
                    {
                        Addr = valveView.Addr, BoilerEnabled = valveView.BoilerEnabled, Caption = valveView.Caption, TimeTable = valveView.TimeTable, Locked = valveView.Locked
                    };
                    await db.Valves.AddAsync(valve);

                    await db.SaveChangesAsync();

                    commandService.SendTimetableToValve(valve.Addr, valve.TimeTable);
                }
                else
                {
                    bool change = false;
                    if (valve.Caption != valveView.Caption)
                    {
                        valve.Caption = valveView.Caption;
                        change        = true;
                    }
                    if (valve.Addr != valveView.Addr)
                    {
                        valve.Addr = valveView.Addr;
                        change     = true;
                    }
                    if (valve.BoilerEnabled != valveView.BoilerEnabled)
                    {
                        valve.BoilerEnabled = valveView.BoilerEnabled;
                        change = true;
                    }
                    if (valve.Locked != valveView.Locked)
                    {
                        valve.Locked = valveView.Locked;
                        change       = true;
                    }
                    if (change)
                    {
                        await db.SaveChangesAsync();
                    }
                    if (valve.TimeTable != valveView.TimeTable)
                    {
                        valve.TimeTable = valveView.TimeTable;
                        await db.SaveChangesAsync();

                        commandService.SendTimetableToValve(valve.Addr, valve.TimeTable);
                    }
                }
                commandService.UpdateValve(valveView);
                return(RedirectToAction(nameof(Index)));
            }
            List <SelectListItem> timetables = new List <SelectListItem> {
                new SelectListItem()
                {
                    Value = "0", Text = "žádný"
                }
            };

            timetables.AddRange(await db.Timetables.Select(t => new SelectListItem {
                Value = t.Id.ToString(), Text = t.Caption
            }).ToListAsync());
            ViewBag.TimeTables = timetables;
            return(View(valveView));
        }
Exemplo n.º 28
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_SteamUGCQueryCompleted_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CSteamUGCQueryCompleted_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CSteamUGCQueryCompleted_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 29
0
        public void SetUp()
        {
            preparationInlet = new Mock<ISimpleInlet<string>>();
            flushOutlet = new Mock<ISimpleOutlet<string>>();
            resultOutlet = new Mock<ISimpleOutlet<ReceiveOrSendResult<int, string>>>();
            resultOutlet.Setup(r => r.Receive()).Returns(ReceiveOrSendResult<int, string>.CreateSendResult);
            resultOutlet.Setup(r => r.ReceiveImmediately()).Returns(ReceiveOrSendResult<int, string>.CreateSendResult);
            resultOutlet.Setup(r => r.Receive(It.IsAny<TimeSpan>())).Returns(ReceiveOrSendResult<int, string>.CreateSendResult);

            valve = new Valve<int, string>(preparationInlet.Object, flushOutlet.Object, resultOutlet.Object);
        }
Exemplo n.º 30
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_UserFavoriteItemsListChanged_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CUserFavoriteItemsListChanged_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CUserFavoriteItemsListChanged_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 31
0
 public void Set(Valve.Interop.NativeEntrypoints.SteamAPI_PublisherOwnedAppDataReady_t_Callback func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CPublisherOwnedAppDataReady_t_RemoveCallback(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CPublisherOwnedAppDataReady_t_SetCallback(func);
 }
Exemplo n.º 32
0
 public void Set(Valve.Interop.NativeEntrypoints.SteamAPI_UserStatsReceived_t_Callback func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CUserStatsReceived_t_RemoveCallback(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CUserStatsReceived_t_SetCallback(func);
 }
Exemplo n.º 33
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_RemoteStorageFileWriteAsyncComplete_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CRemoteStorageFileWriteAsyncComplete_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CRemoteStorageFileWriteAsyncComplete_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 34
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_AssociateWithClanResult_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CAssociateWithClanResult_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CAssociateWithClanResult_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 35
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_RemoteStorageUpdateUserPublishedItemVoteResult_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CRemoteStorageUpdateUserPublishedItemVoteResult_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CRemoteStorageUpdateUserPublishedItemVoteResult_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 36
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_CheckFileSignature_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CCheckFileSignature_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CCheckFileSignature_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 37
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_SetUserItemVoteResult_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CSetUserItemVoteResult_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CSetUserItemVoteResult_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 38
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_ClanOfficerListResponse_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CClanOfficerListResponse_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CClanOfficerListResponse_t_SetCallResult(hAPICall, func);
 }
        public SetupForm(Valve aValve, IItemBrowser aBrowser)
        {
            mValve   = aValve;
            mBrowser = aBrowser;
            InitializeComponent();

            if (mValve.mRemoteItemHandle != -1)
            {
                itemEditBox_Remote.ItemName    = mBrowser.getItemNameByHandle(mValve.mRemoteItemHandle);
                itemEditBox_Remote.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mRemoteItemHandle);
            }

            spinEdit_LimitMS.Value  = mValve.LimitSwitchMS;
            spinEdit_TravelMS.Value = mValve.TravelMS;

            if (mValve.mAnalogCtrl)
            {
                tabControl_Control.SelectedIndex = 1;
            }
            else
            {
                tabControl_Control.SelectedIndex = 0;
            }

            if (mValve.mPositionCMDItemHandle != -1)
            {
                itemEditBox_PositionCMD.ItemName    = mBrowser.getItemNameByHandle(mValve.mPositionCMDItemHandle);
                itemEditBox_PositionCMD.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mPositionCMDItemHandle);
            }

            textBox_PositionCMDMax.Text = StringUtils.ObjectToString(mValve.mPositionCMDScale.InMax);
            textBox_PositionCMDMin.Text = StringUtils.ObjectToString(mValve.mPositionCMDScale.InMin);

            if (mValve.mOpenCMDItemHandle != -1)
            {
                itemEditBox_OpenCMD.ItemName    = mBrowser.getItemNameByHandle(mValve.mOpenCMDItemHandle);
                itemEditBox_OpenCMD.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mOpenCMDItemHandle);
            }

            checkBox_UseOneCommand.Checked = mValve.UseOneCommand;

            if (mValve.mCloseCMDItemHandle != -1)
            {
                itemEditBox_CloseCMD.ItemName    = mBrowser.getItemNameByHandle(mValve.mCloseCMDItemHandle);
                itemEditBox_CloseCMD.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mCloseCMDItemHandle);
            }

            if (mValve.mStopCMDItemHandle != -1)
            {
                itemEditBox_StopCMD.ItemName    = mBrowser.getItemNameByHandle(mValve.mStopCMDItemHandle);
                itemEditBox_StopCMD.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mStopCMDItemHandle);
            }

            checkBox_ImpCtrl.Checked = mValve.mImpulseCtrl;

            if (mValve.mEsdCMDItemHandle != -1)
            {
                itemEditBox_EsdCMD.ItemName    = mBrowser.getItemNameByHandle(mValve.mEsdCMDItemHandle);
                itemEditBox_EsdCMD.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mEsdCMDItemHandle);
            }

            checkBox_EsdOpen.Checked = mValve.mEsdOpen;

            if (mValve.mOpenLimitItemHandle != -1)
            {
                itemEditBox_OpenLimit.ItemName    = mBrowser.getItemNameByHandle(mValve.mOpenLimitItemHandle);
                itemEditBox_OpenLimit.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mOpenLimitItemHandle);
            }

            if (mValve.mOpensItemHandle != -1)
            {
                itemEditBox_Opens.ItemName    = mBrowser.getItemNameByHandle(mValve.mOpensItemHandle);
                itemEditBox_Opens.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mOpensItemHandle);
            }

            if (mValve.mClosedLimitItemHandle != -1)
            {
                itemEditBox_ClosedLimit.ItemName    = mBrowser.getItemNameByHandle(mValve.mClosedLimitItemHandle);
                itemEditBox_ClosedLimit.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mClosedLimitItemHandle);
            }

            if (mValve.mClosesItemHandle != -1)
            {
                itemEditBox_Closes.ItemName    = mBrowser.getItemNameByHandle(mValve.mClosesItemHandle);
                itemEditBox_Closes.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mClosesItemHandle);
            }

            if (mValve.mRotationItemHandle != -1)
            {
                itemEditBox_Rotation.ItemName    = mBrowser.getItemNameByHandle(mValve.mRotationItemHandle);
                itemEditBox_Rotation.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mRotationItemHandle);
            }

            if (mValve.mPositionItemHandle != -1)
            {
                itemEditBox_Position.ItemName    = mBrowser.getItemNameByHandle(mValve.mPositionItemHandle);
                itemEditBox_Position.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mPositionItemHandle);
            }

            textBox_PositionMax.Text = StringUtils.ObjectToString(mValve.mPositionScale.InMax);
            textBox_PositionMin.Text = StringUtils.ObjectToString(mValve.mPositionScale.InMin);

            if (mValve.mAlarm1ItemHandle != -1)
            {
                itemEditBox_Alarm1.ItemName    = mBrowser.getItemNameByHandle(mValve.mAlarm1ItemHandle);
                itemEditBox_Alarm1.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mAlarm1ItemHandle);
            }

            if (mValve.mAlarm2ItemHandle != -1)
            {
                itemEditBox_Alarm2.ItemName    = mBrowser.getItemNameByHandle(mValve.mAlarm2ItemHandle);
                itemEditBox_Alarm2.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mAlarm2ItemHandle);
            }

            if (mValve.mPowerItemHandle != -1)
            {
                itemEditBox_Power.ItemName    = mBrowser.getItemNameByHandle(mValve.mPowerItemHandle);
                itemEditBox_Power.ItemToolTip = mBrowser.getItemToolTipByHandle(mValve.mPowerItemHandle);
            }

            checkBox_IgnoreCommands.Checked   = mValve.IgnoreCommands;
            checkBox_ForceLimSwitches.Checked = mValve.ForseLimSwitches;
            checkBox_PositionF.Checked        = mValve.PositionFault;
            textBox_FValue.Text = StringUtils.ObjectToString(mValve.mFaultValue);
        }
Exemplo n.º 40
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_ComputeNewPlayerCompatibilityResult_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CComputeNewPlayerCompatibilityResult_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CComputeNewPlayerCompatibilityResult_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 41
0
 private static void Postfix(Valve __instance, ValveBase ___valveBase)
 {
     WarpSpaceManager.OnValveChannelChange(___valveBase);
     return;
 }
Exemplo n.º 42
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_EncryptedAppTicketResponse_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CEncryptedAppTicketResponse_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CEncryptedAppTicketResponse_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 43
0
 public void ClickValve(Valve value)
 {
     value.ValveOn = !value.ValveOn;
     Debug.Log("Valve clicked!");
 }
Exemplo n.º 44
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_FriendsIsFollowing_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CFriendsIsFollowing_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CFriendsIsFollowing_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 45
0
        private Flowsheet SetFlowsheetContent(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, ArrayList items, string flowsheetName)
        {
            Flowsheet        flowsheet        = null;
            FlowsheetVersion flowsheetVersion = null;
            IEnumerator      e = items.GetEnumerator();

            while (e.MoveNext())
            {
                object obj = e.Current;

                if (obj is EvaporationAndDryingSystem)
                {
                    EvaporationAndDryingSystem persisted = (EvaporationAndDryingSystem)obj;
                    persisted.SetSystemFileName(flowsheetName); // call this before SetObjectData()
                    persisted.SetObjectData();
                    flowsheet = new Flowsheet(newProcessSettings, appPrefs, persisted);
                }

                else if (obj is GasStreamControl)
                {
                    GasStreamControl persistedCtrl = (GasStreamControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    DryingGasStream  stream        = flowsheet.EvaporationAndDryingSystem.GetGasStream(solvableName);
                    GasStreamControl newCtrl       = new GasStreamControl(flowsheet, new Point(0, 0), stream);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is MaterialStreamControl)
                {
                    MaterialStreamControl persistedCtrl = (MaterialStreamControl)obj;
                    string solvableName           = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    DryingMaterialStream  stream  = flowsheet.EvaporationAndDryingSystem.GetMaterialStream(solvableName);
                    MaterialStreamControl newCtrl = new MaterialStreamControl(flowsheet, new Point(0, 0), stream);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is DryerControl)
                {
                    DryerControl persistedCtrl = (DryerControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Dryer        uo            = flowsheet.EvaporationAndDryingSystem.GetDryer(solvableName);
                    DryerControl newCtrl       = new DryerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is HeatExchangerControl)
                {
                    HeatExchangerControl persistedCtrl = (HeatExchangerControl)obj;
                    string               solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    HeatExchanger        uo            = flowsheet.EvaporationAndDryingSystem.GetHeatExchanger(solvableName);
                    HeatExchangerControl newCtrl       = new HeatExchangerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CycloneControl)
                {
                    CycloneControl persistedCtrl = (CycloneControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Cyclone        uo            = flowsheet.EvaporationAndDryingSystem.GetCyclone(solvableName);
                    CycloneControl newCtrl       = new CycloneControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is EjectorControl)
                {
                    EjectorControl persistedCtrl = (EjectorControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Ejector        uo            = flowsheet.EvaporationAndDryingSystem.GetEjector(solvableName);
                    EjectorControl newCtrl       = new EjectorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is WetScrubberControl)
                {
                    WetScrubberControl persistedCtrl = (WetScrubberControl)obj;
                    string             solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    WetScrubber        uo            = flowsheet.EvaporationAndDryingSystem.GetWetScrubber(solvableName);
                    WetScrubberControl newCtrl       = new WetScrubberControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ScrubberCondenserControl)
                {
                    ScrubberCondenserControl persistedCtrl = (ScrubberCondenserControl)obj;
                    string                   solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    ScrubberCondenser        uo            = flowsheet.EvaporationAndDryingSystem.GetScrubberCondenser(solvableName);
                    ScrubberCondenserControl newCtrl       = new ScrubberCondenserControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is MixerControl)
                {
                    MixerControl persistedCtrl = (MixerControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Mixer        uo            = flowsheet.EvaporationAndDryingSystem.GetMixer(solvableName);
                    MixerControl newCtrl       = new MixerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is TeeControl)
                {
                    TeeControl persistedCtrl = (TeeControl)obj;
                    string     solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Tee        uo            = flowsheet.EvaporationAndDryingSystem.GetTee(solvableName);
                    TeeControl newCtrl       = new TeeControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is FlashTankControl)
                {
                    FlashTankControl persistedCtrl = (FlashTankControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    FlashTank        uo            = flowsheet.EvaporationAndDryingSystem.GetFlashTank(solvableName);
                    FlashTankControl newCtrl       = new FlashTankControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is FanControl)
                {
                    FanControl persistedCtrl = (FanControl)obj;
                    string     solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Fan        uo            = flowsheet.EvaporationAndDryingSystem.GetFan(solvableName);
                    FanControl newCtrl       = new FanControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ValveControl)
                {
                    ValveControl persistedCtrl = (ValveControl)obj;
                    string       solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Valve        uo            = flowsheet.EvaporationAndDryingSystem.GetValve(solvableName);
                    ValveControl newCtrl       = new ValveControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is BagFilterControl)
                {
                    BagFilterControl persistedCtrl = (BagFilterControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    BagFilter        uo            = flowsheet.EvaporationAndDryingSystem.GetBagFilter(solvableName);
                    BagFilterControl newCtrl       = new BagFilterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is AirFilterControl)
                {
                    AirFilterControl persistedCtrl = (AirFilterControl)obj;
                    string           solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    AirFilter        uo            = flowsheet.EvaporationAndDryingSystem.GetAirFilter(solvableName);
                    AirFilterControl newCtrl       = new AirFilterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CompressorControl)
                {
                    CompressorControl persistedCtrl = (CompressorControl)obj;
                    string            solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Compressor        uo            = flowsheet.EvaporationAndDryingSystem.GetCompressor(solvableName);
                    CompressorControl newCtrl       = new CompressorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is HeaterControl)
                {
                    HeaterControl persistedCtrl = (HeaterControl)obj;
                    string        solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Heater        uo            = flowsheet.EvaporationAndDryingSystem.GetHeater(solvableName);
                    HeaterControl newCtrl       = new HeaterControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is CoolerControl)
                {
                    CoolerControl persistedCtrl = (CoolerControl)obj;
                    string        solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Cooler        uo            = flowsheet.EvaporationAndDryingSystem.GetCooler(solvableName);
                    CoolerControl newCtrl       = new CoolerControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is ElectrostaticPrecipitatorControl)
                {
                    ElectrostaticPrecipitatorControl persistedCtrl = (ElectrostaticPrecipitatorControl)obj;
                    string solvableName = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    ElectrostaticPrecipitator        uo      = flowsheet.EvaporationAndDryingSystem.GetElectrostaticPrecipitator(solvableName);
                    ElectrostaticPrecipitatorControl newCtrl = new ElectrostaticPrecipitatorControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is PumpControl)
                {
                    PumpControl persistedCtrl = (PumpControl)obj;
                    string      solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Pump        uo            = flowsheet.EvaporationAndDryingSystem.GetPump(solvableName);
                    PumpControl newCtrl       = new PumpControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is RecycleControl)
                {
                    RecycleControl persistedCtrl = (RecycleControl)obj;
                    string         solvableName  = (string)persistedCtrl.SerializationInfo.GetValue("SolvableName", typeof(string));
                    Recycle        uo            = flowsheet.EvaporationAndDryingSystem.GetRecycle(solvableName);
                    RecycleControl newCtrl       = new RecycleControl(flowsheet, new Point(0, 0), uo);
                    newCtrl.SetObjectData(persistedCtrl.SerializationInfo, persistedCtrl.StreamingContext);
                    flowsheet.Controls.Add(newCtrl);
                }
                else if (obj is SolvableConnection)
                {
                    SolvableConnection persistedDc = (SolvableConnection)obj;
                    SolvableConnection dc          = new SolvableConnection(flowsheet);
                    dc.SetObjectData(persistedDc.SerializationInfo, persistedDc.StreamingContext);
                    flowsheet.ConnectionManager.Connections.Add(dc);
                }
                else if (obj is FlowsheetPreferences)
                {
                    FlowsheetPreferences flowsheetPrefs = obj as FlowsheetPreferences;
                    flowsheetPrefs.SetObjectData(flowsheetPrefs.SerializationInfo, flowsheetPrefs.StreamingContext);
                    flowsheet.BackColor = flowsheetPrefs.BackColor;
                }
                else if (obj is ProsimoUI.CustomEditor.CustomEditor)
                {
                    ProsimoUI.CustomEditor.CustomEditor persistedEditor = (ProsimoUI.CustomEditor.CustomEditor)obj;
                    flowsheet.CustomEditor.SetObjectData(persistedEditor.SerializationInfo, persistedEditor.StreamingContext);
                }
                else if (obj is FlowsheetVersion)
                {
                    flowsheetVersion = obj as FlowsheetVersion;
                    flowsheetVersion.SetObjectData(flowsheetVersion.SerializationInfo, flowsheetVersion.StreamingContext);
                }
            }

            if (flowsheetVersion != null)
            {
                flowsheet.Version = flowsheetVersion;
            }

            FlowsheetVersionStatus flowsheetVersionStatus = CheckFlowsheetVersion(flowsheet);

            if (flowsheetVersionStatus == FlowsheetVersionStatus.Ok)
            {
                flowsheet.IsDirty = false;
            }
            else if (flowsheetVersionStatus == FlowsheetVersionStatus.Upgraded)
            {
                flowsheet.IsDirty = true;
            }
            else if (flowsheetVersionStatus == FlowsheetVersionStatus.NotOk)
            {
                flowsheet = null;
            }

            return(flowsheet);
        }
Exemplo n.º 46
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_GlobalAchievementPercentagesReady_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CGlobalAchievementPercentagesReady_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CGlobalAchievementPercentagesReady_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 47
0
 public override Result PatternWeightExecute(Directive directive, Valve valve)
 {
     //TODO 螺杆阀暂时没有该功能
     return(Result.OK);
 }
Exemplo n.º 48
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_GSStatsStored_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CGSStatsStored_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CGSStatsStored_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 49
0
        void Update()
        {
            // Exit Sample
            if (Input.GetKey(KeyCode.Escape))
            {
                SceneManager.LoadScene("MainMenuScene");
                                #if UNITY_EDITOR
                UnityEditor.EditorApplication.isPlaying = false;
                                #endif
            }


            //selection handling
            if (m_isManipulating)
            {
                Cursor.lockState = CursorLockMode.None;
            }

            if (Input.GetMouseButtonDown(0))
            {
                if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out RaycastHit hit))
                {
                    if (hit.collider.GetComponent <Valve>())
                    {
                        m_selectedValve = hit.collider.GetComponent <Valve>();
                        m_selectedValve.Select();
                        m_isManipulating = true;
                    }
                    else if (hit.collider.GetComponent <Crank>())
                    {
                        m_selectedCrank = hit.collider.GetComponent <Crank>();
                        m_selectedCrank.Select();
                        m_isManipulating = true;
                    }
                    else if (hit.collider.GetComponent <Switch>())
                    {
                        hit.collider.GetComponent <Switch>().Activate();
                    }
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (m_selectedValve)
                {
                    m_isManipulating = false;
                    m_selectedValve.Deselect();
                    Cursor.lockState = CursorLockMode.Locked;
                }
                if (m_selectedCrank)
                {
                    m_isManipulating = false;
                    m_selectedCrank.Deselect();
                    Cursor.lockState = CursorLockMode.Locked;
                }
            }

            if (!m_isManipulating)
            {
                var mouseMovement = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1));

                var mouseSensitivityFactor = mouseSensitivityCurve.Evaluate(mouseMovement.magnitude);

                m_TargetCameraState.yaw   += mouseMovement.x * mouseSensitivityFactor;
                m_TargetCameraState.pitch += mouseMovement.y * mouseSensitivityFactor;
            }


            // Translation
            var translation = GetInputTranslationDirection() * Time.deltaTime;

            // Speed up movement when shift key held
            if (Input.GetKey(KeyCode.LeftShift))
            {
                translation *= 10.0f;
            }

            // Modify movement by a boost factor (defined in Inspector and modified in play mode through the mouse scroll wheel)
            boost       += Input.mouseScrollDelta.y * 0.2f;
            translation *= Mathf.Pow(2.0f, boost);

            m_TargetCameraState.Translate(translation);

            // Framerate-independent interpolation
            // Calculate the lerp amount, such that we get 99% of the way to our target in the specified time
            var positionLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / positionLerpTime) * Time.deltaTime);
            var rotationLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / rotationLerpTime) * Time.deltaTime);
            m_InterpolatingCameraState.LerpTowards(m_TargetCameraState, positionLerpPct, rotationLerpPct);

            m_InterpolatingCameraState.UpdateTransform(transform);
        }
Exemplo n.º 50
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_HTML_BrowserReady_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CHTML_BrowserReady_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CHTML_BrowserReady_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 51
0
 public void InitializeVariableLabels(Valve uo)
 {
     this.labelPressureDrop.InitializeVariable(uo.PressureDrop);
 }
Exemplo n.º 52
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_JoinClanChatRoomCompletionResult_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CJoinClanChatRoomCompletionResult_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CJoinClanChatRoomCompletionResult_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 53
0
 public JtDualValve(Card card, Valve valve1, Valve valve2) : base(card, valve1, valve2)
 {
     this.jtValve1 = (JtValve)valve1;
     this.jtValve2 = (JtValve)valve2;
 }
Exemplo n.º 54
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_LeaderboardScoreUploaded_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CLeaderboardScoreUploaded_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CLeaderboardScoreUploaded_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 55
0
 public GearValve(Valve valve, ValvePrm prm) : this(valve.ValveType, valve.Proportioner, valve.Card, valve.Chn, prm)
 {
 }
 public static ValveBase GetValveBase(this Valve valve)
 {
     return((ValveBase)valveBase.GetValue(valve));
 }
Exemplo n.º 57
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_LobbyMatchList_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CLobbyMatchList_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CLobbyMatchList_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 58
0
 public SvValve(Valve valve) : this(valve.ValveType, valve.Proportioner, valve.Card, valve.Chn, valve.Prm)
 {
 }
Exemplo n.º 59
0
 public void Set(ulong hAPICall, Valve.Interop.NativeEntrypoints.SteamAPI_NumberOfCurrentPlayers_t_CallResult func)
 {
     if (m_Handle != 0)
     {
     Valve.Interop.NativeEntrypoints.CNumberOfCurrentPlayers_t_RemoveCallResult(m_Handle);
     }
     m_Handle = Valve.Interop.NativeEntrypoints.CNumberOfCurrentPlayers_t_SetCallResult(hAPICall, func);
 }
Exemplo n.º 60
0
 public static bool IsOpen(this Valve valve) => valve != Valve.Closed;