Example #1
0
        public static void theNewAndFunBurn(
			ArrayList alFiles,
			string strType,
			string strLabel )
        {
            string strInstructionFile = Global.GetTempFileName();
            string strLogFile = Global.GetTempFileName();

            vdUsr.vdSimpleXMLWriter x = new vdUsr.vdSimpleXMLWriter();
            x.descend( "PLATAXHG" );

            x.descend( "INFO" );
            x.writeValue( "school", Global.Skola.HomePath );
            x.writeValue( "type", strType );
            x.writeValue( "label", strLabel + "_{0}_{1}" );
            x.writeValue( "returnapp", Application.ExecutablePath );
            x.writeValue( "returnarg", string.Format( "\"plataxhg={0}\"", strInstructionFile ) );
            x.writeValue( "resultfile", strLogFile );
            x.writeValue( "windowcaption", string.Empty );
            x.writeValue( "recordcontentsfile", Path.Combine(Global.MainPath,"_burnhistory") );
            x.ascend();

            x.descend( "FILES" );
            foreach ( BurnFileInfo bfi in alFiles )
            {
                FileInfo fi = new FileInfo( bfi.LocalFullFileName );
                long lSize = (fi.Length+1023)/1024;
                if ( (fi.Attributes&FileAttributes.ReadOnly)!=0 )
                    File.SetAttributes(bfi.LocalFullFileName, fi.Attributes&~FileAttributes.ReadOnly );
                x.descend( "FILE" );
                x.writeValue( "local", bfi.LocalFullFileName );
                x.writeValue( "oncd", bfi.CDFullFileName );
                x.writeValue( "size", lSize.ToString() );
                if ( bfi.IsTemp )
                    x.writeValue( "tmp", "1" );
                if ( bfi.OnAll )
                    x.writeValue( "onall", "1" );
                x.ascend();
            }
            x.ascend();

            x.ascend();
            x.endSaveFile( strInstructionFile );

            System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
            info.FileName = Path.Combine( Path.GetDirectoryName(Application.ExecutablePath), "vdStandAloneBurn.exe" );
            info.Arguments = strInstructionFile;
            System.Diagnostics.Process process = System.Diagnostics.Process.Start( info );
            frmMain.theOneForm.endApp( false );
        }
Example #2
0
        public static void theNewAndFunBurn(
			Form parent,
			List<BurnFileInfo> alFiles,
			string strType,
			string strLabel )
        {
            if ( !Global.Fotografdator )
                if ( FAskAboutSaveCDToFolder.showDialog(
                        parent,
                        string.Format( strLabel, 1, 1 ),
                        alFiles ) != DialogResult.OK )
                    return;

            string strInstructionFile = Global.GetTempFileName();
            string strLogFile = Global.GetTempFileName();

            var x = new vdUsr.vdSimpleXMLWriter();
            x.descend( "PLATAXHG" );

            x.descend( "INFO" );
            x.writeValue( "school", Global.Skola.HomePath );
            x.writeValue( "type", strType );
            x.writeValue( "label", strLabel + "_{0}_{1}" );
            x.writeValue( "returnapp", System.Reflection.Assembly.GetExecutingAssembly().Location );
            x.writeValue( "returnarg", string.Format( "\"plataxhg={0}\"", strInstructionFile ) );
            x.writeValue( "resultfile", strLogFile );
            x.writeValue( "windowcaption", string.Empty );
            x.writeValue( "recordcontentsfile", Path.Combine( Global.Preferences.MainPath, "_burnhistory" ) );
            x.ascend();

            var checkDuplicates = new Dictionary<string, string>();
            x.descend( "FILES" );
            foreach ( var bfi in alFiles )
            {
                if ( checkDuplicates.ContainsKey( bfi.LocalFullFileName ) )
                    continue;
                checkDuplicates.Add( bfi.LocalFullFileName, bfi.LocalFullFileName );

                var fi = new FileInfo( bfi.LocalFullFileName );
                var lSize = (fi.Length + 1023) / 1024;
                if ( (fi.Attributes & FileAttributes.ReadOnly) != 0 )
                    File.SetAttributes( bfi.LocalFullFileName, fi.Attributes & ~FileAttributes.ReadOnly );
                x.descend( "FILE" );
                x.writeValue( "local", bfi.LocalFullFileName );
                x.writeValue( "oncd", bfi.CDFullFileName );
                x.writeValue( "size", (int)lSize );
                if ( bfi.IsTemp )
                    x.writeValue( "tmp", "1" );
                if ( bfi.OnAll )
                    x.writeValue( "onall", "1" );
                x.ascend();
            }
            x.ascend();

            x.ascend();
            x.endSaveFile( strInstructionFile );

            var info = new System.Diagnostics.ProcessStartInfo();
            info.FileName = Global.getAppPath( "vdStandAloneBurn.exe" );
            info.Arguments = strInstructionFile;
            var process = System.Diagnostics.Process.Start( info );
            FMain.theOneForm.endApp( false );
        }
Example #3
0
        private static string createXMLFile( PlataDM.Skola sk )
        {
            var sx = new vdUsr.vdSimpleXMLWriter();

            sx.descend("ORDER");
            sx.writeValue("namn", sk.Namn);
            sx.writeValue("ort", sk.Ort);
            sx.writeValue("ordernr", sk.OrderNr);
            sx.writeValue("skapad", vdUsr.DateHelper.YYYYMMDD(Global.Now));
            sx.writeValue( "companyorder", ((int)sk.CompanyOrder).ToString() );
            sx.writeValue("typeoforder", (int)sk.TypeOfOrder);
            sx.writeValue("restp", (int)sk.RestfotoPorträtt);
            sx.writeValue("restg", (int)sk.RestfotoGrupp);

            sx.writeValue("skaha_photoarkiv", sk.ShallBurnPhotoCD);
            if (sk.ShallBurnProgCD)
            {
                sx.writeValue("skaha_progarkiv", true);
                sx.writeValue("progcd_format", (int)sk.CustomProgFormat);
                sx.writeValue("progcd_width", sk.CustomProgWidth);
                sx.writeValue("progcd_height", sk.CustomProgHeight);
                sx.writeValue("progcd_name", sk.CustomProgNaming);
            }

            foreach (PlataDM.Grupp grupp in sk.Grupper)
            {
                sx.descend("GRUPP");
                sx.writeValue("namn", grupp.Namn);
                sx.writeValue("packorder", grupp.PackOrder);
                sx.writeValue("grupptyp", (int)grupp.GruppTyp);
                sx.writeValue("guid", grupp.Id);
                foreach (PlataDM.Person pers in grupp.AllaPersoner)
                {
                    sx.descend("PERSON");
                    for (int i = 0; i < PersonInfo.XMLTags.Length; i++)
                    {
                        string s = pers.getInfo( (PersonInfo.Info)i );
                        if (!string.IsNullOrEmpty(s))
                            sx.writeValue( PersonInfo.XMLTags[i], s );
                    }
                    sx.writeValue( "filmnummer", pers.ScanCode, "" );
                    sx.writeValue( "kon", pers.Kön );
                    sx.writeValue( "id", pers.ID );
                    sx.ascend();
                }
                sx.ascend();
            }

            sx.ascend();

            return sx.endSaveXML();
        }