Example #1
0
 public void addScroller(string text)
 {
     string file = "Scrollers.xml";
     file = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "/XMLFiles/Scrollers/" + file;
     XmlHandler xmlStuff = new XmlHandler(file, "XEle");
     xmlStuff.writeScrollerToXmlFile(text);
 }
Example #2
0
        public void createparty(string springOrFall, string fileName, string startDate,string endDate, string runTime)
        {
            XmlHandler xmlStuff = new XmlHandler(fileName,"Create");
            xmlStuff.createXmlFile(adjustStringFormatForDate(startDate,"Start"), adjustStringFormatForDate(endDate,"End") , calculateRunTime(runTime)+"");

            XmlHandler xmlStuff2 = new XmlHandler(fileName + ".xml", "Load");
            DateTime date = new DateTime();

            if ("Spring".Equals(springOrFall))
            {

                int m = int.Parse(monthNumber(startDate.Substring(0, startDate.IndexOf(" "))));
                int d = int.Parse(startDate.Substring(startDate.IndexOf(" "), startDate.Length - startDate.IndexOf(" ")));

                year--; //justering av year
                date = new DateTime(year,m,d);
                xmlStuff2.writeFeastToXmlFile("Välkommen till Turbophesten", getShortDate(date), "Text");

                date = new DateTime(year, 10, 24);
                xmlStuff2.writeFeastToXmlFile("FN-dagen", getShortDate(date), "Text");

                date = new DateTime(year, 10, 31);
                xmlStuff2.writeFeastToXmlFile("Halloween", getShortDate(date), "Effect");

                date = new DateTime(year, 12, 13);
                xmlStuff2.writeFeastToXmlFile("Lucia", getShortDate(date), "Effect");
                year++;//justering av year

                date = findFirstAdvent();

                xmlStuff2.writeFeastToXmlFile("Advent 1", getShortDate(date), "Effect");

                date = date.AddDays(7);
                xmlStuff2.writeFeastToXmlFile("Advent 2", getShortDate(date), "Effect");

                date = date.AddDays(7);
                xmlStuff2.writeFeastToXmlFile("Advent 3", getShortDate(date), "Effect");

                date = date.AddDays(7);
                xmlStuff2.writeFeastToXmlFile("Advent 4", getShortDate(date), "Effect");

                date = new DateTime(year,12,24);
                xmlStuff2.writeFeastToXmlFile("JulAfton", getShortDate(date), "Effect");

                date = date.AddDays(1);
                xmlStuff2.writeFeastToXmlFile("JulDagen", getShortDate(date), "Text");

                date = date.AddDays(2);
                xmlStuff2.writeFeastToXmlFile("Mellandagsrea", getShortDate(date), "Text");

                date = new DateTime(year, 12, 31);
                xmlStuff2.writeFeastToXmlFile("Nyårsafton", getShortDate(date), "Effect");

                date = new DateTime(year, 12, 24);
                date = date.AddDays(13);
                xmlStuff2.writeFeastToXmlFile("Trettondedag jul", getShortDate(date), "Text");

                year++;// ful justering
                date = new DateTime(year, 02, 14);
                xmlStuff2.writeFeastToXmlFile("Valentine", getShortDate(date), "Effect");

                date = semlaDate();
                xmlStuff2.writeFeastToXmlFile("Semla", getShortDate(date), "Effect");

            }

            else if ("Fall".Equals(springOrFall))
            {
                int m = int.Parse(monthNumber(startDate.Substring(0, startDate.IndexOf(" "))));
                int d = int.Parse(startDate.Substring(startDate.IndexOf(" "), startDate.Length - startDate.IndexOf(" ")));
                date = new DateTime(year, m, d);
                xmlStuff2.writeFeastToXmlFile("Välkommen till Turbophesten", getShortDate(date), "Text");

                date = new DateTime(year,3,25);
                xmlStuff2.writeFeastToXmlFile("Våffeldagen", getShortDate(date), "Effect");

                date = easterDate();// påskdagen
                date = date.AddDays(-1);//påskafton
                xmlStuff2.writeFeastToXmlFile("påsk", getShortDate(date), "Effect");

                date = new DateTime(year, 4, 30);
                xmlStuff2.writeFeastToXmlFile("Valborgsmässoafton", getShortDate(date), "Effect");

                date = new DateTime(year, 6, 6);
                xmlStuff2.writeFeastToXmlFile("Nationaldagen", getShortDate(date), "Effect");

                date = midsommarAfton();
                xmlStuff2.writeFeastToXmlFile("Midsommar", getShortDate(date), "Effect");

                date = new DateTime(year, 7, 14);
                xmlStuff2.writeFeastToXmlFile("kronprinsesans födelsedag", getShortDate(date), "Text");

                date = new DateTime(year, 8, 8);
                xmlStuff2.writeFeastToXmlFile("Kräftpremiär", getShortDate(date), "Effect");

                date = new DateTime(year, 9, 18);
                xmlStuff2.writeFeastToXmlFile("swine", getShortDate(date), "Effect");

            }
        }
