示例#1
0
 public virtual void Extract(sbyte[] segmentBytes, Com.Drew.Metadata.Metadata metadata, JpegSegmentType segmentType)
 {
     JpegDirectory directory = new JpegDirectory();
     metadata.AddDirectory(directory);
     // The value of TAG_COMPRESSION_TYPE is determined by the segment type found
     directory.SetInt(JpegDirectory.TagCompressionType, segmentType.byteValue - JpegSegmentType.Sof0.byteValue);
     SequentialReader reader = new SequentialByteArrayReader(segmentBytes);
     try
     {
         directory.SetInt(JpegDirectory.TagDataPrecision, reader.GetUInt8());
         directory.SetInt(JpegDirectory.TagImageHeight, reader.GetUInt16());
         directory.SetInt(JpegDirectory.TagImageWidth, reader.GetUInt16());
         short componentCount = reader.GetUInt8();
         directory.SetInt(JpegDirectory.TagNumberOfComponents, componentCount);
         // for each component, there are three bytes of data:
         // 1 - Component ID: 1 = Y, 2 = Cb, 3 = Cr, 4 = I, 5 = Q
         // 2 - Sampling factors: bit 0-3 vertical, 4-7 horizontal
         // 3 - Quantization table number
         for (int i = 0; i < (int)componentCount; i++)
         {
             int componentId = reader.GetUInt8();
             int samplingFactorByte = reader.GetUInt8();
             int quantizationTableNumber = reader.GetUInt8();
             JpegComponent component = new JpegComponent(componentId, samplingFactorByte, quantizationTableNumber);
             directory.SetObject(JpegDirectory.TagComponentData1 + i, component);
         }
     }
     catch (IOException ex)
     {
         directory.AddError(ex.Message);
     }
 }
        public static bool areIntersecting(Com.Brashmonkey.Spriter.SpriterRectangle rect1
			, Com.Brashmonkey.Spriter.SpriterRectangle rect2)
        {
            return rect1.isInisde(rect2.left, rect2.top) || rect1.isInisde(rect2.right, rect2
                .top) || rect1.isInisde(rect2.left, rect2.bottom) || rect1.isInisde(rect2.right,
                rect2.bottom);
        }
示例#3
0
        public virtual void calcBoundingBox(Com.Brashmonkey.Spriter.SpriterRectangle @base
			)
        {
            this.boundingBox.set(@base);
            foreach (SpriterObject @object in this.childObjects)
            {
                Com.Brashmonkey.Spriter.SpriterPoint[] points = @object.getBoundingBox();
                this.boundingBox.left = Math.Min(Math.Min(Math.Min(Math
                    .Min(points[0].x, points[1].x), points[2].x), points[3].x), this.boundingBox.left
                    );
                this.boundingBox.right = Math.Max(Math.Max(Math.Max(Math
                    .Max(points[0].x, points[1].x), points[2].x), points[3].x), this.boundingBox.right
                    );
                this.boundingBox.top = Math.Max(Math.Max(Math.Max(Math
                    .Max(points[0].y, points[1].y), points[2].y), points[3].y), this.boundingBox.top
                    );
                this.boundingBox.bottom = Math.Min(Math.Min(Math.Min(Math
                    .Min(points[0].y, points[1].y), points[2].y), points[3].y), this.boundingBox.bottom
                    );
            }
            foreach (SpriterBone child in this.childBones)
            {
                child.calcBoundingBox(boundingBox);
                this.boundingBox.set(child.boundingBox);
            }
        }
示例#4
0
 public override object ReadObject(Com.Bj58.Spat.Gaea.Serializer.Component.GaeaStream inStream, Type defType)
 {
     object value = SerializerFactory.GetSerializer(typeof(string)).ReadObject(inStream, typeof(string));
     if (value != null)
         return decimal.Parse(value.ToString());
     return default(decimal);
 }
示例#5
0
        public static Com.Martin.SMS.Data.SMSOutgoing ProcessRequest(Com.Martin.SMS.Data.SMSIncoming Request) {
            
            //parsing message text split ;  array[0]=type
            // array[1]=name , array[2]...n = parameter list
            char[] cSplitter = {';'};
            String[] arrMSG = Request.MessageText.Split(cSplitter);
            
            //initialisasi sms config loader
            ConfigLoader cfgLoader = new ConfigLoader();
            
            //panggil configloader.CreateRequestCommand() = request
            Com.Martin.SMS.Command.AbstractRequest command = cfgLoader.CreateRequestCommand(arrMSG[0], arrMSG[1]);

            // set request.parameter = parameterlist
            for (int i = 2 ; i < arrMSG.Length ; i++)
            {
                command.Parameters.Add(arrMSG[i]);
            }
            command.RequestSMS= Request;

            SMSOutgoing outSMS = command.Execute();

            SMSHelper.SaveOutgoingMessage(ref outSMS);

            return outSMS;
        }
		public virtual void Extract(sbyte[] segmentBytes, Com.Drew.Metadata.Metadata metadata, JpegSegmentType segmentType)
		{
			// skip the first 14 bytes
			sbyte[] iccProfileBytes = new sbyte[segmentBytes.Length - 14];
			System.Array.Copy(segmentBytes, 14, iccProfileBytes, 0, segmentBytes.Length - 14);
			Extract(new ByteArrayReader(iccProfileBytes), metadata);
		}
示例#7
0
 public override object ReadObject(Com.Bj58.Spat.Gaea.Serializer.Component.GaeaStream inStream, Type defType)
 {
     uint typeId = inStream.ReadUInt32();
     Type type = typeId.ToType();
     String value = Convert.ToString(SerializerFactory.GetSerializer(typeof(string)).ReadObject(inStream, typeof(string)));
     return Enum.Parse(type, value);
 }
 private void SelectionChanged(object sender, Com.GrapeCity.Xuni.Calendar.CalendarSelectionChangedEventArgs args)
 {
     dropdown.DropDownOpen=false;
    // SimpleDateFormat format = new SimpleDateFormat("MM-dd-yyyy", Locale.Default);
     DateTime dateTime = calendar.SelectedDates.ToArray()[0];
     string strDate = dateTime.ToString("MMddyyyy");
     header.Value = strDate;
 }
示例#9
0
		public static void TransformToMatrix(DBTransform transform, Com.Viperstudio.Geom.Matrix matrix)
		{
			matrix.A = transform.ScaleX * (float)Math.Cos (transform.SkewY);
			matrix.B = transform.ScaleX * (float)Math.Sin (transform.SkewY);
			matrix.C = -transform.ScaleY * (float)Math.Sin(transform.SkewX);
			matrix.D = transform.ScaleY * (float)Math.Cos(transform.SkewX);
			matrix.Tx = transform.X;
			matrix.Ty = transform.Y;
		}
		/**
		 * @inheritDoc
		 */

		//private Vector3 vector = new Vector3 ();
		//private float angle;
		public void UpdateTransform(Com.Viperstudio.Geom.Matrix matrix, DBTransform transform)
		{
			if(_display!=null)
			{
				(_display as UnityBoneDisplay).Update(matrix);
			}

		
		}
 public void OnResp(Com.Tencent.MM.Sdk.Modelbase.BaseResp p0)
 {
     if (p0.Type == ConstantsAPI.CommandPayByWx)
     {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         builder.SetTitle("Ö§¸¶½á¹û");
         builder.SetMessage(GetString(Resource.String.pay_result_callback_msg, p0.errCode_Rename.ToString()));
         builder.Show();
     }
 }
示例#12
0
 public virtual void set(Com.Brashmonkey.Spriter.SpriterRectangle rect)
 {
     if (rect == null)
     {
         return;
     }
     this.bottom = rect.bottom;
     this.left = rect.left;
     this.right = rect.right;
     this.top = rect.top;
     this.calculateSize();
 }
示例#13
0
        /// <summary>
        /// Draws the playing animation in <code>player</code> with all bones (if
        /// <see cref="AbstractDrawer{L}.drawBones">AbstractDrawer&lt;L&gt;.drawBones</see>
        /// is true) and bounding boxes (if
        /// <see cref="AbstractDrawer{L}.drawBoxes">AbstractDrawer&lt;L&gt;.drawBoxes</see>
        /// is true) but without the corresponding sprites.
        /// </summary>
        /// <param name="player">
        /// 
        /// <see>[Com.Brashmonkey.Spriter.player.]SpriterAbstractPlayer AbstractPlayer</see>
        /// to draw
        /// </param>
        public virtual void debugDraw(Com.Brashmonkey.Spriter.player.SpriterAbstractPlayer
			 player)
        {
            if (debubBoxes)
            {
                this.drawBoxes(player);
            }
            if (debugBones)
            {
                this.drawBones(player);
            }
        }
示例#14
0
		public virtual void Extract(RandomAccessReader reader, Com.Drew.Metadata.Metadata metadata)
		{
			// TODO review whether the 'tagPtr' values below really do require ICC processing to work with a RandomAccessReader
			IccDirectory directory = metadata.GetOrCreateDirectory<IccDirectory>();
			try
			{
				directory.SetInt(IccDirectory.TagProfileByteCount, reader.GetInt32(IccDirectory.TagProfileByteCount));
				// For these tags, the int value of the tag is in fact it's offset within the buffer.
				Set4ByteString(directory, IccDirectory.TagCmmType, reader);
				SetInt32(directory, IccDirectory.TagProfileVersion, reader);
				Set4ByteString(directory, IccDirectory.TagProfileClass, reader);
				Set4ByteString(directory, IccDirectory.TagColorSpace, reader);
				Set4ByteString(directory, IccDirectory.TagProfileConnectionSpace, reader);
				SetDate(directory, IccDirectory.TagProfileDatetime, reader);
				Set4ByteString(directory, IccDirectory.TagSignature, reader);
				Set4ByteString(directory, IccDirectory.TagPlatform, reader);
				SetInt32(directory, IccDirectory.TagCmmFlags, reader);
				Set4ByteString(directory, IccDirectory.TagDeviceMake, reader);
				int temp = reader.GetInt32(IccDirectory.TagDeviceModel);
				if (temp != 0)
				{
					if (temp <= unchecked((int)(0x20202020)))
					{
						directory.SetInt(IccDirectory.TagDeviceModel, temp);
					}
					else
					{
						directory.SetString(IccDirectory.TagDeviceModel, GetStringFromInt32(temp));
					}
				}
				SetInt32(directory, IccDirectory.TagRenderingIntent, reader);
				SetInt64(directory, IccDirectory.TagDeviceAttr, reader);
				float[] xyz = new float[] { reader.GetS15Fixed16(IccDirectory.TagXyzValues), reader.GetS15Fixed16(IccDirectory.TagXyzValues + 4), reader.GetS15Fixed16(IccDirectory.TagXyzValues + 8) };
				directory.SetObject(IccDirectory.TagXyzValues, xyz);
				// Process 'ICC tags'
				int tagCount = reader.GetInt32(IccDirectory.TagTagCount);
				directory.SetInt(IccDirectory.TagTagCount, tagCount);
				for (int i = 0; i < tagCount; i++)
				{
					int pos = IccDirectory.TagTagCount + 4 + i * 12;
					int tagType = reader.GetInt32(pos);
					int tagPtr = reader.GetInt32(pos + 4);
					int tagLen = reader.GetInt32(pos + 8);
					sbyte[] b = reader.GetBytes(tagPtr, tagLen);
					directory.SetByteArray(tagType, b);
				}
			}
			catch (IOException ex)
			{
				directory.AddError("Exception reading ICC profile: " + ex.Message);
			}
		}
		public void Update(Com.Viperstudio.Geom.Matrix matrix)
		{
			//TODO: vetex updating

			for(int i=0;i<8;i+=2)
			{
				_vertices[i] = _verticesOrigin[i] * matrix.A +  _verticesOrigin[i+1] * matrix.C + matrix.Tx ;
				_vertices[i + 1] = -(_verticesOrigin[i] * matrix.B + _verticesOrigin[i+1] * matrix.D + matrix.Ty) ;
				                        
			}
		

		}
