Beispiel #1
0
        private OrderDetail createOrderDetail(TargetDetail target)
        {
            OrderDetail result = new OrderDetail();

            result.originalName = target.title;
            result.count        = target.count;
            result.rotation     = int.Parse(target.rotate);
            string[] trimmingStart = target.trimmingStart.Split(',');
            result.trimmingLeft = int.Parse(trimmingStart[0]);
            result.trimmingTop  = int.Parse(trimmingStart[1]);
            string[] trimmingSize = target.trimmingSize.Split(',');
            result.trimmingWidth  = int.Parse(trimmingSize[0]);
            result.trimmingHeight = int.Parse(trimmingSize[1]);
            return(result);
        }
Beispiel #2
0
 private void loadOrderFile(Order order)
 {
     System.IO.StreamReader streamReader = null;
     try
     {
         TargetDetail       targetDetail = null;
         List <OrderDetail> details      = new List <OrderDetail>();
         streamReader = (new System.IO.StreamReader(order.targetOrderText, Encoding.Default));
         while (streamReader.Peek() >= 0)
         {
             string textLine = streamReader.ReadLine();
             if (textLine.StartsWith("Order No."))
             {
                 string orderNo = textLine.Remove(0, ORDER_NO_LABEL_END);
                 order.orderNo = orderNo;
             }
             else if (textLine.StartsWith("Size"))
             {
                 string size = textLine.Remove(0, SIZE_LABEL_END);
                 order.size = size;
             }
             else if (textLine.StartsWith(separator))
             {
                 if (targetDetail != null)
                 {
                     OrderDetail orderDetail = createOrderDetail(targetDetail);
                     details.Add(orderDetail);
                 }
             }
             else if (textLine.StartsWith("Photo Title"))
             {
                 targetDetail       = new TargetDetail();
                 targetDetail.title = textLine.Remove(0, TITLE_LABEL_END);
             }
             else if (textLine.StartsWith("Print Count"))
             {
                 targetDetail.count = textLine.Remove(0, COUNT_LABEL_END);
             }
             else if (textLine.StartsWith("Right rotated"))
             {
                 targetDetail.rotate = textLine.Remove(0, ROTATE_LABEL_END);
             }
             else if (textLine.StartsWith("Trimming Start Position"))
             {
                 targetDetail.trimmingStart = textLine.Remove(0, TRIMMING_START_LABEL_END);
             }
             else if (textLine.StartsWith("Trimming End Position"))
             {
                 targetDetail.trimmingEnd = textLine.Remove(0, TRIMMING_END_LABEL_END);
             }
             else if (textLine.StartsWith("Trimming Size"))
             {
                 targetDetail.trimmingSize = textLine.Remove(0, TRIMMING_SIZE_LABEL_END);
             }
             else if (textLine.StartsWith("Date Time Print"))
             {
                 targetDetail.dateTimePrint = textLine.Remove(0, DATE_TIME_PRINT_LABEL_END);
             }
             else if (textLine.StartsWith("DateTime"))
             {
                 targetDetail.dateTime = textLine.Remove(0, DATE_TIME_LABEL_END);
             }
         }
         order.details = details;
     } catch (Exception e)
     {
         writeLog("order.txtの読み込みでエラーが発生しました" + e.Message);
         throw e;
     }
     finally
     {
         streamReader.Close();
     }
 }