Example #3
0
 public void updateParticpant(string fileName, System.Windows.Forms.DataGridViewRow row, string[] data)
 {
     //fileName = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + fileName;
     XmlHandler xmlStuff = new XmlHandler(fileName, "Delete");
     xmlStuff.updateParticipant(row, data, adjustStringFormatForDate(data[2],"Birth"));
 }
Example #4
0
 public void addparticpant(string fileName,string name, string section, string dateOfBirth, string allergy, string vegetarian, string paid)
 {
     //fileName = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + fileName;
     XmlHandler xmlStuff = new XmlHandler(fileName,"Load");
     xmlStuff.writeParticipantToXmlFile(name, section, adjustStringFormatForDate(dateOfBirth,"Birth"), allergy, vegetarian,paid);
 }
Example #5
0
 public XDocument sort(string fileName)
 {
     XmlHandler xmlStuff = new XmlHandler(fileName, "XDoc");
     return xmlStuff.sortXml();
 }
Example #6
0
 public void updateData(string fileName,string oldRunTime,string sd, string ed,string rt)
 {
     XmlHandler xmlStuff = new XmlHandler(fileName, "XDoc");
     xmlStuff.uppdateData(adjustStringFormatForDate(sd, "Start"), oldRunTime, adjustStringFormatForDate(ed, "End"), calculateRunTime(rt) + "");
 }
Example #7
0
 public string getData(string fileName)
 {
     XmlHandler xmlStuff = new XmlHandler(fileName, "XDoc");
     return xmlStuff.getDataFromXml();
 }
Example #8
0
 public IEnumerable<XElement> getParticpant(string fileName)
 {
     //fileName = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + fileName;
     XmlHandler xmlStuff = new XmlHandler(fileName, "Delete");
     return xmlStuff.getParticipant();
 }
Example #9
0
 public void delParticpant(string fileName, System.Windows.Forms.DataGridViewRow row)
 {
     //fileName = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + fileName;
     XmlHandler xmlStuff = new XmlHandler(fileName, "Delete");
     xmlStuff.deletepartcipant(row);
 }
Example #10
0
        public void createScrollers()
        {
            string fileName = "Scrollers";

            fileName = Path.Combine("Scrollers/", fileName);
            XmlHandler xmlStuff = new XmlHandler(fileName, "Create");
            xmlStuff.createScrollersXmlFile();

            fileName += ".xml";
            XmlHandler xmlStuff2 = new XmlHandler(fileName, "XEle");

            xmlStuff2.writeScrollerToXmlFile("turbophest");
            xmlStuff2.writeScrollerToXmlFile("detta är en liten text som scrollar förbi i rutan");
            xmlStuff2.writeScrollerToXmlFile("hoppas ni trivs.");
            xmlStuff2.writeScrollerToXmlFile("idag händer ingenting");
            xmlStuff2.writeScrollerToXmlFile("teknatsektionens sexmästeri");
            xmlStuff2.writeScrollerToXmlFile("hur många dagar visas turbologgan totalt?");
        }
