}//IOType public static string get_IOType_Description(IOType enu) { System.Resources.ResourceManager rm = new System.Resources.ResourceManager(typeof(MaintainBusDocumentMeta)); System.Globalization.CultureInfo cInfo = System.Globalization.CultureInfo.CurrentCulture; string enuName = string.Format("{0}.{1}.{2}", typeof(IOType).BaseType.Name, typeof(IOType).Name, enu.ToString()); try { return rm.GetString(enuName, cInfo); ; } catch { throw new Exception("Enum Error"); } }//get_IOType _Description
public IOData(CPUHandler CPU, uint Address, IOType Type, int Width, byte Write8 = 0, ushort Write16 = 0, uint Write32 = 0) { this.CPU = CPU; this.Address = Address; this.Type = Type; this.Width = Width; this.Write8 = Write8; this.Write16 = Write16; this.Write32 = Write32; this.Read8 = 0; this.Read16 = 0; this.Read32 = 0; }
protected ConnectorViewModel(ElementViewModel element, IOType iotype, string name, Color color) { Element = element; Name = name; Color = color; IOType = iotype; if (iotype == IOType.Object) { DirectValue = "me"; } else { DirectValue = "0"; } }
/// <summary> /// Initializes a new instance of the <see cref="BasicFileManager"/> class /// </summary> /// <param name="path">Path to file</param> /// <param name="type">Operations type</param> public BasicFileManager(string path, IOType type) { if (path == null || path == string.Empty) { throw new ArgumentException("Incorrect path string"); } if (type == IOType.Reader) { this.reader = new StreamReader(path); } else { this.writer = new StreamWriter(path, true); } }
public bool Init(string procLocation, IOType useIOType, string modelParams, ProcessControlHandler clientHandler) { currentStatus = ProcesssStatus.Init; // setup IOModel thisIO = IOModelHelper.IOModelFactory(useIOType, modelParams, IOModelDataHandler); thisIO.InitProcess(procLocation); thisIO.InitComms(); thisIO.StartProcess(); IncomingProcessData += clientHandler; currentStatus = ProcesssStatus.Running; return(false); }
public NamePanel(String Name, IOType Type, StackPanel OutputPanel, Double ImageHeight = 0, Double ImageWidth = 0) { //Инициализируем XAML и CheckButton InitializeComponent(); ViewImage.Height = ImageHeight; ViewImage.Width = ImageWidth; CheckButton.HorizontalAlignment = HorizontalAlignment.Right; Children.Add(CheckButton); Adapt(OutputPanel); //Устанавливаем нужную картинку try { switch (Type) { case IOType.File: //Пытаемся установить картинку по расширению ViewImage.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + @"\NameIcons\" + Name.Substring(Name.LastIndexOf('.') + 1) + ".png")); break; case IOType.Directory: ViewImage.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + @"\DirectoryIcons\Directory.png")); break; case IOType.Drive: ViewImage.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + @"\DirectoryIcons\Drive.png")); break; } } catch { //Если картинки соответствующей расширениию не нашлось, или не нашлось еще какой либо картинки, ставим картинку по умолчанию try { ViewImage.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + @"\FileIcons\File.png")); } catch { } } //Работаем с данными FullPath = Name; ViewName.Text = FileManager.GetName(Name); OutputPanel.SizeChanged += delegate { Adapt(OutputPanel); }; }
public DataFormat( IOType ioType, DataDimension dimension, Type elemType, string name, bool isTimeSeries, long[] itemSize ) { this.ioType = ioType; this.dimension = dimension; this.dataType = elemType; this.name = name; this.isTimeSeries = isTimeSeries; this.lengthArray = itemSize; this.formatIndex = -1; }
public void Redo_Template_Point_Type() { //Arrange var Template = ModelCreation.TestTemplates(rand); IOType edit = IOType.AO; //Act ChangeWatcher watcher = new ChangeWatcher(Template); DoStacker testStack = new DoStacker(watcher); Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Points[0].Type = edit; testStack.Undo(); testStack.Redo(); //assert IOType actual = Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Points[0].Type; Assert.AreEqual(edit, actual, "Not Redone"); }
/// <summary> /// Writes a Vector2 to a stream /// </summary> /// <param name="writer">Output stream</param> /// <param name="type">Datatype to write object as</param> public static void Write(this Vector2 vector, EndianWriter writer, IOType type) { switch (type) { case IOType.Short: writer.WriteInt16((short)vector.X); writer.WriteInt16((short)vector.Y); break; case IOType.Float: writer.WriteSingle(vector.X); writer.WriteSingle(vector.Y); break; default: throw new ArgumentException($"Type {type} not available for Vector2"); } }
public void Undo_Template_Point_Type() { //Arrange var Template = ModelCreation.TestTemplates(rand); string expected = Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Points[0].Type.ToString(); IOType edit = IOType.AO; //Act ChangeWatcher watcher = new ChangeWatcher(Template); DoStacker testStack = new DoStacker(watcher); Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Points[0].Type = edit; Assert.AreEqual(1, testStack.UndoCount(), "Not added to undo stack"); testStack.Undo(); //assert string actual = Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Points[0].Type.ToString();; Assert.AreEqual(expected, actual, "Not Undone"); }
internal static IOModel IOModelFactory(IOType ioType, string args, ProcessWrapper.ProcessControlHandler handler) { IOModel outModel = null; switch (ioType) { case IOType.StdIO: outModel = new StdIOModel(); break; case IOType.PIPES: outModel = new PipeIOModel(); break; case IOType.QUEUES: outModel = new QueueIOModel(); break; } if (outModel != null) { outModel.BaseInit(args); outModel.SetReadHandler(handler); } return(outModel); }
public void Load_Templates_TypicalPoint() { Guid expectedGuid = new Guid("03a16819-9205-4e65-a16b-96616309f171"); string expectedName = "Typical Point"; int expectedQuantity = 1; IOType expectedType = IOType.AI; TECPoint actualPoint = null; foreach (TECSystem typical in actualTemplates.Templates.SystemTemplates) { foreach (TECEquipment equip in typical.Equipment) { foreach (TECSubScope ss in equip.SubScope) { foreach (TECPoint point in ss.Points) { if (point.Guid == expectedGuid) { actualPoint = point; break; } } if (actualPoint != null) { break; } } if (actualPoint != null) { break; } } if (actualPoint != null) { break; } } Assert.AreEqual(expectedName, actualPoint.Label, "Typical point name didn't load properly."); Assert.AreEqual(expectedQuantity, actualPoint.Quantity, "Typical point quantity didn't load properly."); Assert.AreEqual(expectedType, actualPoint.Type, "Typical point type didn't load properly."); }
private void collectIotype() { if (this.tabControl1.SelectedTab == fileTabPage) { iotype = IOType.File; } else if (this.tabControl1.SelectedTab == gpsTabPage) { iotype = IOType.Gps; } else if (this.tabControl1.SelectedTab == quakeMapTabPage) { iotype = IOType.QuakeMap; } else if (this.tabControl1.SelectedTab == customTabPage) { iotype = IOType.Custom; } }
/// <summary> /// Writes a vector3 to a text stream as an NJAscii struct /// </summary> /// <param name="writer">Output text stream</param> /// <param name="type">Output type</param> public static void WriteNJA(this Vector3 vector, TextWriter writer, IOType type) { writer.Write("( "); switch (type) { case IOType.Short: writer.Write((short)vector.X); writer.Write(", "); writer.Write((short)vector.Y); writer.Write(", "); writer.Write((short)vector.Z); break; case IOType.Float: writer.Write(vector.X.ToC()); writer.Write(", "); writer.Write(vector.Y.ToC()); writer.Write(", "); writer.Write(vector.Z.ToC()); break; case IOType.BAMS16: writer.Write(((short)DegToBAMS(vector.X)).ToCHex()); writer.Write(", "); writer.Write(((short)DegToBAMS(vector.Y)).ToCHex()); writer.Write(", "); writer.Write(((short)DegToBAMS(vector.Z)).ToCHex()); break; case IOType.BAMS32: writer.Write(DegToBAMS(vector.X).ToCHex()); writer.Write(", "); writer.Write(DegToBAMS(vector.Y).ToCHex()); writer.Write(", "); writer.Write(DegToBAMS(vector.Z).ToCHex()); break; default: throw new ArgumentException($"Type {type} not available for Vector2"); } writer.Write(")"); }
private bool remove(IOType type) { if (type == IOType.Protocol) { throw new Exception("Cannot remove Protocol as IOType"); } if (ioDictionary.ContainsKey(type)) { TECIO io = ioDictionary[type]; io.Quantity--; if (io.Quantity < 1) { ioDictionary.Remove(io.Type); } return(true); } else { if (TECIO.PointIO.Contains(type)) { IOType universalType = TECIO.GetUniversalType(type); if (ioDictionary.ContainsKey(universalType)) { TECIO universalIO = ioDictionary[universalType]; universalIO.Quantity--; if (universalIO.Quantity < 1) { ioDictionary.Remove(universalIO.Type); } return(true); } else { return(false); } } else { return(false); } } }
public void GoGo(bool receiver = false) { if (receiver) { role = IOType.Receiver; Debug.Log("I'm Watching!"); view.RPC("GoGo", RpcTarget.Others, false); } else { role = IOType.Streamer; Debug.Log("I'm Streaming!"); } ConfigureStream(); SetupCall(); VideoTest.instance.DebugState(role); }
public bool Contains(TECIO io) { if (TECIO.UniversalIO.Contains(io.Type)) { return(ioDictionary.ContainsKey(io.Type) ? ioDictionary[io.Type].Quantity >= io.Quantity : false); } else if (io.Protocol != null) { return(protocolDictionary.ContainsKey(io.Protocol) ? protocolDictionary[io.Protocol].Quantity >= io.Quantity : false); } else if (TECIO.PointIO.Contains(io.Type)) { IOType universalType = TECIO.GetUniversalType(io.Type); int quantity = ioDictionary.ContainsKey(io.Type) ? ioDictionary[io.Type].Quantity : 0; quantity += ioDictionary.ContainsKey(universalType) ? ioDictionary[universalType].Quantity : 0; return(quantity >= io.Quantity); } else { throw new Exception("IO condition not recognized."); } }
public static IOType GetUniversalType(IOType type) { if (PointIO.Contains(type)) { if (type == IOType.AI || type == IOType.DI) { return(IOType.UI); } else if (type == IOType.AO || type == IOType.DO) { return(IOType.UO); } else { throw new NotImplementedException("PointIO type not recognized."); } } else { throw new InvalidOperationException("Universal type must come from point type."); } }
public byte[] Read(int addr, int count, IOType type, UInt16 deviceAddr) { byte[] inBuffer = null; int ret = 0; switch (type) { case IOType.I: case IOType.Q: inBuffer = new byte[2]; inBuffer[0] = (byte)(type); //类型 inBuffer[1] = (byte)(addr & 0xFF); //偏移 UInt16 cmd = (UInt16)(inBuffer[1] << 8 | inBuffer[0]); ret = SendCommand(deviceAddr, cmd); if (ret >= 0) { return(new byte[] { (byte)ret }); } break; case IOType.A: case IOType.Block: inBuffer = new byte[5]; inBuffer[0] = (byte)(type); inBuffer[1] = (byte)(addr & 0xFF); inBuffer[2] = (byte)(addr >> 8 & 0xFF); inBuffer[3] = (byte)(count & 0xFF); inBuffer[4] = (byte)(count >> 8 & 0xFF); byte[] outBuffer = new byte[count]; ret = SendData(deviceAddr, inBuffer, 0, 5, outBuffer, 0); if (ret == count) { return(outBuffer); } break; } throw new NotSupportedException(); }
internal Field(XmlElement fieldElement) { XmlHelper h = new XmlHelper(fieldElement); this.Source = fieldElement.GetAttribute("Source"); this.Target = fieldElement.GetAttribute("Target"); this.InputConverter = ConverterType.Parse(fieldElement.GetAttribute("InputConverter")); this.OutputConverter = ConverterType.Parse(fieldElement.GetAttribute("OutputConverter")); this.Quote = h.TryGetBoolean("@Quote", true); this.Mandatory = h.TryGetBoolean("@Mandatory", false); this.Alias = fieldElement.GetAttribute("Alias"); this.Required = h.TryGetBoolean("@Required", false); this.AutoNumber = h.TryGetBoolean("@AutoNumber", false); SourceType sType = SourceType.Request; if (!Enum.TryParse <SourceType>(fieldElement.GetAttribute("SourceType"), true, out sType)) { sType = SourceType.Request; } this.SourceType = sType; IOType iType = IOType.Element; if (!Enum.TryParse <IOType>(fieldElement.GetAttribute("InputType"), true, out iType)) { iType = IOType.Element; } this.InputType = iType; IOType oType = IOType.Element; if (!Enum.TryParse <IOType>(fieldElement.GetAttribute("OutputType"), true, out oType)) { oType = IOType.Element; } this.OutputType = oType; }
public void Write(int addr, byte[] buffer, int offset, int count, IOType type, UInt16 deviceAddr) { byte[] inBuffer = null; int ret = 0; switch (type) { case IOType.Q: inBuffer = new byte[2]; inBuffer[0] = (byte)(((byte)type & 0xF) | (buffer[0] << 4)); inBuffer[1] = (byte)(addr & 0xFF); UInt16 cmd = (UInt16)(inBuffer[1] << 8 | inBuffer[0]); ret = SendCommand(deviceAddr, cmd); if (ret >= 0) { return; } break; case IOType.O: case IOType.Block: inBuffer = new byte[5 + count]; inBuffer[0] = (byte)(type); inBuffer[1] = (byte)(addr & 0xFF); inBuffer[2] = (byte)(addr >> 8 & 0xFF); inBuffer[3] = (byte)(count & 0xFF); inBuffer[4] = (byte)(count >> 8 & 0xFF); Array.Copy(buffer, offset, inBuffer, 5, count); ret = SendData(deviceAddr, inBuffer, 0, 5 + count); if (ret >= 0) { return; } break; } throw new NotSupportedException(); }
internal static extern void SNIPacketReset([In] SNIHandle pConn, IOType IOType, SNIPacket pPacket, ConsumerNumber ConsNum);
private void collectIotype() { if(this.tabControl1.SelectedTab == fileTabPage) { iotype = IOType.File; } else if(this.tabControl1.SelectedTab == gpsTabPage) { iotype = IOType.Gps; } else if(this.tabControl1.SelectedTab == quakeMapTabPage) { iotype = IOType.QuakeMap; } else if(this.tabControl1.SelectedTab == customTabPage) { iotype = IOType.Custom; } }
public InputConnectorViewModel(ElementViewModel element, IOType iotype, string name, Color color) : base(element, iotype, name, color) { }
private static IntPtr SNIPacketAllocateWrapper([In] SafeHandle pConn, IOType IOType) { return(s_is64bitProcess ? SNINativeManagedWrapperX64.SNIPacketAllocateWrapper(pConn, IOType) : SNINativeManagedWrapperX86.SNIPacketAllocateWrapper(pConn, IOType)); }
public void Add(IOType type) { this.Add(new TECIO(type)); }
public bool Contains(IOType type) { return(this.Contains(new TECIO(type))); }
private static extern IntPtr SNIPacketAllocateWrapper([In] SafeHandle pConn, IOType IOType);
public TECIO(Guid guid, IOType type) : base(guid) { _type = type; }
public TECIO(IOType type) : this(Guid.NewGuid(), type) { }
public static string IOTypeToStr(IOType b) { string ret = VisionLabPINVOKE.IOTypeToStr((int)b); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); return ret; }
public static void SNIPacketAllocate (SafeHandle handle, IOType io, ref IntPtr result) { throw new NotSupportedException (msg); }
/// <summary> /// Constructor for StandardIO type. /// </summary> /// <param name="Process"></param> /// <param name="iotype"></param> /// <param name="ManResetEvent"></param> /// <param name="CallingProcess"></param> public StandardIO(System.Diagnostics.Process Process, IOType iotype, System.Threading.ManualResetEvent ManResetEvent, ConsoleProcess CallingProcess) { m_Process = Process; m_IOType = iotype; m_WaitHandle = ManResetEvent; m_CallingProcess = CallingProcess; } //constructor
//Public Methods public void Clear() { this.Controls.Clear(); this.ioObjList.Clear(); ioType = IOType.None; }
public void WriteToStream(SWIGTYPE_p_std__ostream os, IOType io) { VisionLabPINVOKE.Image_WriteToStream__SWIG_0(swigCPtr, SWIGTYPE_p_std__ostream.getCPtr(os), (int)io); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); }
public void WriteToFile(string fileName, IOType io) { VisionLabPINVOKE.Image_WriteToFile__SWIG_0(swigCPtr, fileName, (int)io); if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve(); }
public static void SNIPacketReset (SafeHandle handle, IOType io, SafeHandle handle2, ConsumerNumber cn) { throw new NotSupportedException (msg); }
internal static void SNIPacketAllocate(SafeHandle pConn, IOType IOType, ref IntPtr pPacket) { pPacket = SNIPacketAllocateWrapper(pConn, IOType); }