コード例 #1
0
 private static int loadJob(string dir, string code, DateTime dateTime, out AbstractJobConfig config)
 {
     string str;
     config = null;
     int num = dirCheck(dir, code, out str);
     if (num == 0)
     {
         XmlDocument doc = new XmlDocument();
         try
         {
             XmlNode node;
             doc.Load(str);
             XmlAttribute attribute = doc.DocumentElement.Attributes["style"];
             if (((attribute == null) || (attribute.Value == "")) || (attribute.Value == "normal"))
             {
                 NormalConfig config2 = new NormalConfig();
                 num = config2.setDocument(doc);
                 if (num == 0)
                 {
                     config2.setDirectories(dir, GymErrPath, GuidePath);
                     num = config2.selectRecord(dateTime, out node);
                 }
                 config = config2;
                 return num;
             }
             if (attribute.Value == "combi")
             {
                 CombiConfig config3 = new CombiConfig();
                 num = config3.setDocument(doc);
                 if (num == 0)
                 {
                     config3.setDirectories(dir, GymErrPath, GuidePath);
                     for (int i = 0; i < config3.count; i++)
                     {
                         AbstractJobConfig config4;
                         num = createJobConfig(config3.configs[i].code, dateTime, out config4);
                         config3.configs[i].config = config4 as NormalConfig;
                     }
                 }
                 config = config3;
                 return num;
             }
             if (attribute.Value == "divide")
             {
                 DivideConfig config5 = new DivideConfig();
                 num = config5.setDocument(doc);
                 if (num == 0)
                 {
                     config5.setDirectories(dir, GymErrPath, GuidePath);
                     num = config5.selectRecord(dateTime, out node);
                 }
                 config = config5;
                 return num;
             }
             return -6;
         }
         catch (XmlException exception)
         {
             lastError = exception.Message + "\t" + exception.StackTrace;
             return -4;
         }
         catch (Exception exception2)
         {
             lastError = exception2.Message + "\t" + exception2.StackTrace;
             return -99;
         }
     }
     return num;
 }
コード例 #2
0
        public static int createJobConfig(string outcode, out AbstractJobConfig config)
        {
            int num;
            string str4;
            XmlDocument document2;
            config = null;
            string code = outcode.Substring(0, 6);
            if (!int.TryParse(outcode.Substring(6), out num))
            {
                return -10;
            }
            string dir = TemplatePath + @"recv\" + code + @"\";
            int num2 = dirCheck(dir, code, out str4);
            if (num2 != 0)
            {
                code = code.Substring(0, 4);
                dir = TemplatePath + @"recv\" + code + @"\";
                int num3 = dirCheck(dir, code, out str4);
                switch (num3)
                {
                    case 0:
                        goto Label_015D;

                    case -1:
                        return num2;
                }
                return num3;
            }
            XmlDocument document = new XmlDocument();
            try
            {
                document.Load(str4);
                XmlAttribute attribute = document.DocumentElement.Attributes["erase"];
                if ((attribute != null) && (attribute.Value.ToUpper() == "TRUE"))
                {
                    code = code.Substring(0, 4);
                    dir = TemplatePath + @"recv\" + code + @"\";
                    int num4 = dirCheck(dir, code, out str4);
                    switch (num4)
                    {
                        case 0:
                            goto Label_015D;

                        case -1:
                            return -8;
                    }
                    return num4;
                }
            }
            catch (XmlException exception)
            {
                lastError = exception.Message + "\t" + exception.StackTrace;
                return -4;
            }
            catch (Exception exception2)
            {
                lastError = exception2.Message + "\t" + exception2.StackTrace;
                return -99;
            }
        Label_015D:
            document2 = new XmlDocument();
            try
            {
                XmlNode node;
                document2.Load(str4);
                XmlAttribute attribute2 = document2.DocumentElement.Attributes["style"];
                if ((attribute2 == null) || (attribute2.Value == "normal"))
                {
                    NormalConfig config2 = new NormalConfig();
                    num2 = config2.setDocument(document2);
                    if (num2 == 0)
                    {
                        config2.setDirectories(dir, GymErrPath, GuidePath);
                        num2 = config2.selectRecord(num, out node);
                    }
                    config = config2;
                    return num2;
                }
                if ((attribute2.Value == "combi") || (attribute2.Value == "combination"))
                {
                    CombiConfig config3 = new CombiConfig();
                    num2 = config3.setDocument(document2);
                    if (num2 == 0)
                    {
                        config3.setDirectories(dir, GymErrPath, GuidePath);
                    }
                    config = config3;
                    return num2;
                }
                if (attribute2.Value == "divide")
                {
                    DivideConfig config4 = new DivideConfig();
                    num2 = config4.setDocument(document2);
                    if (num2 == 0)
                    {
                        config4.setDirectories(dir, GymErrPath, GuidePath);
                        num2 = config4.selectRecord(num, out node);
                    }
                    config = config4;
                    return num2;
                }
                return -6;
            }
            catch (XmlException exception3)
            {
                lastError = exception3.Message + "\t" + exception3.StackTrace;
                return -4;
            }
            catch (Exception exception4)
            {
                lastError = exception4.Message + "\t" + exception4.StackTrace;
                return -99;
            }
            return num2;
        }