示例#16
0
        public DrawInstruction(Com.Brashmonkey.Spriter.file.Reference @ref, float x, float
			 y, float pivotX, float pivotY, float scaleX, float scaleY, float angle, float alpha
			)
        {
            this.@ref = @ref;
            //rect = new SpriterRectangle(ref.dimensions);
            this.x = x;
            this.y = y;
            this.pivotX = pivotX;
            this.pivotY = pivotY;
            this.angle = angle;
            this.alpha = alpha;
            this.scaleX = scaleX;
            this.scaleY = scaleY;
        }
示例#17
0
 protected internal DirectoryTiffHandler(Com.Drew.Metadata.Metadata metadata, Type initialDirectoryClass)
 {
     _metadata = metadata;
     try
     {
         _currentDirectory = (Directory)System.Activator.CreateInstance(initialDirectoryClass);
     }
     catch (InstantiationException e)
     {
         throw new RuntimeException(e);
     }
     catch (MemberAccessException e)
     {
         throw new RuntimeException(e);
     }
     _metadata.AddDirectory(_currentDirectory);
 }
示例#18
0
        public String composeReportDetail(Com.Martin.SMS.Data.SMSIncoming incoming,Com.Martin.SMS.Data.SMSOutgoing outgoing)
        {   
            String s = String.Empty;

            if (outgoing.SMSRequest.ID == String.Empty)
            {
                s = "SMS TYPE : BROADCAST";
                s += "\r\n";
                for (int i = 0; i < 200; i++)
                    s += "-";

                s += "\r\n";
                s += "Res ID : " + outgoing.ID + " , Process At : " + outgoing.DateProcess.ToString("dd-MMM-yyyy") + " , Sent at : " + outgoing.DateSent.ToString("dd-MMM-yyyy");
                s += "\r\n";
                s += "Text : " + outgoing.MessageText;
                s += "\r\n";
                for (int i = 0; i < 100; i++)
                    s += "=";
            }
            else
            {
                s = "SMS TYPE : REQUEST-RESPONE";
                s += "\r\n";
                for (int i = 0; i < 200; i++)
                    s += "-";

                s += "\r\n";
                s += "Req ID : " + incoming.ID + " , Received : " + incoming.DateReceive.ToString("dd-MMM-yyyy") + " , Sender : " + incoming.Sender;
                s += "\r\n";
                s += "Command Type : " + outgoing.RegisterType + " , Command Name : " + outgoing.RegisterName;
                s += "\r\n";
                s += "Text : " + incoming.MessageText;

                s += "\r\n";
                s += "\r\n";
                s += "Res ID : " + (outgoing.ID == null? "" : outgoing.ID.ToString()) + " , Process At : " + outgoing.DateProcess.ToString("dd-MMM-yyyy") + " , Sent at : " + outgoing.DateSent.ToString("dd-MMM-yyyy");
                s += "\r\n";
                s += "Text : " + outgoing.MessageText;
                s += "\r\n";
                for (int i = 0; i < 100; i++)
                    s += "=";
            }
            return s;
        }
示例#19
0
 /// <summary>Serializes the XmpDirectory component of <code>Metadata</code> into an <code>OutputStream</code></summary>
 /// <param name="os">Destination for the xmp data</param>
 /// <param name="data">populated metadata</param>
 /// <returns>serialize success</returns>
 public static bool Write(OutputStream os, Com.Drew.Metadata.Metadata data)
 {
     XmpDirectory dir = data.GetFirstDirectoryOfType<XmpDirectory>();
     if (dir == null)
     {
         return false;
     }
     XMPMeta meta = dir.GetXMPMeta();
     try
     {
         SerializeOptions so = new SerializeOptions().SetOmitPacketWrapper(true);
         XMPMetaFactory.Serialize(meta, os, so);
     }
     catch (XMPException e)
     {
         Sharpen.Runtime.PrintStackTrace(e);
         return false;
     }
     return true;
 }
示例#20
0
		/// <summary>
		/// Performs the Jfif data extraction, adding found values to the specified
		/// instance of
		/// <see cref="Com.Drew.Metadata.Metadata"/>
		/// .
		/// </summary>
		public virtual void Extract(RandomAccessReader reader, Com.Drew.Metadata.Metadata metadata)
		{
			JfifDirectory directory = metadata.GetOrCreateDirectory<JfifDirectory>();
			try
			{
				// For JFIF, the tag number is also the offset into the segment
				int ver = reader.GetUInt16(JfifDirectory.TagVersion);
				directory.SetInt(JfifDirectory.TagVersion, ver);
				int units = reader.GetUInt8(JfifDirectory.TagUnits);
				directory.SetInt(JfifDirectory.TagUnits, units);
				int height = reader.GetUInt16(JfifDirectory.TagResx);
				directory.SetInt(JfifDirectory.TagResx, height);
				int width = reader.GetUInt16(JfifDirectory.TagResy);
				directory.SetInt(JfifDirectory.TagResy, width);
			}
			catch (IOException me)
			{
				directory.AddError(me.Message);
			}
		}
		public virtual void Extract(SequentialReader reader, Com.Drew.Metadata.Metadata metadata)
		{
			Com.Drew.Metadata.Directory directory = metadata.GetOrCreateDirectory<AdobeJpegDirectory>();
			try
			{
				reader.SetMotorolaByteOrder(false);
				if (!reader.GetString(5).Equals("Adobe"))
				{
					directory.AddError("Invalid Adobe JPEG data header.");
					return;
				}
				directory.SetInt(AdobeJpegDirectory.TagDctEncodeVersion, reader.GetUInt16());
				directory.SetInt(AdobeJpegDirectory.TagApp14Flags0, reader.GetUInt16());
				directory.SetInt(AdobeJpegDirectory.TagApp14Flags1, reader.GetUInt16());
				directory.SetInt(AdobeJpegDirectory.TagColorTransform, reader.GetInt8());
			}
			catch (IOException ex)
			{
				directory.AddError("IO exception processing data: " + ex.Message);
			}
		}
示例#22
0
        public String composeOutBoxDetail(Com.Martin.SMS.Data.SMSOutgoing outgoing)
        {
            String s = String.Empty;

            if (outgoing.SMSRequest.ID == String.Empty)
            {
                s = "SMS TYPE : BROADCAST";
                s += "\r\n";
                for (int i = 0; i < 200; i++)
                    s += "-";

                s += "\r\n";
                s += "Res ID : " + outgoing.ID + " , Process At : " + outgoing.DateProcess.ToString("dd-MMM-yyyy") + " , Sent at : " + outgoing.DateSent.ToString("dd-MMM-yyyy");
                s += "\r\n";
                s += "Text : " + outgoing.MessageText;
                s += "\r\n";
                for (int i = 0; i < 100; i++)
                    s += "=";
            }
            else
            {
                s = "SMS TYPE : REQUEST-RESPONE";
                s += "\r\n";
                for (int i = 0; i < 200; i++)
                    s += "-";

                s += "\r\n";
                s += "\r\n";
                s += "Res ID : " + outgoing.ID.ToString() + " , Process At : " + outgoing.DateProcess.ToString("dd-MMM-yyyy") + " , Sent at : " + outgoing.DateSent.ToString("dd-MMM-yyyy");
                s += "\r\n";
                s += "Text : " + outgoing.MessageText;
                s += "\r\n";
                for (int i = 0; i < 100; i++)
                    s += "=";
            }
            return s;
        }
示例#23
0
		public virtual void Extract(RandomAccessReader reader, Com.Drew.Metadata.Metadata metadata)
		{
			PsdHeaderDirectory directory = metadata.GetOrCreateDirectory<PsdHeaderDirectory>();
			try
			{
				int signature = reader.GetInt32(0);
				if (signature != unchecked((int)(0x38425053)))
				{
					directory.AddError("Invalid PSD file signature");
					return;
				}
				int version = reader.GetUInt16(4);
				if (version != 1 && version != 2)
				{
					directory.AddError("Invalid PSD file version (must be 1 or 2)");
					return;
				}
				// 6 reserved bytes are skipped here.  They should be zero.
				int channelCount = reader.GetUInt16(12);
				directory.SetInt(PsdHeaderDirectory.TagChannelCount, channelCount);
				// even though this is probably an unsigned int, the max height in practice is 300,000
				int imageHeight = reader.GetInt32(14);
				directory.SetInt(PsdHeaderDirectory.TagImageHeight, imageHeight);
				// even though this is probably an unsigned int, the max width in practice is 300,000
				int imageWidth = reader.GetInt32(18);
				directory.SetInt(PsdHeaderDirectory.TagImageWidth, imageWidth);
				int bitsPerChannel = reader.GetUInt16(22);
				directory.SetInt(PsdHeaderDirectory.TagBitsPerChannel, bitsPerChannel);
				int colorMode = reader.GetUInt16(24);
				directory.SetInt(PsdHeaderDirectory.TagColorMode, colorMode);
			}
			catch (IOException)
			{
				directory.AddError("Unable to read PSD header");
			}
		}