Example #11
0
        private void btnsave_Click(object sender, EventArgs e)
        {
            eventdata ev = new eventdata(cmbEvents.Text);

            if ("Spring".Equals(FrmMain.SpringOrFall))
            {
                ev.setData("sep", checksep.Checked == true ? 1 : 0, checksep.Checked, checkVetosep.Checked, Int16.Parse(cmbPriosep.Text));
                ev.setData("okt", checkokt.Checked == true ? 1 : 0, checkokt.Checked, checkVetookt.Checked, Int16.Parse(cmbPriookt.Text));
                ev.setData("nov", checknov.Checked == true ? 1 : 0, checknov.Checked, checkVetonov.Checked, Int16.Parse(cmbPrionov.Text));
                ev.setData("dec", checkdec.Checked == true ? 1 : 0, checkdec.Checked, checkVetodec.Checked, Int16.Parse(cmbPriodec.Text));
                ev.setData("jan", checkjan.Checked == true ? 1 : 0, checkjan.Checked, checkVetojan.Checked, Int16.Parse(cmbPriojan.Text));
                ev.setData("feb", checkfeb.Checked == true ? 1 : 0, checkfeb.Checked, checkVetofeb.Checked, Int16.Parse(cmbPriofeb.Text));
                ev.setData("mar", checkmar.Checked == true ? 1 : 0, checkmar.Checked, checkVetomar.Checked, Int16.Parse(cmbPriomar.Text));
            }
            else if ("Fall".Equals(FrmMain.SpringOrFall))
            {
                ev.setData("mar", checkmar.Checked == true ? 1 : 0, checkmar.Checked, checkVetomar.Checked, Int16.Parse(cmbPriomar.Text));
                ev.setData("apr", checkapr.Checked == true ? 1 : 0, checkapr.Checked, checkVetoapr.Checked, Int16.Parse(cmbPrioapr.Text));
                ev.setData("maj", checkmaj.Checked == true ? 1 : 0, checkmaj.Checked, checkVetomaj.Checked, Int16.Parse(cmbPriomaj.Text));
                ev.setData("jun", checkjun.Checked == true ? 1 : 0, checkjun.Checked, checkVetojun.Checked, Int16.Parse(cmbPriojun.Text));
                ev.setData("jul", checkjul.Checked == true ? 1 : 0, checkjul.Checked, checkVetojul.Checked, Int16.Parse(cmbPriojul.Text));
                ev.setData("aug", checkaug.Checked == true ? 1 : 0, checkaug.Checked, checkVetoaug.Checked, Int16.Parse(cmbPrioaug.Text));
                ev.setData("sep", checksep.Checked == true ? 1 : 0, checksep.Checked, checkVetosep.Checked, Int16.Parse(cmbPriosep.Text));
            }

            int index = searchObj(objlist, cmbEvents.Text);
            if (index != -1)
                objlist.RemoveAt(index);

            objlist.Add(ev);

            objlist.Sort();
            XmlHandler xml = new XmlHandler("randomeffects" + FrmMain.SpringOrFall, "Create", "eff");
            xml.createXmlFileEffecs(objlist);
            this.Close();
        }
