Example #1
0
        private static object _GetExdField(SaintCoinach.Ex.ISheet sheet, int row, int col)
        {
            object field = null;

            try
            {
                field = sheet[(int)row][(int)col];
            }
            catch (Exception e)
            {
                try
                {
                    foreach (SaintCoinach.Ex.IRow exRow in sheet)
                    {
                        if (exRow.Key == row)
                        {
                            field = exRow.GetRaw((int)col);
                            break;
                        }
                    }
                }
                catch (Exception ee)
                {
                    System.Diagnostics.Debug.WriteLine(ee.Message);
                }
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
            return(field);
        }
Example #2
0
        public static T GetExdField <T>(SaintCoinach.Ex.ISheet sheet, int row, string colName)
        {
            var field = _GetExdField(sheet, row, colName);

            if (field is T)
            {
                return((T)field);
            }
            return(default(T));
        }
Example #3
0
        private static object _GetExdField(SaintCoinach.Ex.ISheet sheet, int row, string colName)
        {
            int col = _GetColIndexByName(sheet, colName);

            if (col == -1)
            {
                return(null);
            }

            return(_GetExdField(sheet, row, col));
        }
Example #4
0
        private static int _GetColIndexByName(SaintCoinach.Ex.ISheet sheet, string colName)
        {
            var rSheet = sheet as SaintCoinach.Ex.Relational.IRelationalSheet;

            if (rSheet != null)
            {
                foreach (var exCol in rSheet.Header.Columns)
                {
                    if (exCol.Name == colName)
                    {
                        return(exCol.Index);
                    }
                }
            }
            new ExtendedErrorView($"Unable to find column {colName} in EXD sheet {sheet.Name}", "", "FFXIVMon Reborn");
            System.Diagnostics.Debug.WriteLine($"Unable to find column {colName} in EXD sheet {sheet.Name}");
            return(-1);
        }
Example #5
0
        public static string GetExdFieldAsString(SaintCoinach.Ex.ISheet sheet, int row, int col)
        {
            var field = _GetExdField(sheet, row, col);

            if (field == null)
            {
                return(null);
            }

            if (field is IDictionary <string, object> )
            {
                // taken from SaintCoinach
                string s;
                s = ",\"";
                var isFirst = true;
                foreach (var kvp in (IDictionary <string, object>)field)
                {
                    if (isFirst)
                    {
                        isFirst = false;
                    }
                    else
                    {
                        s += ",";
                    }
                    s += string.Format("[{0},", kvp.Key);
                    if (kvp.Value != null)
                    {
                        s += (kvp.Value.ToString().Replace("\"", "\"\""));
                    }
                    s += "]";
                }
                s += "\"";
                return(s);
            }
            return(field.ToString());
        }