Exemplo n.º 1
0
        }         // proc Dispose

        protected override void OnBeginReadConfiguration(IDEConfigLoading config)
        {
            base.OnBeginReadConfiguration(config);

            // Lade die Scripte
            var i                   = 0;
            var scriptRemove        = (from s in scripts where s is LuaFileScript select(LuaFileScript) s).ToArray();
            var luaScriptDefinition = Server.Configuration[xnLuaScript];

            foreach (var cur in config.ConfigNew.Elements(xnLuaScript))
            {
                try
                {
                    var configNode = new XConfigNode(luaScriptDefinition, cur);
                    LoadScript(configNode, scriptRemove);
                }
                catch (Exception e)
                {
                    Log.LogMsg(LogMsgType.Error, String.Format("script[{0}]: {1}", i, e.GetMessageString()));
                }
                i++;
            }

            // Lösche die Scripte
            for (i = 0; i < scriptRemove.Length; i++)
            {
                if (scriptRemove[i] != null)
                {
                    try { scriptRemove[i].Dispose(); }
                    catch (Exception e) { Log.LogMsg(LogMsgType.Error, e.Message); }
                }
            }
        }         // proc OnBeginReadConfiguration
Exemplo n.º 2
0
		} // func TryGetStyleNode

		private static GeometryInfo CreateGeometryInfo(XConfigNode x)
		{
			return new GeometryInfo(
				x.GetAttribute<string>("name"),
				x.GetAttribute<string>("path"),
				x.GetAttribute<string>("rect")
			);
		} // func CreateGeometryInfo
Exemplo n.º 3
0
        }         // proc

        private void LoadScript(XConfigNode cur, LuaFileScript[] scriptRemove)
        {
            // Id des Scripts
            var scriptId = cur.GetAttribute <string>("id");

            if (String.IsNullOrEmpty(scriptId))
            {
                throw new ArgumentNullException("@id", "ScriptId is expected.");
            }

            // Lese den Dateinamen
            string sFileName = cur.GetAttribute <string>("filename");

            if (String.IsNullOrEmpty(sFileName))
            {
                throw new ArgumentNullException("@filename", "Dateiname nicht gefunden.");
            }

            // Lese die Parameter der Scriptdatei
            var forceDebugMode = cur.GetAttribute <bool>("debug");
            var encoding       = cur.GetAttribute <Encoding>("encoding");

            LuaScript     script     = FindScript(scriptId);
            LuaFileScript fileScript = script as LuaFileScript;

            if (fileScript == null)             // script noch nicht vorhanden --> also legen wir es mal an
            {
                if (script != null)
                {
                    throw new ArgumentException(String.Format("Script '{0}' schon vorhanden.", scriptId));
                }
                FileInfo fi = new FileInfo(sFileName);
                if (!fi.Exists)
                {
                    throw new ArgumentException(String.Format("Datei '{0}' nicht gefunden.", fi.FullName));
                }

                new LuaFileScript(this, scriptId, fi, encoding, forceDebugMode);
            }
            else
            {
                fileScript.Encoding = encoding;
                fileScript.SetDebugMode(forceDebugMode);

                scriptRemove[Array.IndexOf(scriptRemove, fileScript)] = null;

                fileScript.Log.Info("Refreshed.");
            }
        }         // LoadScript
Exemplo n.º 4
0
        }         // OnBeginReadConfiguration

        /// <summary></summary>
        /// <param name="config"></param>
        protected override void OnEndReadConfiguration(IDEConfigLoading config)
        {
            base.OnEndReadConfiguration(config);

            // read the attributes
            var x = XConfigNode.Create(Server.Configuration, config.ConfigNew);

            destinationId = x.GetAttribute <string>("destination").ToUpper();
            priority      = x.GetAttribute <int>("priority");

            fileNameFilter = x.GetAttribute <string[]>("inFilter");

            // set directories
            directoryIn  = x.GetAttribute <DirectoryInfo>("in");
            directoryOut = x.GetAttribute <DirectoryInfo>("out");
        }         // proc OnEndReadConfiguration