示例#24
0
		private static void ProcessIFD(Com.Drew.Metadata.Directory directory, ICollection<int> processedIfdOffsets, int ifdOffset, int tiffHeaderOffset, Com.Drew.Metadata.Metadata metadata, RandomAccessReader reader)
		{
			// check for directories we've already visited to avoid stack overflows when recursive/cyclic directory structures exist
			if (processedIfdOffsets.Contains(Sharpen.Extensions.ValueOf(ifdOffset)))
			{
				return;
			}
			// remember that we've visited this directory so that we don't visit it again later
			processedIfdOffsets.Add(ifdOffset);
			if (ifdOffset >= reader.GetLength() || ifdOffset < 0)
			{
				directory.AddError("Ignored IFD marked to start outside data segment");
				return;
			}
			// First two bytes in the IFD are the number of tags in this directory
			int dirTagCount = reader.GetUInt16(ifdOffset);
			int dirLength = (2 + (12 * dirTagCount) + 4);
			if (dirLength + ifdOffset > reader.GetLength())
			{
				directory.AddError("Illegally sized IFD");
				return;
			}
			// Handle each tag in this directory
			for (int tagNumber = 0; tagNumber < dirTagCount; tagNumber++)
			{
				int tagOffset = CalculateTagOffset(ifdOffset, tagNumber);
				// 2 bytes for the tag type
				int tagType = reader.GetUInt16(tagOffset);
				// 2 bytes for the format code
				int formatCode = reader.GetUInt16(tagOffset + 2);
				if (formatCode < 1 || formatCode > MaxFormatCode)
				{
					// This error suggests that we are processing at an incorrect index and will generate
					// rubbish until we go out of bounds (which may be a while).  Exit now.
					directory.AddError("Invalid TIFF tag format code: " + formatCode);
					return;
				}
				// 4 bytes dictate the number of components in this tag's data
				int componentCount = reader.GetInt32(tagOffset + 4);
				if (componentCount < 0)
				{
					directory.AddError("Negative TIFF tag component count");
					continue;
				}
				// each component may have more than one byte... calculate the total number of bytes
				int byteCount = componentCount * BytesPerFormat[formatCode];
				int tagValueOffset;
				if (byteCount > 4)
				{
					// If it's bigger than 4 bytes, the dir entry contains an offset.
					// dirEntryOffset must be passed, as some makernote implementations (e.g. Fujifilm) incorrectly use an
					// offset relative to the start of the makernote itself, not the TIFF segment.
					int offsetVal = reader.GetInt32(tagOffset + 8);
					if (offsetVal + byteCount > reader.GetLength())
					{
						// Bogus pointer offset and / or byteCount value
						directory.AddError("Illegal TIFF tag pointer offset");
						continue;
					}
					tagValueOffset = tiffHeaderOffset + offsetVal;
				}
				else
				{
					// 4 bytes or less and value is in the dir entry itself
					tagValueOffset = tagOffset + 8;
				}
				if (tagValueOffset < 0 || tagValueOffset > reader.GetLength())
				{
					directory.AddError("Illegal TIFF tag pointer offset");
					continue;
				}
				// Check that this tag isn't going to allocate outside the bounds of the data array.
				// This addresses an uncommon OutOfMemoryError.
				if (byteCount < 0 || tagValueOffset + byteCount > reader.GetLength())
				{
					directory.AddError("Illegal number of bytes for TIFF tag data: " + byteCount);
					continue;
				}
				//
				// Special handling for certain known tags that point to or contain other chunks of data to be processed
				//
				if (tagType == ExifIFD0Directory.TagExifSubIfdOffset && directory is ExifIFD0Directory)
				{
					if (byteCount != 4)
					{
						directory.AddError("Exif SubIFD Offset tag should have a component count of four (bytes) for the offset.");
					}
					else
					{
						int subDirOffset = tiffHeaderOffset + reader.GetInt32(tagValueOffset);
						ProcessIFD(metadata.GetOrCreateDirectory<ExifSubIFDDirectory>(), processedIfdOffsets, subDirOffset, tiffHeaderOffset, metadata, reader);
					}
				}
				else
				{
					if (tagType == ExifSubIFDDirectory.TagInteropOffset && directory is ExifSubIFDDirectory)
					{
						if (byteCount != 4)
						{
							directory.AddError("Exif Interop Offset tag should have a component count of four (bytes) for the offset.");
						}
						else
						{
							int subDirOffset = tiffHeaderOffset + reader.GetInt32(tagValueOffset);
							ProcessIFD(metadata.GetOrCreateDirectory<ExifInteropDirectory>(), processedIfdOffsets, subDirOffset, tiffHeaderOffset, metadata, reader);
						}
					}
					else
					{
						if (tagType == ExifIFD0Directory.TagGpsInfoOffset && directory is ExifIFD0Directory)
						{
							if (byteCount != 4)
							{
								directory.AddError("Exif GPS Info Offset tag should have a component count of four (bytes) for the offset.");
							}
							else
							{
								int subDirOffset = tiffHeaderOffset + reader.GetInt32(tagValueOffset);
								ProcessIFD(metadata.GetOrCreateDirectory<GpsDirectory>(), processedIfdOffsets, subDirOffset, tiffHeaderOffset, metadata, reader);
							}
						}
						else
						{
							if (tagType == ExifSubIFDDirectory.TagMakernote && directory is ExifSubIFDDirectory)
							{
								// The makernote tag contains the encoded makernote data directly.
								// Pass the offset to this tag's value. Manufacturer/Model-specific logic will be used to
								// determine the correct offset for further processing.
								ProcessMakernote(tagValueOffset, processedIfdOffsets, tiffHeaderOffset, metadata, reader);
							}
							else
							{
								ProcessTag(directory, tagType, tagValueOffset, componentCount, formatCode, reader);
							}
						}
					}
				}
			}
			// at the end of each IFD is an optional link to the next IFD
			int finalTagOffset = CalculateTagOffset(ifdOffset, dirTagCount);
			int nextDirectoryOffset = reader.GetInt32(finalTagOffset);
			if (nextDirectoryOffset != 0)
			{
				nextDirectoryOffset += tiffHeaderOffset;
				if (nextDirectoryOffset >= reader.GetLength())
				{
					// Last 4 bytes of IFD reference another IFD with an address that is out of bounds
					// Note this could have been caused by jhead 1.3 cropping too much
					return;
				}
				else
				{
					if (nextDirectoryOffset < ifdOffset)
					{
						// Last 4 bytes of IFD reference another IFD with an address that is before the start of this directory
						return;
					}
				}
				// TODO in Exif, the only known 'follower' IFD is the thumbnail one, however this may not be the case
				ExifThumbnailDirectory nextDirectory = metadata.GetOrCreateDirectory<ExifThumbnailDirectory>();
				ProcessIFD(nextDirectory, processedIfdOffsets, nextDirectoryOffset, tiffHeaderOffset, metadata, reader);
			}
		}
