Пример #1
0
        public string exportArray(FlatBase.GJDB database, FlatBase.ArrayStructure AS)
        {
            string toreturn = "";

            foreach (ObjectStructure o in AS.REFS)
            {
                if (o.FIELDS.Count == 1)
                {
                    if (o.FIELDS[0] is int)
                    {
                        toreturn += o.FIELDS[0].ToString() + ",";
                    }
                    else if (o.FIELDS[0] is OReference)
                    {
                        toreturn += "{" + saveReference(database, (o.FIELDS[0] as OReference)) + "},";
                    }
                    else if (o.FIELDS[0] is FlatBase.Misc.TupleStructure)
                    {
                        toreturn += o.FIELDS[0].ToString() + ",";
                    }
                    else
                    {
                        toreturn += "\"" + o.FIELDS[0].ToString() + "\",";
                    }
                }
            }

            return(toreturn);
        }
Пример #2
0
        public void loadDatabase(string fileName)
        {
            string file     = File.ReadAllText(fileName);
            GJDB   tempList =
                (GJDB)JsonConvert.DeserializeObject(file, new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            });

            database.data.Clear();
            foreach (ObservableCollection <ObjectStructure> oc in tempList.data)
            {
                database.addDB();
                foreach (object o in oc)
                {
                    database.data.Last().Add((ObjectStructure)o);
                }
            }

            database.trelloIntegration = tempList.trelloIntegration;
            if (database.trelloIntegration != null)
            {
                database.trelloIntegration.refreshData();
            }

            Alerts.MessageQueue = new SnackbarMessageQueue();
            Alerts.MessageQueue?.Enqueue("Project loaded.", null, null, null, false, true, TimeSpan.FromSeconds(2));
            Alerts.IsActive = true;
        }
Пример #3
0
        public MainWindow()
        {
            loadPlugins();
            string[] args = Environment.GetCommandLineArgs();



            if (args.Count() == 1)
            {
                Misc.SplashScreen ss = new Misc.SplashScreen(this);
                ss.Show();

                controlledWindows.Add(ss);
            }
            else
            {
                database = new GJDB();
                database.trelloIntegration = new Assistant.TrelloAssistant();
            }
        }
Пример #4
0
        public string exportDatabase(FlatBase.GJDB database)
        {
            string json = "{\n";
            int    i    = 0;

            foreach (ObservableCollection <ObjectStructure> collection in database.data)
            {
                string catName = database.tabNames[i];
                json += "\"" + catName + "\" : [\n";

                int c = 0;
                foreach (ObjectStructure os in collection)
                {
                    if (os.excludeExport)
                    {
                        continue;
                    }
                    json += exportObjectStructure(database, os, catName, c);
                    c++;

                    if (c < collection.Count)
                    {
                        json += ",";
                    }
                }


                json += "]";

                i++;
                if (i < database.tabNames.Count)
                {
                    json += ",";
                }
            }

            json += "}";

            return(json);
        }
Пример #5
0
        public string exportObjectStructure(FlatBase.GJDB database, FlatBase.ObjectStructure os, string catName, int id)
        {
            string json = "{";

            json += "\"$id\" : \"" + catName + id.ToString() + "\",";
            int c = 0;

            foreach (object o in os.FIELDS)
            {
                if (o is ObjectHeader)
                {
                    c++;
                    continue;
                }

                string safeName = os.fieldexportnames[c].Split('>')[0];
                json += "\"" + safeName + "\":";

                if (!(o is int) && !(o is ArrayStructure))
                {
                    json += "\"";
                }

                if (o is OReference)
                {
                    json += (o as OReference).REF;
                }
                else if (o is ArrayStructure)
                {
                    json += "[";
                    ArrayStructure AS = o as ArrayStructure;
                    //json += AS.save(database);
                    json += exportArray(database, AS);

                    /*foreach (ObjectStructure aos in AS.REFS)
                     * {
                     *  //json += aos.save() + ",";
                     * }*/
                    json += "]";
                }
                else
                {
                    json += o.ToString();
                }
                if (!(o is int) && !(o is ArrayStructure))
                {
                    json += "\"";
                }

                c++;

                if (c < os.FIELDS.Count)
                {
                    json += ",";
                }
            }

            json += "}";

            Console.WriteLine(c.ToString() + " fields exported");

            return(json);
        }
Пример #6
0
 public string saveReference(FlatBase.GJDB database, FlatBase.OReference oref)
 {
     return("\"$ref\" : \"" + database.tabNames[oref.refDB] + oref.REF.ToString() + "\",");
 }
Пример #7
0
 public void newDB()
 {
     database = new GJDB();
 }