Пример #1
0
    internal Vector2 GetPCAxis(PCAxis pCAxis)
    {
        switch (pCAxis)
        {
        case PCAxis.WASD:
            return(pC.wasd);

        case PCAxis.Mouse:
            return(pC.mouse);
        }
        return(Vector2.zero);
    }
Пример #2
0
        private static string GetLastModified(PCAxis.Paxiom.PXMeta meta)
        {
            string date = "";
            DateTime maxDate = DateTime.MinValue;
            if (meta.ContentVariable != null)
            {
                foreach (var value in meta.ContentVariable.Values)
                {
                    if (value.ContentInfo != null)
                    {
                        if (value.ContentInfo.LastUpdated != "")
                        {
                            DateTime d = GetDate(value.ContentInfo.LastUpdated);
                            maxDate = maxDate > d ? maxDate : d;
                        }
                    }
                }
                if (meta.ContentInfo != null)
                {
                    if (meta.ContentInfo.LastUpdated != "")
                    {
                        DateTime d = GetDate(meta.ContentInfo.LastUpdated);
                        maxDate = maxDate > d ? maxDate : d;
                    }
                }
                if (maxDate != DateTime.MinValue)
                {
                    //TODO Use Date format
                    //date = maxDate.ToString();

                    // Store date in the PC-Axis date format
                    date = maxDate.ToString(PCAxis.Paxiom.PXConstant.PXDATEFORMAT);
                }
            }
            else
            {
                if (meta.ContentInfo != null)
                {
                    date = meta.ContentInfo.LastUpdated;
                }
            }

            if (string.IsNullOrEmpty(date))
            {
                //date = maxDate.ToString();
                date = "";
            }

            return date;
        }
Пример #3
0
        private static string GetNames(PCAxis.Paxiom.Variable variable)
        {
            StringBuilder names = new StringBuilder();

            if (variable.Values.Count <= 5)
            {
                // Gets the five first values of the variable in the form of
                // value 1, Value 2, value 3
                // if the varible have five or less values
                int limit = Math.Min(5, variable.Values.Count);
                for (int i = 0; i < limit; i++)
                {
                    names.Append(variable.Values[i].Value);
                    if (i < 4 && i <= (limit - 1))
                    {
                        names.Append(", ");
                    }
                }
            }
            else
            {
                // Gets the five first values of the variable in the form of
                // value 1, Value 2, value 3, value 4, ..., value N
                // if the varible have more than five values
                for (int i = 0; i < 4; i++)
                {
                    names.Append(variable.Values[i].Value);
                    if (i < 5 || i == variable.Values.Count)
                    {
                        names.Append(", ");
                    }

                }
                names.Append("..., ");
                names.Append(variable.Values[variable.Values.Count - 1].Value);
            }

            return names.ToString();
        }
Пример #4
0
        private TableLink CreateTableLink(PCAxis.Paxiom.PXMeta meta, string path)
        {

            ItemSelection cid = new ItemSelection(System.IO.Path.GetDirectoryName(path.Substring(_rootPath.Length)), path.Substring(_rootPath.Length));

            TableLink tbl = new TableLink(!string.IsNullOrEmpty(meta.Description) ? meta.Description : meta.Title, meta.Matrix, _sortOrder(meta, path), cid.Menu, cid.Selection, meta.Description ?? "", LinkType.PX, TableStatus.AccessibleToAll, null, "", "", meta.TableID ?? "", PresCategory.Official);

            int cellCount = 1;
            for (int i = 0; i < meta.Variables.Count; i++)
            {
                tbl.SetAttribute("Var" + (i + 1) + "Name", meta.Variables[i].Name);
                tbl.SetAttribute("Var" + (i + 1) + "Values", GetNames(meta.Variables[i]));
                tbl.SetAttribute("Var" + (i + 1) + "NumberOfValues", meta.Variables[i].Values.Count.ToString());
                cellCount *= meta.Variables[i].Values.Count;
            }

            System.IO.FileInfo info = new System.IO.FileInfo(path);
            tbl.SetAttribute("size", info.Length);
            tbl.SetAttribute("cells", cellCount.ToString());

            if (meta.AutoOpen)
            {
                tbl.SetAttribute("autoOpen", "true");
            }
            //TODO Use Data format
            //tbl.SetAttribute("updated", info.LastWriteTime.ToString());

            // Store dates in the PC-Axis date format
            tbl.SetAttribute("updated", info.LastWriteTime.ToString(PCAxis.Paxiom.PXConstant.PXDATEFORMAT));
            tbl.SetAttribute("modified", GetLastModified(meta));

            string lastUpdated = GetLastModified(meta);
            if (PxDate.IsPxDate(lastUpdated))
            {
                tbl.LastUpdated = PxDate.PxDateStringToDateTime(lastUpdated);
            }
            tbl.Published = info.LastWriteTime;

            return tbl;
        }