示例#25
0
    /// <summary>
    /// Runs a command.  Returns true if a valid command was found, false if not.  If there are invalid parameters or other errors but the command
    /// is a registered command, will return true.
    /// </summary>
    /// <param name="commandString"></param>
    /// <returns></returns>
    public static bool RunCom(string commandString)
    {
        string[] vars    = commandString.Split(' ');
        string   command = vars[0];

        if (!registeredCommands.ContainsKey(command))
        {
            Debug.LogError($"Command {command} is not registered!");
            return(false);
        }

        Com c = registeredCommands[command];

        if (c.parameters.Length == 1 && c.parameters[0].ParameterType == typeof(string))
        {
            if (vars.Length == 1)
            {
                Debug.LogError("Needs to have a string!");
                return(false);
            }
            Debug.Log($"runnning com: {commandString}");
            try
            {
                c.method.Invoke(c.sourceObject, new object[] { commandString.MinusFirst(command.Length + 1) });
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
            return(true);
        }

        if (vars.Length - 1 != c.parameters.Length)
        {
            Debug.LogError($"Parameter mismatch, params should be:  {c.GetParamsTypeStr()}");
            return(false);
        }

        Debug.Log($"runnning com: {commandString}");

        object[] objParams = new object[c.parameters.Length];
        for (int i = 0; i < objParams.Length; i++)
        {
            try
            {
                objParams[i] = ConvertUtil.ConvertFromStr(c.parameters[i].ParameterType, vars[i + 1]);
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
                return(true);
            }
        }

        try
        {
            c.method.Invoke(c.sourceObject, objParams);
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
        }
        return(true);
    }
示例#26
0
 /// <inheritdoc />
 public override void SetValue(string value)
 {
     Com.Call(() => NativePattern.SetValue(value));
 }
 public override void SetScrollPercent(double horizontalPercent, double verticalPercent)
 {
     Com.Call(() => NativePattern.SetScrollPercent(horizontalPercent, verticalPercent));
 }
示例#28
0
 public override void SetWindowVisualState(WindowVisualState state)
 {
     Com.Call(() => this.NativePattern.SetWindowVisualState((Interop.UIAutomationClient.WindowVisualState)state));
 }
示例#29
0
 public override bool WaitForInputIdle(int milliseconds)
 {
     return(Com.Call(() => this.NativePattern.WaitForInputIdle(milliseconds)) != 0);
 }
示例#30
0
 /// <inheritdoc />
 public override void Invoke()
 {
     Com.Call(() => NativePattern.Invoke());
 }
 public override void StartListening(SynchronizedInputType inputType)
 {
     Com.Call(() => this.NativePattern.StartListening((Interop.UIAutomationClient.SynchronizedInputType)inputType));
 }
示例#32
0
 public override void Select(int flagsSelect)
 {
     Com.Call(() => NativePattern.Select(flagsSelect));
 }
		public virtual void Extract(sbyte[] segmentBytes, Com.Drew.Metadata.Metadata metadata, JpegSegmentType segmentType)
		{
			Extract(new ByteArrayReader(segmentBytes), metadata);
		}
示例#34
0
 /// <summary>
 /// 获取拼音
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static string GetPinyin(this string s)
 {
     return(Com.Pinyin(s));
 }
示例#35
0
 /// <summary>
 /// 找到@的人
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static List <string> FindAt(this string s)
 {
     return(Com.FindAtFromStr(s));
 }
示例#36
0
        public AutomationElement GetItemByName(string name)
        {
            var nativeElement = Com.Call(() => NativePattern.GetItemByName(name));

            return(AutomationElementConverter.NativeToManaged((UIA3Automation)BasicAutomationElement.Automation, nativeElement));
        }
示例#37
0
		private static void ProcessTag(Com.Drew.Metadata.Directory directory, int tagType, int tagValueOffset, int componentCount, int formatCode, RandomAccessReader reader)
		{
			switch (formatCode)
			{
				case FmtUndefined:
				{
					// Directory simply stores raw values
					// The display side uses a Descriptor class per directory to turn the raw values into 'pretty' descriptions
					// this includes exif user comments
					directory.SetByteArray(tagType, reader.GetBytes(tagValueOffset, componentCount));
					break;
				}

				case FmtString:
				{
					string @string = reader.GetNullTerminatedString(tagValueOffset, componentCount);
					directory.SetString(tagType, @string);
					break;
				}

				case FmtSrational:
				{
					if (componentCount == 1)
					{
						directory.SetRational(tagType, new Rational(reader.GetInt32(tagValueOffset), reader.GetInt32(tagValueOffset + 4)));
					}
					else
					{
						if (componentCount > 1)
						{
							Rational[] rationals = new Rational[componentCount];
							for (int i = 0; i < componentCount; i++)
							{
								rationals[i] = new Rational(reader.GetInt32(tagValueOffset + (8 * i)), reader.GetInt32(tagValueOffset + 4 + (8 * i)));
							}
							directory.SetRationalArray(tagType, rationals);
						}
					}
					break;
				}

				case FmtUrational:
				{
					if (componentCount == 1)
					{
						directory.SetRational(tagType, new Rational(reader.GetUInt32(tagValueOffset), reader.GetUInt32(tagValueOffset + 4)));
					}
					else
					{
						if (componentCount > 1)
						{
							Rational[] rationals = new Rational[componentCount];
							for (int i = 0; i < componentCount; i++)
							{
								rationals[i] = new Rational(reader.GetUInt32(tagValueOffset + (8 * i)), reader.GetUInt32(tagValueOffset + 4 + (8 * i)));
							}
							directory.SetRationalArray(tagType, rationals);
						}
					}
					break;
				}

				case FmtSingle:
				{
					if (componentCount == 1)
					{
						directory.SetFloat(tagType, reader.GetFloat32(tagValueOffset));
					}
					else
					{
						float[] floats = new float[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							floats[i] = reader.GetFloat32(tagValueOffset + (i * 4));
						}
						directory.SetFloatArray(tagType, floats);
					}
					break;
				}

				case FmtDouble:
				{
					if (componentCount == 1)
					{
						directory.SetDouble(tagType, reader.GetDouble64(tagValueOffset));
					}
					else
					{
						double[] doubles = new double[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							doubles[i] = reader.GetDouble64(tagValueOffset + (i * 4));
						}
						directory.SetDoubleArray(tagType, doubles);
					}
					break;
				}

				case FmtSbyte:
				{
					//
					// Note that all integral types are stored as int32 internally (the largest supported by TIFF)
					//
					if (componentCount == 1)
					{
						directory.SetInt(tagType, reader.GetInt8(tagValueOffset));
					}
					else
					{
						int[] bytes = new int[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							bytes[i] = reader.GetInt8(tagValueOffset + i);
						}
						directory.SetIntArray(tagType, bytes);
					}
					break;
				}

				case FmtByte:
				{
					if (componentCount == 1)
					{
						directory.SetInt(tagType, reader.GetUInt8(tagValueOffset));
					}
					else
					{
						int[] bytes = new int[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							bytes[i] = reader.GetUInt8(tagValueOffset + i);
						}
						directory.SetIntArray(tagType, bytes);
					}
					break;
				}

				case FmtUshort:
				{
					if (componentCount == 1)
					{
						int i = reader.GetUInt16(tagValueOffset);
						directory.SetInt(tagType, i);
					}
					else
					{
						int[] ints = new int[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							ints[i] = reader.GetUInt16(tagValueOffset + (i * 2));
						}
						directory.SetIntArray(tagType, ints);
					}
					break;
				}

				case FmtSshort:
				{
					if (componentCount == 1)
					{
						int i = reader.GetInt16(tagValueOffset);
						directory.SetInt(tagType, i);
					}
					else
					{
						int[] ints = new int[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							ints[i] = reader.GetInt16(tagValueOffset + (i * 2));
						}
						directory.SetIntArray(tagType, ints);
					}
					break;
				}

				case FmtSlong:
				case FmtUlong:
				{
					// NOTE 'long' in this case means 32 bit, not 64
					if (componentCount == 1)
					{
						int i = reader.GetInt32(tagValueOffset);
						directory.SetInt(tagType, i);
					}
					else
					{
						int[] ints = new int[componentCount];
						for (int i = 0; i < componentCount; i++)
						{
							ints[i] = reader.GetInt32(tagValueOffset + (i * 4));
						}
						directory.SetIntArray(tagType, ints);
					}
					break;
				}

				default:
				{
					directory.AddError("Unknown format code " + formatCode + " for tag " + tagType);
					break;
				}
			}
		}
示例#38
0
        public JsonResult Check(string UserName, int approveID, int status, string memo)
        {
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    int TotalStep = db.T_ExchangeCenterConfig.ToList().Count;
                    T_ExchangeCenterApprove approve = db.T_ExchangeCenterApprove.Find(approveID);
                    string           name           = approve.ApproveName;
                    T_ExchangeCenter model          = db.T_ExchangeCenter.Find(approve.Pid);
                    approve.ApproveName   = UserName;
                    approve.ApproveStatus = status;
                    approve.ApproveTime   = DateTime.Now;
                    approve.Memo          = memo;
                    db.SaveChanges();
                    if (status == 2)//不同意
                    {
                        model.Status = status;
                        model.Step   = model.Step + 1;
                        db.SaveChanges();
                    }
                    else//同意
                    {
                        int type     = db.T_ExchangeReson.SingleOrDefault(s => s.Reson.Equals(model.ExchangeReson)).Type;
                        int LastStep = db.T_ExchangeCenterConfig.OrderByDescending(s => s.Step).FirstOrDefault(s => s.Reson == type).Step;
                        if (LastStep > model.Step)//判断是否存在下一级
                        {
                            //获得下一级审核部门
                            string nextapproveType             = db.T_ExchangeCenterConfig.OrderBy(s => s.Step).FirstOrDefault(s => s.Reson == type && s.Step > model.Step).ApproveType;
                            T_ExchangeCenterApprove newApprove = new T_ExchangeCenterApprove();
                            newApprove.ApproveStatus = -1;
                            newApprove.ApproveName   = nextapproveType;
                            newApprove.ApproveTime   = null;
                            newApprove.Pid           = approve.Pid;
                            db.T_ExchangeCenterApprove.Add(newApprove);
                            db.SaveChanges();
                            model.Status = 0;
                            model.Step   = model.Step + 1;
                            db.SaveChanges();
                        }
                        if (name.Equals("售后主管") || name.Equals("呼吸机主管"))//售后主管审核后直接加入补发货
                        {
                            //T_OrderList order = db.T_OrderList.Find(model.OrderId);
                            List <T_ExchangeDetail> exchangedetail = db.T_ExchangeDetail.Where(s => s.ExchangeCenterId == model.ID).ToList();

                            #region 加入快递赔付

                            if (model.ExchangeReson.Equals("快递破损"))
                            {
                                GY     gy  = new GY();
                                string cmd = "";

                                cmd = "{" +
                                      "\"appkey\":\"171736\"," +
                                      "\"method\":\"gy.erp.trade.get\"," +
                                      "\"page_no\":1," +
                                      "\"page_size\":10," +
                                      "\"platform_code\":\"" + model.OrderCode + "\"," +
                                      "\"sessionkey\":\"f5885504d9c84d1d8146200a4841f4b7\"" +
                                      "}";

                                string sign = gy.Sign(cmd);
                                cmd = cmd.Replace("}", ",\"sign\":\"" + sign + "\"}");
                                string   ret      = gy.DoPost("http://api.guanyierp.com/rest/erp_open", cmd);
                                JsonData jsonData = null;
                                jsonData = JsonMapper.ToObject(ret);

                                if (jsonData.Count == 6 || jsonData["orders"].Count == 0)
                                {
                                    cmd = "{" +
                                          "\"appkey\":\"171736\"," +
                                          "\"method\":\"gy.erp.trade.history.get\"," +
                                          "\"page_no\":1," +
                                          "\"page_size\":10," +
                                          "\"platform_code\":\"" + model.OrderCode + "\"," +
                                          "\"sessionkey\":\"f5885504d9c84d1d8146200a4841f4b7\"" +
                                          "}";
                                    sign     = gy.Sign(cmd);
                                    cmd      = cmd.Replace("}", ",\"sign\":\"" + sign + "\"}");
                                    ret      = gy.DoPost("http://api.guanyierp.com/rest/erp_open", cmd);
                                    jsonData = null;
                                    jsonData = JsonMapper.ToObject(ret);
                                    if (jsonData.Count == 6 || jsonData["orders"].Count == 0)
                                    {
                                        return(Json(new { State = "Faile", Message = "订单号不存在" }));
                                    }
                                }
                                JsonData jsonOrders = jsonData["orders"][0];
                                var      deliver    = jsonOrders["deliverys"][0];
                                //快递单号
                                string mail_no = isNULL(deliver["mail_no"]).ToString();
                                //订单金额
                                string amount = isNULL(jsonOrders["amount"]).ToString();
                                //快递名称
                                string             express_name = isNULL(jsonOrders["express_name"]).ToString();
                                T_ExpressIndemnity Inde         = new T_ExpressIndemnity
                                {
                                    PostUserName       = model.PostUser,
                                    Date               = DateTime.Now,
                                    OrderNum           = model.OrderCode,
                                    wangwang           = model.VipCode,
                                    ShopName           = model.StoreName,
                                    RetreatExpressNum  = mail_no,
                                    State              = "0",
                                    OrderMoney         = Convert.ToDouble(amount),
                                    Type               = "破损",
                                    Second             = "0",
                                    CurrentApproveName = "快递组",
                                    IsDelete           = 0,
                                    ExpressName        = express_name,
                                    IndemnityMoney     = 0
                                };
                                db.T_ExpressIndemnity.Add(Inde);
                                db.SaveChanges();
                                List <T_ExchangePic> picList = db.T_ExchangePic.Where(s => s.ExchangeId == model.ID).ToList();
                                foreach (var item in picList)
                                {
                                    T_ExpressIndemnityPic expressPic = new T_ExpressIndemnityPic
                                    {
                                        EID    = Inde.ID,
                                        PicURL = item.Url
                                    };
                                    db.T_ExpressIndemnityPic.Add(expressPic);
                                }
                                db.SaveChanges();
                            }

                            #endregion

                            //#region 新增订单数据

                            //string newOrderCode = "";
                            //string newCode = "";
                            //string usedOrderCode = model.OrderCode;
                            //string userCode = order.code;
                            //List<T_OrderList> HEmodel = db.T_OrderList.Where(a => a.platform_code.Contains(usedOrderCode)).ToList();
                            //List<T_OrderList> orderList = db.T_OrderList.Where(a => a.code.Contains(userCode)).ToList();
                            //if (HEmodel.Count > 1)
                            //{
                            //    string HEmodelCount = HEmodel.Count.ToString();
                            //    newOrderCode = usedOrderCode + HEmodelCount;
                            //}
                            //else
                            //    newOrderCode = usedOrderCode + "1";
                            //if (orderList.Count > 1)
                            //{
                            //    string listCount = orderList.Count.ToString();
                            //    newCode = userCode + listCount;
                            //}
                            //else
                            //    newCode = userCode + "1";
                            //model.NewOrderCode = newOrderCode;
                            //db.SaveChanges();
                            //T_OrderList newOrder = new T_OrderList
                            //{
                            //    code = newCode,
                            //    order_type_name = "换货订单",
                            //    platform_code = newOrderCode,
                            //    createtime = DateTime.Now,
                            //    dealtime = model.SingleTime.ToString(),
                            //    cod = order.cod,
                            //    approve = order.approve,
                            //    delivery_state = order.delivery_state,
                            //    warehouse_code = model.ReturnWarhouse,
                            //    warehouse_name = db.T_Warehouses.SingleOrDefault(s => s.code.Equals(model.ReturnWarhouse)).name,
                            //    shop_code = model.StoreCode,
                            //    shop_name = model.StoreName,
                            //    express_code = model.ReturnExpressName,
                            //    express_name = db.T_Express.SingleOrDefault(s => s.Code.Equals(model.ReturnExpressName)).Name,
                            //    buyer_memo = model.BuyRemark,
                            //    seller_memo = model.SalesRemark,
                            //    vip_code = model.VipCode,
                            //    vip_name = model.VipName,
                            //    receiver_name = model.ReceivingName,
                            //    receiver_mobile = model.ReceivingTelPhone,
                            //    receiver_phone = model.ReceivingPhone,
                            //    receiver_zip = model.NeedPostalCode,
                            //    receiver_area = model.AddressMessage,
                            //    receiver_address = model.ReceivingAddress,
                            //    payCode = order.payCode,
                            //    vipIdCard = order.vipIdCard,
                            //    vipRealName = order.vipRealName,
                            //    vipEmail = order.vipEmail,
                            //    amount = 0,
                            //    payment_amount = 0,
                            //    post_fee = 0,
                            //    discount_fee = 0,
                            //    payment = 0,
                            //    qty = "1",
                            //    weight_origin = "0",
                            //    post_cost = 0,
                            //    mail_no = model.ReturnExpressCode,
                            //    platform_flag = "0",
                            //    IsGeneralize = 0,
                            //    Status_CashBack = 0,
                            //    Status_Retreat = 0,
                            //    Status_ExpressIndemnity = 0,
                            //    ExchangeStatus = 0,
                            //    ReissueStatus = 0
                            //};
                            //db.T_OrderList.Add(newOrder);
                            //db.SaveChanges();
                            //foreach (var item in exchangedetail)
                            //{
                            //    T_OrderDetail Orderdetail = db.T_OrderDetail.FirstOrDefault(s => s.oid.Equals(order.code) && s.item_code.Equals(item.SendProductCode));
                            //    if (Orderdetail != null)//修改原订单详情换货状态与换货数量
                            //    {
                            //        Orderdetail.ExchangeStatus = 1;
                            //        Orderdetail.ExchangeQty += item.SendProductNum;
                            //        db.SaveChanges();
                            //    }
                            //    T_OrderDetail t = new T_OrderDetail
                            //    {
                            //        oid = newCode,
                            //        refund = 0,
                            //        item_code = item.NeedProductCode,
                            //        item_name = item.NeedProductName,
                            //        item_simple_name = "",
                            //        sku_code = "",
                            //        sku_name = "",
                            //        qty = 0,
                            //        price = 0,
                            //        amount = 0,
                            //        discount_fee = 0,
                            //        amount_after = 0,
                            //        post_fee = 0,
                            //        platform_item_name = "",
                            //        platform_sku_name = "",
                            //        note = "",
                            //        ExchangeStatus = 0,
                            //        ExchangeQty = 0,
                            //        ReissueStatus = 0,
                            //        ReissueQty = 0,
                            //        RetreatQty = 0,
                            //        RetreatStatus = 0
                            //    };
                            //    db.T_OrderDetail.Add(t);
                            //    db.SaveChanges();
                            //}

                            //#endregion

                            #region 加入补发货

                            string    remark = "";
                            T_Reissue re     = db.T_Reissue.FirstOrDefault(s => s.OrderCode.Equals(model.OrderCode) && s.IsDelete == 0);
                            if (re != null)
                            {
                                var date      = Convert.ToDateTime(DateTime.Now).ToString("yyyyMMdd");
                                var modeldate = Convert.ToDateTime(re.CreatDate).ToString("yyyyMMdd");

                                if (re != null && int.Parse(date) - int.Parse(modeldate) <= 3)
                                {
                                    remark = model.SystemRemark + "3天内补发货重复";
                                }
                            }
                            //更改订单主表补发货状态
                            //else
                            //{
                            //    order.ReissueStatus = 1;
                            //    db.SaveChanges();
                            //}
                            T_Reissue reissue = new T_Reissue
                            {
                                OrderCode      = model.OrderCode,
                                NewOrderCode   = "8" + DateTime.Now.ToString("yyyyMMddHHmmss"),
                                VipName        = model.VipName,
                                StoreName      = model.StoreName,
                                WarhouseName   = model.NeedWarhouse,
                                ExpressName    = model.NeedExpress,
                                OrderType      = "Return",
                                SingleTime     = model.SingleTime,
                                ReceivingName  = model.ReceivingName,
                                PostalCode     = model.NeedPostalCode,
                                Phone          = model.ReceivingPhone,
                                TelPhone       = model.ReceivingTelPhone,
                                VipCode        = model.VipCode,
                                Address        = model.ReceivingAddress,
                                AddressMessage = model.AddressMessage,
                                SalesRemark    = model.SalesRemark,
                                BuyRemark      = model.BuyRemark,
                                StoreCode      = model.StoreCode,
                                Step           = 0,
                                Status         = -2,
                                BusinessName   = Com.GetReissueName(model.StoreCode, model.ExchangeReson),
                                PostUser       = model.PostUser,
                                DraftName      = Com.GetReissueName(model.StoreCode, model.ExchangeReson),
                                CreatDate      = DateTime.Now,
                                IsDelete       = 0,
                                ReissueReson   = model.ExchangeReson,
                                SystemRemark   = remark
                            };
                            db.T_Reissue.Add(reissue);
                            db.SaveChanges();
                            IQueryable <T_ExchangeDetail> detail = db.T_ExchangeDetail.Where(s => s.ExchangeCenterId == model.ID);
                            foreach (var item in detail)
                            {
                                T_ReissueDetail items = new T_ReissueDetail
                                {
                                    ProductCode = item.NeedProductCode,
                                    ProductName = item.NeedProductName,
                                    Num         = item.NeedProductNum,
                                    ReissueId   = reissue.ID
                                };
                                db.T_ReissueDetail.Add(items);
                            }
                            db.SaveChanges();

                            #endregion

                            #region 判断仓库是否收货

                            T_ReturnToStorage storge = db.T_ReturnToStorage.SingleOrDefault(s => s.Retreat_expressNumber.Equals(model.ReturnExpressCode));
                            if (storge != null)
                            {
                                //List<T_ExchangeCenter> exchange = db.T_ExchangeCenter.Where(s => s.OrderCode.Equals(model.OrderCode) && s.IsDelete == 0).ToList();

                                model.WarhouseStatus = 1;
                                model.Status         = 1;
                                T_ExchangeCenterApprove approve1 = db.T_ExchangeCenterApprove.SingleOrDefault(s => s.ApproveName.Equals("仓库") && !s.ApproveTime.HasValue && s.Pid == model.ID);
                                approve1.ApproveName   = "仓库";
                                approve1.ApproveStatus = 1;
                                approve1.ApproveTime   = DateTime.Now;
                                //判断是否第一次换货,如果是则修改订单状态为已收货
                                //if (exchange.Count() == 1)
                                //{
                                //    order.ExchangeStatus = 2;
                                //}
                            }


                            #endregion
                        }
                    }
                    List <T_ModularNotaudited> ModularNotaudited = db.T_ModularNotaudited.Where(a => a.ModularName == "换货未审核").ToList();
                    if (ModularNotaudited.Count > 0)
                    {
                        foreach (var item in ModularNotaudited)
                        {
                            db.T_ModularNotaudited.Remove(item);
                        }
                        db.SaveChanges();
                    }
                    string         RetreatAppRoveSql   = "  select isnull(ApproveUser,ApproveName) as PendingAuditName,COUNT(*) as NotauditedNumber from T_ExchangeCenterApprove where  Pid in ( select ID from T_ExchangeCenter where IsDelete=0 ) and  ApproveStatus=-1 and ApproveTime is null GROUP BY ApproveName,ApproveUser";
                    List <Modular> RetreatAppRoveQuery = db.Database.SqlQuery <Modular>(RetreatAppRoveSql).ToList();
                    string         Nickname            = Server.UrlDecode(Request.Cookies["Nickname"].Value);
                    for (int e = 0; e < RetreatAppRoveQuery.Count; e++)
                    {
                        string PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;

                        T_ModularNotaudited NotauditedModel = db.T_ModularNotaudited.SingleOrDefault(a => a.ModularName == "换货未审核" && a.PendingAuditName == PendingAuditName);
                        if (NotauditedModel != null)
                        {
                            NotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                            db.Entry <T_ModularNotaudited>(NotauditedModel).State = System.Data.EntityState.Modified;
                        }
                        else
                        {
                            T_ModularNotaudited ModularNotauditedModel = new T_ModularNotaudited();
                            ModularNotauditedModel.ModularName      = "换货未审核";
                            ModularNotauditedModel.NotauditedNumber = RetreatAppRoveQuery[e].NotauditedNumber;
                            ModularNotauditedModel.PendingAuditName = RetreatAppRoveQuery[e].PendingAuditName;
                            ModularNotauditedModel.ToupdateDate     = DateTime.Now; ModularNotauditedModel.ToupdateName = Nickname;
                            db.T_ModularNotaudited.Add(ModularNotauditedModel);
                        }
                        db.SaveChanges();
                    }
                    sc.Complete();
                    return(Json(new { State = "Success" }, JsonRequestBehavior.AllowGet));
                }
                catch (Exception ex)
                {
                    return(Json(new { State = "Faile", Message = ex.Message }, JsonRequestBehavior.AllowGet));
                }
            }
        }
 public override void Cancel()
 {
     Com.Call(() => this.NativePattern.Cancel());
 }