Example #12
0
        public FrmEvents()
        {
            InitializeComponent();
            string[] monthstlist;

            if ("Spring".Equals(FrmMain.SpringOrFall))
            {

                monthstlist = new string[] { "sep", "okt", "nov", "dec", "jan", "feb", "mar" };
            }
            else
            {
                monthstlist = new string[] { "mar", "apr", "maj", "jun", "jul", "aug", "sep" };
            }

              //  string[] eventlist = new string[] { "TS", "Hajk", "bumbi", "BB", "smurf", "creators", "sune", "dif", "fbk", "rms", "scrollers", "Q", "turbologo", "winlinux" };

            string[] eventlist = new string[] { "SuneAnimation", "Dif", "Fbk", "TurboLogo", "Datasmurf", "RMS", "WinLinux", "Scroller", "Self", "BB", "GummiBears", "Hajk", "TeknatStyle", "Matrix", "Quiz", "Talespin", "ChipDale", "Nerdy", "Sailormoon", "GhostBusters", "Zelda","Tardis","F**k","SilverFang", "MoraT" , "Ronja","Emil", "Djungelboken" ,"Fabbe","Drink","Frozen"};
            Array.Sort(eventlist);

            string path = XmlHandler.fixPath("randomeffects" + FrmMain.SpringOrFall +  ".xml","eff");
            string fileName = Path.GetFullPath(path);

            if (File.Exists(fileName))
            {
               xml = new XmlHandler("randomeffects" + FrmMain.SpringOrFall + ".xml", "XDoc", "eff");
            }
            else
            {
               xml = new XmlHandler("randomeffects" + FrmMain.SpringOrFall, "Create", "eff");
               xml.createDefoultXmlFileEffecs(eventlist, monthstlist);

               xml = new XmlHandler("randomeffects" + FrmMain.SpringOrFall + ".xml", "XDoc", "eff");

            }

            objlist = new ArrayList(xml.Loadeffectdata());

            cmbEvents.Items.AddRange(eventlist);
            cmbEvents.SelectedIndex = 0;

            if ("Spring".Equals(FrmMain.SpringOrFall))
            {

                checkapr.Enabled = false;
                checkmaj.Enabled = false;
                checkjun.Enabled = false;
                checkjul.Enabled = false;
                checkaug.Enabled = false;

                cmbPrioapr.Enabled = false;
                checkVetoapr.Enabled = false;
                cmbPriomaj.Enabled = false;
                checkVetomaj.Enabled = false;
                cmbPriojun.Enabled = false;
                checkVetojun.Enabled = false;
                cmbPriojul.Enabled = false;
                checkVetojul.Enabled = false;
                cmbPrioaug.Enabled = false;
                checkVetoaug.Enabled = false;

            }
            else if ("Fall".Equals(FrmMain.SpringOrFall))
            {

                checkjan.Enabled = false;
                checkfeb.Enabled = false;
                checkokt.Enabled = false;
                checknov.Enabled = false;
                checkdec.Enabled = false;

                cmbPriojan.Enabled = false;
                checkVetojan.Enabled = false;
                cmbPriofeb.Enabled = false;
                checkVetofeb.Enabled = false;

                cmbPriookt.Enabled = false;
                checkVetookt.Enabled = false;
                cmbPrionov.Enabled = false;
                checkVetonov.Enabled = false;
                cmbPriodec.Enabled = false;
                checkVetodec.Enabled = false;
            }

            foreach (eventdata obj in objlist)
            {
                //???
            }
        }
Example #13
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            XmlHandler xmlStuff = new XmlHandler(fileName, "XDoc");
            // TODO: make this auto create on startup?
            if (!File.Exists( XmlHandler.fixPath("randomeffects" + SpringOrFall + ".xml", "eff")) )
            {
                MessageBox.Show("Missing file, randomeffects" + SpringOrFall + ".xml! You have to create it.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return ;
            }
            if (gw != null)
            {
                gw.Dispose();
                Console.WriteLine("Starting dispose of old Gwindow.");
                gw = null;
            }

            OpenGL.CrashHandler ch = new OpenGL.CrashHandler();
            if (ch.CheckCrash() != System.Windows.Forms.DialogResult.Cancel)
            {
                gw = new OpenGL.GLWindow(xmlStuff.sortXml(), SpringOrFall, xmlStuff.getDataFromXml(), FrmAdmin.Resolution, ref ch);
                gw.Run(); // possible to start in another thread??
            }
            if (ch.Exit)
            {
                ch.Clear();
            }
            ch.Dispose();
            ch = null;
        }