Example #1
0
        private static OSLEBot GetSingleOLSEBotObject(string singleFile)
        {
            XmlSerializer xs = new XmlSerializer(typeof(OSLEBot));
            OSLEBot       ob = (OSLEBot)xs.Deserialize(new FileStream(singleFile, FileMode.Open));

            return(ob);
        }
Example #2
0
        //private static Nullable<bool> StringToBool(string result)
        //{
        //    if (result.ToLower() == "true")
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}

        private static void UploadToFastTrack(ArgumentParser p)
        {
            try
            {
                OSLEBot ob = GetOSLEBotObject(new LogAnalyser(p.OfficeDir));

                UploadOsleBotStuffToFastTrack(ob);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Something went wrong while uploading to FastTrack: {0}", ex.Message);
            }
        }
Example #3
0
        /// <summary>
        /// Where is exception handling Tiernan? It This method should report an error on failure.
        /// </summary>
        private static void uploadFastTrackSingle(ArgumentParser p)
        {
            //try
            //{

            OSLEBot ob = GetSingleOLSEBotObject(p.OfficeDir);

            UploadOsleBotStuffToFastTrack(ob);
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine("Something went wrong while uploading to FastTrack: {0}", ex.Message);
            //}
        }
Example #4
0
        private static OSLEBot GetOSLEBotObject(LogAnalyser la)
        {
            OSLEBot ob = new OSLEBot {
                start = "Now", version = "1.0"
            };
            List <OSLEBotCO> listOCos = new List <OSLEBotCO>();
            XmlSerializer    xs       = new XmlSerializer(typeof(OSLEBot));

            la.GetResults().ForEach(x =>
            {
                Console.WriteLine("LocGroup: {0} \n Project: {1} \n Language: {2} \n LogFile: {3}", x.LocGroup, x.Project, x.Language, x.LogLocation);
                OSLEBot o = (OSLEBot)xs.Deserialize(new FileStream(x.LogLocation, FileMode.Open));
                Array.ForEach(o.co, listOCos.Add);
            });

            ob.co = listOCos.ToArray();
            return(ob);
        }
Example #5
0
        private static void UploadOsleBotStuffToFastTrack(OSLEBot ob)
        {
            using (FastTrackDataContext dc = new FastTrackDataContext())
            {
                int?newRun = 0;
                dc.NewRun(Environment.UserName, ref newRun);

                Console.WriteLine("RunID : {0}", newRun);
                foreach (var coo in ob.co)
                {
                    string lsResID       = null;
                    string sourceString  = null;
                    string comments      = null;
                    string targetCulture = null;
                    string locGroup      = null;
                    string project       = null;
                    string lcxFileName   = null;

                    foreach (var prop in coo.props)
                    {
                        switch (prop.name.ToLower())
                        {
                        case "lsresid":
                            lsResID = prop.value;
                            break;

                        case "sourcestring":
                            sourceString = prop.value;
                            break;

                        case "comments":
                            comments = prop.value;
                            break;

                        case "targetculture":
                            targetCulture = prop.value;
                            break;

                        case "locgroup":
                            locGroup = prop.value;
                            break;

                        case "project":
                            project = prop.value;
                            break;

                        case "lcxfilename":
                            lcxFileName = prop.value;
                            break;

                        default:
                            Debug.WriteLine(string.Format("Not known property: {0}", prop.value));
                            break;
                        }
                    }

                    if (!String.IsNullOrEmpty(lsResID) && !String.IsNullOrEmpty(sourceString) && !String.IsNullOrEmpty(comments) && !String.IsNullOrEmpty(targetCulture) && !String.IsNullOrEmpty(locGroup) && !String.IsNullOrEmpty(project) && !String.IsNullOrEmpty(lcxFileName))
                    {
                        int?strID = 0;
                        dc.NewStrInfo(newRun.Value.ToString(),
                                      project,
                                      locGroup,
                                      lcxFileName,
                                      sourceString,
                                      comments,
                                      lsResID,
                                      targetCulture,
                                      newRun, ref strID);
                        Array.ForEach(coo.rules, rule =>
                        {
                            if (strID != 0)
                            {
                                int?strResultID = 0;
                                dc.NewStrResult(strID, rule.item[0].message, rule.item[0].result, rule.name, ref strResultID);
                            }
                        });
                    }
                }
            }
        }