示例#40
0
 protected LoopController(Com comObject) : base(comObject)
 {
 }
 public object GetUnderlyingObjectModel()
 {
     return(Com.Call(() => this.NativePattern.GetUnderlyingObjectModel()));
 }
示例#42
0
 // writes a file to the project folder
 private static void WriteCodeFile()
 {
     Com.WriteCodeFile(FilePath, builder =>
     {
         WrappedInt indentCount = 0;
         builder.AppendIndentLine(indentCount, Com.AutoGenTemplate);
         builder.AppendIndentLine(indentCount, "using UnityEngine;");
         builder.Append(Environment.NewLine);
         builder.AppendIndentLine(indentCount, Com.NameSpaceTemplate);
         using (new CurlyIndent(builder, indentCount))
         {
             builder.AppendIndentFormatLine(indentCount, "public static class {0}", FileName);
             using (new CurlyIndent(builder, indentCount))
             {
                 // string
                 foreach (var name in Com.names)
                 {
                     builder.AppendIndentFormatLine(indentCount, "public const string {0}{1} = @\"{2}\";", CodeGeneratorCommon.StringPrefix, Com.MakeIdentifier(name), Com.EscapeDoubleQuote(name));
                 }
                 builder.Append(Environment.NewLine);
                 // hash storage
                 foreach (var name in Com.names)
                 {
                     builder.AppendIndentFormatLine(indentCount, "public const int {0} = {1};", Com.MakeIdentifier(name), Animator.StringToHash(name));
                 }
             }
         }
     });
 }
示例#43
0
 /// <summary>
 /// 格式化数字,获取xxx xxxk xxxw
 /// </summary>
 /// <param name="num"></param>
 /// <returns></returns>
 public static string SimpleNumber(this Int64 num)
 {
     return(Com.SimpleNumber(num));
 }
示例#44
0
 public override void Close()
 {
     Com.Call(() => this.NativePattern.Close());
 }