Exemplo n.º 5
0
        }         // OnBeginReadConfiguration

        /// <summary></summary>
        /// <param name="config"></param>
        protected override void OnEndReadConfiguration(IDEConfigLoading config)
        {
            base.OnEndReadConfiguration(config);

            // read the attributes
            var x = XConfigNode.Create(Server.Configuration, config.ConfigNew);

            this.destinationId = x.GetAttribute <string>("destination").ToUpper();
            this.priority      = x.GetAttribute <int>("priority");

            this.fileNameFilter = x.GetAttribute <string>("inFilter").Split(new char[] { ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);

            // set directories
            this.directoryIn  = x.GetAttribute <DirectoryInfo>("in");
            this.directoryOut = x.GetAttribute <DirectoryInfo>("out");
        }         // proc OnEndReadConfiguration
Exemplo n.º 6
0
        }         // func GetFullName

        /// <summary></summary>
        /// <param name="config"></param>
        protected override void OnBeginReadConfiguration(IDEConfigLoading config)
        {
            base.OnBeginReadConfiguration(config);

            if (config.ConfigOld == null)             // LogDatei darf nur einmal initialisiert werden
            {
                if (String.IsNullOrEmpty(Server.LogPath))
                {
                    throw new ArgumentNullException("logPath", "LogPath muss gesetzt sein.");
                }

                // Lege die Logdatei an
                logFile             = new DELogFile(LogFileName);
                logFile.LinesAdded += (sender, e) => OnLinesAdded();

                ConfigLogItemCount++;
            }

            // Lese die Parameter für die Logdatei
            var log = XConfigNode.Create(Server.Configuration, config.ConfigNew).Element(DEConfigurationConstants.xnLog);

            SetLogSize((uint)log.GetAttribute <FileSize>("min").Value, (uint)log.GetAttribute <FileSize>("max").Value);
        }         // proc OnBeginReadConfiguration
Exemplo n.º 7
0
        }         // class PpsReportSession

        #endregion

        private void BeginReadConfigurationReport(IDEConfigLoading config)
        {
            var currentNode = XConfigNode.Create(Server.Configuration, config.ConfigNew).Element(PpsStuff.xnReports);

            var systemPath = currentNode.GetAttribute <string>("system") ?? throw new DEConfigurationException(currentNode.Data, "@system is empty.");
            var basePath   = currentNode.GetAttribute <string>("base") ?? throw new DEConfigurationException(currentNode.Data, "@base is empty.");
            var logPath    = currentNode.GetAttribute <string>("logs");
            var workPath   = currentNode.GetAttribute <string>("work");

            // check for recreate the reporting engine
            if (reporting == null ||
                !ProcsDE.IsPathEqual(reporting.EnginePath, systemPath) ||
                !ProcsDE.IsPathEqual(reporting.BasePath, basePath) ||
                (logPath != null && !ProcsDE.IsPathEqual(reporting.LogPath, logPath)) ||
                (workPath != null && !ProcsDE.IsPathEqual(reporting.WorkingPath, workPath)))
            {
                reporting = new PpsReportEngine(systemPath, basePath, reportProvider, CreateReportSession, reportWorkingPath: workPath, reportLogPath: logPath);
            }

            // update values
            reporting.CleanBaseDirectoryAfter = currentNode.GetAttribute <int>("cleanBaseDirectory");
            reporting.ZipLogFiles             = currentNode.GetAttribute <bool>("zipLogFiles");
            reporting.StoreSuccessLogs        = currentNode.GetAttribute <bool>("storeSuccessLogs");
        }         // proc BeginReadConfigurationReport
Exemplo n.º 8
0
		} // enum ImageOuput

		#endregion

		#region -- Core geometry ------------------------------------------------------

		private bool TryGetStyleNode(out XConfigNode styles)
		{
			styles = ConfigNode.Element(PpsStuff.xnStyle, false);
			return styles != null;
		} // func TryGetStyleNode
Exemplo n.º 9
0
		} // OnBeginReadConfiguration

		protected override void OnEndReadConfiguration(IDEConfigLoading config)
		{
			base.OnEndReadConfiguration(config);

			// read the attributes
			var x = new XConfigNode(Server.Configuration[config.ConfigNew.Name], config.ConfigNew);

			this.destinationId = x.GetAttribute<string>("destination").ToUpper();
			this.priority = x.GetAttribute<int>("priority");

			this.fileNameFilter = x.GetAttribute<string>("inFilter").Split(new char[] { ' ', ';' }, StringSplitOptions.RemoveEmptyEntries);

			// set directories
			this.directoryIn = x.GetAttribute<DirectoryInfo>("in");
			this.directoryOut = x.GetAttribute<DirectoryInfo>("out");
		} // proc OnEndReadConfiguration