示例#45
0
        /// <summary>
        /// 索引磁盘上的文件
        /// </summary>
        private static void IndexFiles()
        {
            PrepareES(client =>
            {
                var indexName = nameof(DiskFileIndex).ToLower();
                try
                {
                    client.CreateIndexIfNotExists(indexName, x => x.DeaultCreateIndexDescriptor <DiskFileIndex>());
                }
                catch (Exception e)
                {
                    e.AddErrorLog();
                }

                var txtFiles = new string[] {
                    ".txt", ".cs", ".css", ".js", ".cshtml", ".html"
                    , ".readme", ".json", ".config", ".md"
                };

                var maxSize = Com.MbToB(1);

                Com.FindFiles("D:\\XXXXXXXXXXXXXXXXXXXX\\", (f) =>
                {
                    Thread.Sleep(100);
                    try
                    {
                        if (!txtFiles.Any(x => ConvertHelper.GetString(f.Name).ToLower().EndsWith(x)) ||
                            ConvertHelper.GetString(f.FullName).ToLower().Contains("elasticsearch") ||
                            f.Length > maxSize)
                        {
                            Console.WriteLine($"跳过文件:{f.FullName}");
                            return;
                        }
                        var model       = new DiskFileIndex();
                        model.Path      = f.FullName;
                        model.Name      = f.Name;
                        model.Extension = f.Extension;
                        model.Size      = f.Length;
                        model.Content   = File.ReadAllText(model.Path);
                        var data        = new List <DiskFileIndex>()
                        {
                            model
                        };
                        client.AddToIndex(indexName, data);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }, (c) =>
                {
                    Console.WriteLine($"剩余任务:{c}");
                    if (c > 5000)
                    {
                        Thread.Sleep(400);
                    }
                });
                Console.ReadLine();
                return(true);
            });
        }
 public override void Scroll(ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
 {
     Com.Call(() => NativePattern.Scroll((UIA.ScrollAmount)horizontalAmount, (UIA.ScrollAmount)verticalAmount));
 }
 public SFGAO GetAttributesOf(PIDLIST[] pidls, SFGAO attrs)
 {
     Com.GetAttributesOf(pidls.Length, pidls, ref attrs);
     return(attrs);
 }
示例#48
0
        IPPacket IPReader()
        {
            bool        b7E = false;
            byte        rx;
            List <byte> RxTemp = new List <byte>();

            while (true)
            {
                try
                {
                    rx = (byte)Com.ReadByte();
                }
                catch (InvalidOperationException ex)//端口被关闭,任务结束
                {
                    throw ex;
                }
                catch
                {
                    return(null);
                }
                if (b7E)
                {
                    if (rx == 0x7e)
                    {
                        List <byte> RxList = pppDataTransferConvert.PPPDataDecode(RxTemp);
// #if DEBUG
//                         communicationDebugForm.ExternShowRx(RxList);
// #endif

//                         ushort crc = BytesOP.MakeShort(RxList[RxList.Count - 1], RxList[RxList.Count - 2]);
//                         if (Verify.GetVerify_CRC16_CCITT(RxList.ToArray(), RxList.Count - 2) != crc)
//                             return null;
//                         if (RxList[0] == 0xff || RxList[1] == 0x03)//去掉地址字节,本库中没有
//                         {
//                             RxList.Remove(0xff);
//                             RxList.Remove(0x03);
//                         }
                        IPPacket ipUp;
                        try
                        {
                            ipUp = IPPacket.MakeIPPacket(RxList, 4);
                        }
                        catch
                        {
                            pppPocket pppUp;
                            pppUp = pppDataTransferConvert.MakepppPacket(RxList, 2);
                            switch (pppUp.Protocol)
                            {
                            case 0xc021:
                                LCP(pppUp);
                                break;

                            case 0xc023:
                                PAP(pppUp);
                                break;

                            case 0x8021:
                                IPCP(pppUp);
                                break;
                            }
                            Debug.WriteLine(Com.PortName + StringsFunction.byteToHexStr(RxTemp.ToArray(), " "));
                            return(null);
                        }
                        TCPPacket tcpUp = (TCPPacket)ipUp.oProtocolContent;
                        if (tcpUp != null)
                        {
                            OnIPProcLog("编号:" + tcpUp.InitialSeqNumber.ToString(), (int)ATCommandLogType.Rx);
                            OnIPProcLog("回应编号:" + tcpUp.AckSeqNumber.ToString(), (int)ATCommandLogType.Rx);
                            OnIPProcLog("标志:" + tcpUp.TCPFlags.ToString("X2"), (int)ATCommandLogType.Rx);
                        }
                        return(ipUp);
                    }
                    else
                    {
                        RxTemp.Add(rx);
                    }
                }
                else
                {
                    if (rx == 0x7e)
                    {
                        b7E = true;
                    }
                    else
                    {
                        OnIPProcLog("未知接收:" + rx.ToString("X2"), (int)ATCommandLogType.Rx);
                    }
                }
            }
        }
示例#49
0
        public override AutomationElement GetItem(int row, int column)
        {
            var nativeItem = Com.Call(() => this.NativePattern.GetItem(row, column));

            return(AutomationElementConverter.NativeToManaged((UIA3Automation)this.BasicAutomationElement.Automation, nativeItem));
        }
示例#50
0
		private static void ExtractTiff(RandomAccessReader reader, Com.Drew.Metadata.Metadata metadata, Com.Drew.Metadata.Directory firstDirectory, int tiffHeaderOffset)
		{
			// this should be either "MM" or "II"
			string byteOrderIdentifier = reader.GetString(tiffHeaderOffset, 2);
			if ("MM".Equals(byteOrderIdentifier))
			{
				reader.SetMotorolaByteOrder(true);
			}
			else
			{
				if ("II".Equals(byteOrderIdentifier))
				{
					reader.SetMotorolaByteOrder(false);
				}
				else
				{
					firstDirectory.AddError("Unclear distinction between Motorola/Intel byte ordering: " + byteOrderIdentifier);
					return;
				}
			}
			// Check the next two values for correctness.
			int tiffMarker = reader.GetUInt16(2 + tiffHeaderOffset);
			int standardTiffMarker = unchecked((int)(0x002A));
			int olympusRawTiffMarker = unchecked((int)(0x4F52));
			// for ORF files
			int panasonicRawTiffMarker = unchecked((int)(0x0055));
			// for RW2 files
			if (tiffMarker != standardTiffMarker && tiffMarker != olympusRawTiffMarker && tiffMarker != panasonicRawTiffMarker)
			{
				firstDirectory.AddError("Unexpected TIFF marker after byte order identifier: 0x" + Sharpen.Extensions.ToHexString(tiffMarker));
				return;
			}
			int firstIfdOffset = reader.GetInt32(4 + tiffHeaderOffset) + tiffHeaderOffset;
			// David Ekholm sent a digital camera image that has this problem
			// TODO getLength should be avoided as it causes RandomAccessStreamReader to read to the end of the stream
			if (firstIfdOffset >= reader.GetLength() - 1)
			{
				firstDirectory.AddError("First Exif directory offset is beyond end of Exif data segment");
				// First directory normally starts 14 bytes in -- try it here and catch another error in the worst case
				firstIfdOffset = 14;
			}
			ICollection<int> processedIfdOffsets = new HashSet<int>();
			ProcessIFD(firstDirectory, processedIfdOffsets, firstIfdOffset, tiffHeaderOffset, metadata, reader);
			// after the extraction process, if we have the correct tags, we may be able to store thumbnail information
			ExifThumbnailDirectory thumbnailDirectory = metadata.GetDirectory<ExifThumbnailDirectory>();
			if (thumbnailDirectory != null && thumbnailDirectory.ContainsTag(ExifThumbnailDirectory.TagThumbnailCompression))
			{
				int? offset = thumbnailDirectory.GetInteger(ExifThumbnailDirectory.TagThumbnailOffset);
				int? length = thumbnailDirectory.GetInteger(ExifThumbnailDirectory.TagThumbnailLength);
				if (offset != null && length != null)
				{
					try
					{
						sbyte[] thumbnailData = reader.GetBytes(tiffHeaderOffset + offset.Value, length.Value);
						thumbnailDirectory.SetThumbnailData(thumbnailData);
					}
					catch (IOException ex)
					{
						firstDirectory.AddError("Invalid thumbnail data specification: " + ex.Message);
					}
				}
			}
		}
示例#51
0
        //详情数据加载
        public JsonResult GetDetail(int ID, string UserName)
        {
            T_User MOD_User = db.T_User.FirstOrDefault(a => a.Nickname == UserName);
            //真名
            string name   = MOD_User.Name;
            string result = "";
            //主表
            T_Borrow mod  = db.T_Borrow.Find(ID);
            mainItem list = new mainItem();

            list.ID                   = mod.ID;
            list.BorrowName           = mod.BorrowName;
            list.BorrowerFrom         = mod.BorrowerFrom;
            list.BorrowerDep          = mod.BorrowerDep;
            list.BorrowReason         = mod.BorrowReason;
            list.BorrowMoney          = mod.BorrowMoney;
            list.BorrowDate           = mod.BorrowDate;
            list.BorrowState          = mod.BorrowState;
            list.BorrowSettementState = mod.BorrowSettementState;
            list.BorrowCode           = mod.BorrowCode;
            list.BorrowAccountID      = mod.BorrowAccountID;
            list.BorrowBank           = mod.BorrowBank;
            list.BorrowNeedDate       = mod.BorrowNeedDate;
            list.BorrowAccountName    = mod.BorrowAccountName;
            list.BorrowNextApprove    = mod.BorrowNextApprove;
            list.BorrowStep           = mod.BorrowStep;
            list.BorrowAccountName    = mod.BorrowAccountName;
            list.IsVoucher            = mod.IsVoucher;

            string modJson = JsonConvert.SerializeObject(list, Lib.Comm.setTimeFormat());

            //审核记录
            IQueryable <T_BorrowApprove> mod_Approve = db.T_BorrowApprove.Where(a => a.Pid == ID);
            string approve = JsonConvert.SerializeObject(mod_Approve, Lib.Comm.setTimeFormat());

            T_BorrowApprove Approve = db.T_BorrowApprove.FirstOrDefault(s => !s.ApproveTime.HasValue && s.Pid == ID);

            if (Approve == null)
            {
                Approve = db.T_BorrowApprove.FirstOrDefault(s => s.ApproveTime.HasValue && s.Pid == ID);
            }


            //用于判断是不是我审核 0不是 1是
            int             myCheck   = 0;
            T_BorrowApprove MyApprove = db.T_BorrowApprove.FirstOrDefault(a => a.Pid == ID && a.ApproveName == UserName && a.ApproveTime == null);

            if (MyApprove != null)
            {
                myCheck = 1;
            }
            //财务主管?
            //int Cashier = 0;
            int curStep = int.Parse(mod.BorrowStep.ToString());
            //取最后一步

            int Step = db.T_BorrowApproveConfig.ToList().Count;

            //如果不是最后1 步,就显示选择下拉框



            List <SelectListItem> getCheckMan = new List <SelectListItem>();
            T_BorrowApproveConfig approveusers;

            mod.BorrowStep = mod.BorrowStep + 1;
            if (UserName == "子轩" && mod.BorrowStep == 3)
            {
                mod.BorrowStep = mod.BorrowStep + 1;
                approveusers   = db.T_BorrowApproveConfig.FirstOrDefault(a => a.Step == mod.BorrowStep);
            }
            else
            {
                approveusers = db.T_BorrowApproveConfig.FirstOrDefault(a => a.Step == mod.BorrowStep);
            }
            //var approveusers = db.T_BorrowApproveConfig.FirstOrDefault(a => a.Step == mod.BorrowStep + 1);
            if (approveusers != null)
            {
                //如果是动态获取当前部门主管
                if (approveusers.ApproveUser.Equals("部门主管"))
                {
                    List <SelectListItem> items = new List <SelectListItem>();
                    items.Add(new SelectListItem {
                        Text = "请选择", Value = "9999"
                    });
                    getCheckMan = items;
                }
                //如果还有其他的审核组或者动态绑定的数据 再增加else
                //如果是固定的某些人
                else
                {
                    string[] array = approveusers.ApproveUser.Split(',');
                    List <SelectListItem> items = new List <SelectListItem>();

                    foreach (var item in array)
                    {
                        T_User user = db.T_User.FirstOrDefault(a => a.Nickname.Equals(item));
                        if (user != null)
                        {
                            items.Add(new SelectListItem {
                                Text = user.Nickname, Value = user.ID.ToString()
                            });
                        }
                    }
                    getCheckMan = items;
                }
            }
            else
            {
                getCheckMan = null;
            }
            //支付
            List <SelectListItem> listBorrowForm = Lib.Comm.BorrowForm;
            string theBorrowForm = JsonConvert.SerializeObject(listBorrowForm, Lib.Comm.setTimeFormat());
            //审核人
            string CheckManJson = JsonConvert.SerializeObject(getCheckMan, Lib.Comm.setTimeFormat());
            //公司
            List <SelectListItem> listCompany = Com.ExpenseCompany();
            string theCompany = JsonConvert.SerializeObject(listCompany, Lib.Comm.setTimeFormat());



            result += "{\"Main\":[" + modJson + "],\"Approve\":" + approve + ",\"myCheck\":" + myCheck + ",\"Step\":" + Step + ",\"approveId\":" + Approve.ID + ",\"CheckList\":" + CheckManJson + ",\"theBorrowForm\":" + theBorrowForm + ",\"listCompany\":" + theCompany + "}";
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#52
0
		private static void ProcessMakernote(int makernoteOffset, ICollection<int> processedIfdOffsets, int tiffHeaderOffset, Com.Drew.Metadata.Metadata metadata, RandomAccessReader reader)
		{
			// Determine the camera model and makernote format
			Com.Drew.Metadata.Directory ifd0Directory = metadata.GetDirectory<ExifIFD0Directory>();
			if (ifd0Directory == null)
			{
				return;
			}
			string cameraMake = ifd0Directory.GetString(ExifIFD0Directory.TagMake);
			string firstThreeChars = reader.GetString(makernoteOffset, 3);
			string firstFourChars = reader.GetString(makernoteOffset, 4);
			string firstFiveChars = reader.GetString(makernoteOffset, 5);
			string firstSixChars = reader.GetString(makernoteOffset, 6);
			string firstSevenChars = reader.GetString(makernoteOffset, 7);
			string firstEightChars = reader.GetString(makernoteOffset, 8);
			string firstTwelveChars = reader.GetString(makernoteOffset, 12);
			bool byteOrderBefore = reader.IsMotorolaByteOrder();
			if ("OLYMP".Equals(firstFiveChars) || "EPSON".Equals(firstFiveChars) || "AGFA".Equals(firstFourChars))
			{
				// Olympus Makernote
				// Epson and Agfa use Olympus makernote standard: http://www.ozhiker.com/electronics/pjmt/jpeg_info/
				ProcessIFD(metadata.GetOrCreateDirectory<OlympusMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 8, tiffHeaderOffset, metadata, reader);
			}
			else
			{
				if (cameraMake != null && Sharpen.Extensions.Trim(cameraMake).ToUpper().StartsWith("NIKON"))
				{
					if ("Nikon".Equals(firstFiveChars))
					{
						switch (reader.GetUInt8(makernoteOffset + 6))
						{
							case 1:
							{
								/* There are two scenarios here:
                 * Type 1:                  **
                 * :0000: 4E 69 6B 6F 6E 00 01 00-05 00 02 00 02 00 06 00 Nikon...........
                 * :0010: 00 00 EC 02 00 00 03 00-03 00 01 00 00 00 06 00 ................
                 * Type 3:                  **
                 * :0000: 4E 69 6B 6F 6E 00 02 00-00 00 4D 4D 00 2A 00 00 Nikon....MM.*...
                 * :0010: 00 08 00 1E 00 01 00 07-00 00 00 04 30 32 30 30 ............0200
                 */
								ProcessIFD(metadata.GetOrCreateDirectory<NikonType1MakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 8, tiffHeaderOffset, metadata, reader);
								break;
							}

							case 2:
							{
								ProcessIFD(metadata.GetOrCreateDirectory<NikonType2MakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 18, makernoteOffset + 10, metadata, reader);
								break;
							}

							default:
							{
								ifd0Directory.AddError("Unsupported Nikon makernote data ignored.");
								break;
							}
						}
					}
					else
					{
						// The IFD begins with the first Makernote byte (no ASCII name).  This occurs with CoolPix 775, E990 and D1 models.
						ProcessIFD(metadata.GetOrCreateDirectory<NikonType2MakernoteDirectory>(), processedIfdOffsets, makernoteOffset, tiffHeaderOffset, metadata, reader);
					}
				}
				else
				{
					if ("SONY CAM".Equals(firstEightChars) || "SONY DSC".Equals(firstEightChars))
					{
						ProcessIFD(metadata.GetOrCreateDirectory<SonyType1MakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 12, tiffHeaderOffset, metadata, reader);
					}
					else
					{
						if ("SEMC MS\u0000\u0000\u0000\u0000\u0000".Equals(firstTwelveChars))
						{
							// force MM for this directory
							reader.SetMotorolaByteOrder(true);
							// skip 12 byte header + 2 for "MM" + 6
							ProcessIFD(metadata.GetOrCreateDirectory<SonyType6MakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 20, tiffHeaderOffset, metadata, reader);
						}
						else
						{
							if ("SIGMA\u0000\u0000\u0000".Equals(firstEightChars) || "FOVEON\u0000\u0000".Equals(firstEightChars))
							{
								ProcessIFD(metadata.GetOrCreateDirectory<SigmaMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 10, tiffHeaderOffset, metadata, reader);
							}
							else
							{
								if ("KDK".Equals(firstThreeChars))
								{
									reader.SetMotorolaByteOrder(firstSevenChars.Equals("KDK INFO"));
									ProcessKodakMakernote(metadata.GetOrCreateDirectory<KodakMakernoteDirectory>(), makernoteOffset, reader);
								}
								else
								{
									if (Sharpen.Runtime.EqualsIgnoreCase("Canon", cameraMake))
									{
										ProcessIFD(metadata.GetOrCreateDirectory<CanonMakernoteDirectory>(), processedIfdOffsets, makernoteOffset, tiffHeaderOffset, metadata, reader);
									}
									else
									{
										if (cameraMake != null && cameraMake.ToUpper().StartsWith("CASIO"))
										{
											if ("QVC\u0000\u0000\u0000".Equals(firstSixChars))
											{
												ProcessIFD(metadata.GetOrCreateDirectory<CasioType2MakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 6, tiffHeaderOffset, metadata, reader);
											}
											else
											{
												ProcessIFD(metadata.GetOrCreateDirectory<CasioType1MakernoteDirectory>(), processedIfdOffsets, makernoteOffset, tiffHeaderOffset, metadata, reader);
											}
										}
										else
										{
											if ("FUJIFILM".Equals(firstEightChars) || Sharpen.Runtime.EqualsIgnoreCase("Fujifilm", cameraMake))
											{
												// Note that this also applies to certain Leica cameras, such as the Digilux-4.3
												reader.SetMotorolaByteOrder(false);
												// the 4 bytes after "FUJIFILM" in the makernote point to the start of the makernote
												// IFD, though the offset is relative to the start of the makernote, not the TIFF
												// header (like everywhere else)
												int ifdStart = makernoteOffset + reader.GetInt32(makernoteOffset + 8);
												ProcessIFD(metadata.GetOrCreateDirectory<FujifilmMakernoteDirectory>(), processedIfdOffsets, ifdStart, makernoteOffset, metadata, reader);
											}
											else
											{
												if (cameraMake != null && cameraMake.ToUpper().StartsWith("MINOLTA"))
												{
													// Cases seen with the model starting with MINOLTA in capitals seem to have a valid Olympus makernote
													// area that commences immediately.
													ProcessIFD(metadata.GetOrCreateDirectory<OlympusMakernoteDirectory>(), processedIfdOffsets, makernoteOffset, tiffHeaderOffset, metadata, reader);
												}
												else
												{
													if ("KYOCERA".Equals(firstSevenChars))
													{
														// http://www.ozhiker.com/electronics/pjmt/jpeg_info/kyocera_mn.html
														ProcessIFD(metadata.GetOrCreateDirectory<KyoceraMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 22, tiffHeaderOffset, metadata, reader);
													}
													else
													{
														if ("LEICA".Equals(firstFiveChars))
														{
															reader.SetMotorolaByteOrder(false);
															if ("Leica Camera AG".Equals(cameraMake))
															{
																ProcessIFD(metadata.GetOrCreateDirectory<LeicaMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 8, tiffHeaderOffset, metadata, reader);
															}
															else
															{
																if ("LEICA".Equals(cameraMake))
																{
																	// Some Leica cameras use Panasonic makernote tags
																	ProcessIFD(metadata.GetOrCreateDirectory<PanasonicMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 8, tiffHeaderOffset, metadata, reader);
																}
															}
														}
														else
														{
															if ("Panasonic\u0000\u0000\u0000".Equals(reader.GetString(makernoteOffset, 12)))
															{
																// NON-Standard TIFF IFD Data using Panasonic Tags. There is no Next-IFD pointer after the IFD
																// Offsets are relative to the start of the TIFF header at the beginning of the EXIF segment
																// more information here: http://www.ozhiker.com/electronics/pjmt/jpeg_info/panasonic_mn.html
																ProcessIFD(metadata.GetOrCreateDirectory<PanasonicMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 12, tiffHeaderOffset, metadata, reader);
															}
															else
															{
																if ("AOC\u0000".Equals(firstFourChars))
																{
																	// NON-Standard TIFF IFD Data using Casio Type 2 Tags
																	// IFD has no Next-IFD pointer at end of IFD, and
																	// Offsets are relative to the start of the current IFD tag, not the TIFF header
																	// Observed for:
																	// - Pentax ist D
																	ProcessIFD(metadata.GetOrCreateDirectory<CasioType2MakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 6, makernoteOffset, metadata, reader);
																}
																else
																{
																	if (cameraMake != null && (cameraMake.ToUpper().StartsWith("PENTAX") || cameraMake.ToUpper().StartsWith("ASAHI")))
																	{
																		// NON-Standard TIFF IFD Data using Pentax Tags
																		// IFD has no Next-IFD pointer at end of IFD, and
																		// Offsets are relative to the start of the current IFD tag, not the TIFF header
																		// Observed for:
																		// - PENTAX Optio 330
																		// - PENTAX Optio 430
																		ProcessIFD(metadata.GetOrCreateDirectory<PentaxMakernoteDirectory>(), processedIfdOffsets, makernoteOffset, makernoteOffset, metadata, reader);
																	}
																	else
																	{
																		//        } else if ("KC".equals(firstTwoChars) || "MINOL".equals(firstFiveChars) || "MLY".equals(firstThreeChars) || "+M+M+M+M".equals(firstEightChars)) {
																		//            // This Konica data is not understood.  Header identified in accordance with information at this site:
																		//            // http://www.ozhiker.com/electronics/pjmt/jpeg_info/minolta_mn.html
																		//            // TODO add support for minolta/konica cameras
																		//            exifDirectory.addError("Unsupported Konica/Minolta data ignored.");
																		if ("SANYO\x0\x1\x0".Equals(firstEightChars))
																		{
																			ProcessIFD(metadata.GetOrCreateDirectory<SanyoMakernoteDirectory>(), processedIfdOffsets, makernoteOffset + 8, makernoteOffset, metadata, reader);
																		}
																	}
																}
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			// The makernote is not comprehended by this library.
			// If you are reading this and believe a particular camera's image should be processed, get in touch.
			reader.SetMotorolaByteOrder(byteOrderBefore);
		}
示例#53
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                adminhotelid.Value = RequestSession.GetSessionUser().AdminHotelid.ToString();
                StringBuilder sqlss = new StringBuilder();
                sqlss.Append("select * from PreferentialType where IsElectronics=0");
                DataTable dts = DataFactory.SqlDataBase().GetDataTableBySQL(sqlss);
                if (dts.Rows.Count > 0)
                {
                    DDLmode.Items.Insert(0, new ListItem("请选择", "0"));
                    for (int i = 0; i < dts.Rows.Count; i++)
                    {
                        DDLmode.Items.Insert(i + 1, new ListItem(dts.Rows[i]["TypeName"].ToString(), dts.Rows[i]["id"].ToString()));
                    }
                }
                Com.SetChildren(0, 0, 0, DDLmode, 0);

                StringBuilder sqlsss = new StringBuilder();
                sqlsss.Append("select * from CouponType  ");
                DataTable dtss = DataFactory.SqlDataBase().GetDataTableBySQL(sqlsss);
                if (dtss.Rows.Count > 0)
                {
                    ddltype.Items.Insert(0, new ListItem("请选择", "0"));
                    for (int i = 0; i < dtss.Rows.Count; i++)
                    {
                        ddltype.Items.Insert(i + 1, new ListItem(dtss.Rows[i]["name"].ToString(), dtss.Rows[i]["id"].ToString()));
                    }
                }
                Com.SetChildren(0, 0, 0, ddltype, 0);

                if (Request["ID"] != null)
                {
                    string    sql = string.Format(@"select * from coupon where id='{0}'", Request["id"]);
                    DataTable ds  = DataFactory.SqlDataBase().GetDataTableBySQL(new StringBuilder(sql));
                    if (ds != null && ds.Rows.Count > 0)
                    {
                        B_sj.Value            = ds.Rows[0]["BiginTime"].ToString().Split(' ')[0];
                        E_sj.Value            = ds.Rows[0]["EndinTime"].ToString().Split(' ')[0];
                        txtName.Value         = ds.Rows[0]["CouponName"].ToString();
                        txtPar.Value          = ds.Rows[0]["Par"].ToString();
                        txtUsedMin.Value      = ds.Rows[0]["UsedMin"].ToString();
                        txtInstructions.Value = ds.Rows[0]["ProductRange"].ToString();
                        _sumhotel             = sumhotel.Value = ds.Rows[0]["ServiceRange"].ToString();
                        DDLmode.SelectedValue = ds.Rows[0]["Mode"].ToString();
                        ddltype.SelectedValue = ds.Rows[0]["TypeID"].ToString();
                        //指定赠送
                        if (ds.Rows[0]["MembergradeType"] != null && ds.Rows[0]["MembergradeType"].ToString() != "")
                        {
                            _zdzs = hfzdzs.Value = ds.Rows[0]["MembergradeType"].ToString();
                        }


                        if (ds.Rows[0]["FirstMoney"] != null && ds.Rows[0]["FirstMoney"].ToString() != "")
                        {
                            txtFirstMoney.Value = ds.Rows[0]["FirstMoney"].ToString();
                        }
                        if (ds.Rows[0]["SecondMoney"] != null && ds.Rows[0]["SecondMoney"].ToString() != "")
                        {
                            txtcz.Value = ds.Rows[0]["SecondMoney"].ToString();
                        }

                        if (ds.Rows[0]["IsEnable"] != null && ds.Rows[0]["IsEnable"].ToString() != "")
                        {
                            hfsfqy.Value = _sfqy = ds.Rows[0]["IsEnable"].ToString();
                        }
                        if (ds.Rows[0]["Is_Day_ok"] != null && ds.Rows[0]["Is_Day_ok"].ToString() != "")
                        {
                            hfIs_Day_ok.Value = _Is_Day_ok = ds.Rows[0]["Is_Day_ok"].ToString();
                        }

                        if (ds.Rows[0]["hytype"] != null && ds.Rows[0]["hytype"].ToString() != "")
                        {
                            hhytype.Value = _hytype = ds.Rows[0]["hytype"].ToString();
                        }
                        if (ds.Rows[0]["Isgiving"] != null && ds.Rows[0]["Isgiving"].ToString() != "")
                        {
                            hfsfzs.Value = _sfzs = ds.Rows[0]["Isgiving"].ToString();
                        }

                        if (ds.Rows[0]["ConsumptionType"] != null && ds.Rows[0]["ConsumptionType"].ToString() != "")
                        {
                            HConsumptionType.Value = _ConsumptionType = ds.Rows[0]["ConsumptionType"].ToString();
                        }

                        txtNum.Value   = ds.Rows[0]["count"].ToString();
                        txtTotal.Value = ds.Rows[0]["Total"].ToString();
                        if (ds.Rows[0]["Mode"].ToString() == "2")//消费赠送
                        {
                            srzs.Style.Add("display", "none");
                            zdzs.Style.Add("display", "none");
                            hydj.Style.Add("display", "none");
                            hykh.Style.Add("display", "none");
                            hyxx.Style.Add("display", "none");
                            xfje.Style.Add("display", "");
                            zssm.Style.Add("display", "none");
                            sfzs.Style.Add("display", "none");
                        }
                        else if (ds.Rows[0]["Mode"].ToString() == "10")//指定赠送
                        {
                            srzs.Style.Add("display", "none");
                            zdzs.Style.Add("display", "");
                            hydj.Style.Add("display", "none");
                            hykh.Style.Add("display", "none");
                            hyxx.Style.Add("display", "none");
                            xfje.Style.Add("display", "none");
                            zssm.Style.Add("display", "none");
                            sfzs.Style.Add("display", "none");

                            if (ds.Rows[0]["MembergradeType"].ToString() == "1")
                            {
                                srzs.Style.Add("display", "none");
                                zdzs.Style.Add("display", "");
                                hydj.Style.Add("display", "none");
                                hykh.Style.Add("display", "none");
                                hyxx.Style.Add("display", "none");
                                xfje.Style.Add("display", "none");
                                zssm.Style.Add("display", "");
                                sfzs.Style.Add("display", "");
                            }
                            else if (ds.Rows[0]["MembergradeType"].ToString() == "2")
                            {
                                srzs.Style.Add("display", "none");
                                zdzs.Style.Add("display", "");
                                hydj.Style.Add("display", "");
                                hykh.Style.Add("display", "none");
                                hyxx.Style.Add("display", "none");
                                xfje.Style.Add("display", "none");
                                zssm.Style.Add("display", "");
                                sfzs.Style.Add("display", "");
                            }
                            else if (ds.Rows[0]["MembergradeType"].ToString() == "3")
                            {
                                srzs.Style.Add("display", "none");
                                zdzs.Style.Add("display", "");
                                hydj.Style.Add("display", "none");
                                hykh.Style.Add("display", "");
                                hyxx.Style.Add("display", "");
                                xfje.Style.Add("display", "none");
                                zssm.Style.Add("display", "");
                                sfzs.Style.Add("display", "");
                            }
                        }
                        else if (ds.Rows[0]["Mode"].ToString() == "15") //生日赠送
                        {
                            hdSendType.Value = ds.Rows[0]["BirthdaySendType"].ToString();
                            srzs.Style.Add("display", "");
                            zdzs.Style.Add("display", "none");
                            hydj.Style.Add("display", "none");
                            hykh.Style.Add("display", "none");
                            hyxx.Style.Add("display", "none");
                            xfje.Style.Add("display", "none");
                            zssm.Style.Add("display", "none");
                            sfzs.Style.Add("display", "none");
                        }
                        else//其他类型不可见
                        {
                            srzs.Style.Add("display", "none");
                            zdzs.Style.Add("display", "none");
                            hydj.Style.Add("display", "none");
                            hykh.Style.Add("display", "none");
                            hyxx.Style.Add("display", "none");
                            xfje.Style.Add("display", "none");
                            zssm.Style.Add("display", "none");
                            sfzs.Style.Add("display", "none");
                        }



                        //有效期类型
                        if (ds.Rows[0]["EffectiveType"] != null && ds.Rows[0]["EffectiveType"].ToString() != "")
                        {
                            hfEffectiveType.Value = _Effective = ds.Rows[0]["EffectiveType"].ToString();
                        }

                        //有效天数
                        if (ds.Rows[0]["EffectiveDay"] != null && ds.Rows[0]["EffectiveDay"].ToString() != "")
                        {
                            txtDay.Value = ds.Rows[0]["EffectiveDay"].ToString();
                        }


                        hfdID.Value = Request["id"];
                        IsMembergrade(ds.Rows[0]["Membergrade"].ToString());
                        IsyxMembergrade(ds.Rows[0]["ishy"].ToString());
                        Isjjr(ds.Rows[0]["jjr"].ToString());
                        IsOpen_Hotel(ds.Rows[0]["Open_Hotel"].ToString());
                        //hjjr.Value = ds.Rows[0]["jjr"].ToString();
                        hyxrq.Value = ds.Rows[0]["yxrq"].ToString();
                    }
                }
                else
                {
                    IsMembergrade("0");
                    IsyxMembergrade("0");
                    Isjjr("0");
                    IsOpen_Hotel("0");
                }
            }
        }
    public static Com.Mobicage.Rogerthat.Messaging.FlowMemberResultResponse BookMeetingRoom(IDbConnection db, Com.Mobicage.Rogerthat.Messaging.FlowMemberResultRequest request)
    {
        Com.Mobicage.Rogerthat.Messaging.FlowMemberResultResponse result = new Com.Mobicage.Rogerthat.Messaging.FlowMemberResultResponse();
        if (!User.Exists(db, request.UserDetails.Email))
            User.CreateUser(db, request.UserDetails);

        Com.Mobicage.Rogerthat.FormFlowStep Step = (Com.Mobicage.Rogerthat.FormFlowStep)request.Steps[0];
        long when = ((Com.Mobicage.Rogerthat.LongWidgetResult)Step.result.widget).Value;
        Step = (Com.Mobicage.Rogerthat.FormFlowStep)request.Steps[1];
        long From = (long)((Com.Mobicage.Rogerthat.FloatListWidgetResult)Step.result.widget).Values[0];
        long Till = (long)((Com.Mobicage.Rogerthat.FloatListWidgetResult)Step.result.widget).Values[1];
        Step = (Com.Mobicage.Rogerthat.FormFlowStep)request.Steps[2];
        long capacity = (long)((Com.Mobicage.Rogerthat.FloatWidgetResult)Step.result.widget).Value;

        List<MeetingRoom> MeetingRooms = MeetingRoom.ValidRoom(db, capacity);
        bool isBooking;

        foreach (MeetingRoom MR in MeetingRooms)
        {
            isBooking = MeetingRoomBooking.IsBooking(db, MR, when, Till, From);
            if (!isBooking)
            {
                using (IDbCommand command = db.CreateCommand())
                {
                    command.CommandText = "insert into booking (day, _user, _meetingroom, [from], till) values (@Day, @User, @Meetingroom, @From, @till)";
                    IDbDataParameter p = command.CreateParameter();
                    p.ParameterName = "@Day";
                    p.Value = when;
                    command.Parameters.Add(p);
                    IDbDataParameter p2 = command.CreateParameter();
                    p2.ParameterName = "@User";
                    p2.Value = request.UserDetails.Email;
                    command.Parameters.Add(p2);
                    IDbDataParameter p3 = command.CreateParameter();
                    p3.ParameterName = "@Meetingroom";
                    p3.Value = MR.Id;
                    command.Parameters.Add(p3);
                    IDbDataParameter p4 = command.CreateParameter();
                    p4.ParameterName = "@From";
                    p4.Value = From;
                    command.Parameters.Add(p4);
                    IDbDataParameter p5 = command.CreateParameter();
                    p5.ParameterName = "@Till";
                    p5.Value = Till;
                    command.Parameters.Add(p5);
                    command.ExecuteNonQuery();
                }
                Com.Mobicage.Rogerthat.MessageCallbackResult CR = new Com.Mobicage.Rogerthat.MessageCallbackResult();
                CR.Flags = Com.Mobicage.Rogerthat.MessageFlag.ALLOW_DISMISS.Value;
                CR.Text = "Meeting room " + MR.Name + " is successfully reserved for you.";
                result.Result = CR;
                return result;
            }

        }

        Com.Mobicage.Rogerthat.MessageCallbackResult noRoomMessage = new Com.Mobicage.Rogerthat.MessageCallbackResult();
        noRoomMessage.Flags = Com.Mobicage.Rogerthat.MessageFlag.ALLOW_DISMISS.Value;
        noRoomMessage.Text = "No Room with a minimum capacity of " + capacity + " available";
        result.Result = noRoomMessage;
        return result;
    }
示例#55
0
 /// <summary>
 /// 获取拼音首字母
 /// </summary>
 /// <param name="s"></param>
 /// <returns></returns>
 public static string GetSpell(this string s)
 {
     return(Com.GetSpell(s));
 }
		public virtual void Extract(RandomAccessReader reader, Com.Drew.Metadata.Metadata metadata)
		{
			PhotoshopDirectory directory = metadata.GetOrCreateDirectory<PhotoshopDirectory>();
			int pos;
			try
			{
				pos = reader.GetString(0, 13).Equals("Photoshop 3.0") ? 14 : 0;
			}
			catch (IOException)
			{
				directory.AddError("Unable to read header");
				return;
			}
			long length;
			try
			{
				length = reader.GetLength();
			}
			catch (IOException e)
			{
				directory.AddError("Unable to read Photoshop data: " + e.Message);
				return;
			}
			while (pos < length)
			{
				try
				{
					// 4 bytes for the signature.  Should always be "8BIM".
					//String signature = new String(data, pos, 4);
					pos += 4;
					// 2 bytes for the resource identifier (tag type).
					int tagType = reader.GetUInt16(pos);
					// segment type
					pos += 2;
					// A variable number of bytes holding a pascal string (two leading bytes for length).
					int descriptionLength = reader.GetUInt16(pos);
					pos += 2;
					// Some basic bounds checking
					if (descriptionLength < 0 || descriptionLength + pos > length)
					{
						return;
					}
					//String description = new String(data, pos, descriptionLength);
					pos += descriptionLength;
					// The number of bytes is padded with a trailing zero, if needed, to make the size even.
					if (pos % 2 != 0)
					{
						pos++;
					}
					// 4 bytes for the size of the resource data that follows.
					int byteCount = reader.GetInt32(pos);
					pos += 4;
					// The resource data.
					sbyte[] tagBytes = reader.GetBytes(pos, byteCount);
					pos += byteCount;
					// The number of bytes is padded with a trailing zero, if needed, to make the size even.
					if (pos % 2 != 0)
					{
						pos++;
					}
					directory.SetByteArray(tagType, tagBytes);
					// TODO allow rebasing the reader with a new zero-point, rather than copying data here
					if (tagType == PhotoshopDirectory.TagIptc)
					{
						new IptcReader().Extract(new SequentialByteArrayReader(tagBytes), metadata, tagBytes.Length);
					}
					if (tagType >= unchecked((int)(0x0fa0)) && tagType <= unchecked((int)(0x1387)))
					{
						PhotoshopDirectory._tagNameMap.Put(tagType, Sharpen.Extensions.StringFormat("Plug-in %d Data", tagType - unchecked((int)(0x0fa0)) + 1));
					}
				}
				catch (IOException ex)
				{
					directory.AddError(ex.Message);
					return;
				}
			}
		}
示例#57
0
 public override void DoDefaultAction()
 {
     Com.Call(() => NativePattern.DoDefaultAction());
 }