log4net.ILog.Error(object)

Here are the examples of the csharp api log4net.ILog.Error(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

517 Examples 7

19 Source : NailsMap.cs
with MIT License
from 1upD

public NailsCube GetCube(int x, int y, int z)
        {
            // Return value
            NailsCube cube = null;
            
            // Use Linq to query the list
            var cubesList = NailsCubes.Where(i => i.X == x && i.Y == y && i.Z == z).ToList();

            // If there is a cube at this location, return it
            if (cubesList != null && cubesList.Count > 0)
            {
                cube = cubesList[0];
            }

            // If more than one cube is found, log an error
            if (cubesList.Count > 1)
            {
                log.Error(string.Format("NailsCube.GetCube(): Multiple cubes found at one location: x {0} y {1} z {2}", x.ToString(), y.ToString(), z.ToString()));
            }

            // If there is no cube at this location, return null
            return cube;
        }

19 Source : AppConfig.cs
with Apache License 2.0
from 214175590

public void LoadConfig()
        {
            // 初始化主配置            
            try
            {
                MainConfig config = null;
                if (File.Exists(MainForm.CONF_DIR + MC_NAME))
                {
                    string mconfig = YSTools.YSFile.readFileToString(MainForm.CONF_DIR + MC_NAME, false, CONFIG_KEY);
                    if (!string.IsNullOrWhiteSpace(mconfig))
                    {
                        config = JsonConvert.DeserializeObject<MainConfig>(mconfig);
                        if(null != config){
                            MConfig = config;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("加载Main配置文件异常:" + ex.Message);
                logger.Error("--->" + MC_NAME);
            }

            // 初始化session配置
            SessionConfigDict = new Dictionary<string, SessionConfig>();

            DirectoryInfo direct = new DirectoryInfo(MainForm.SESSION_DIR);
            if (direct.Exists)
            {
                FileInfo[] files = direct.GetFiles();
                string content = null;
                SessionConfig sessionConfig = null;
                foreach(FileInfo file in files){
                    try
                    {
                        if (file.Name.EndsWith(".json"))
                        {
                            content = YSTools.YSFile.readFileToString(file.FullName, false, CONFIG_KEY);
                            if (!string.IsNullOrWhiteSpace(content))
                            {
                                sessionConfig = JsonConvert.DeserializeObject<SessionConfig>(content);
                                if (null != sessionConfig)
                                {
                                    SessionConfigDict.Add(sessionConfig.SessionId, sessionConfig);
                                }
                            }                            
                        }
                    }catch(Exception ex){
                        logger.Error("加载Session配置文件异常:" + ex.Message);
                        logger.Error("--->" + file.Name);
                    }                    
                }
            }

        }

19 Source : AppConfig.cs
with Apache License 2.0
from 214175590

public void SaveConfig(int type = 0)
        {
            if(type == 0 || type == 1){
                try
                {
                    string mconfig = JsonConvert.SerializeObject(MConfig, Formatting.Indented);
                    if (!string.IsNullOrWhiteSpace(mconfig))
                    {
                        YSTools.YSFile.writeFileByString(MainForm.CONF_DIR + MC_NAME, mconfig, false, CONFIG_KEY);
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("保存Main配置文件异常:" + ex.Message);
                    logger.Error("--->" + MC_NAME);
                }
            }

            if (type == 0 || type == 2)
            {
                string sconfig = null, scname = null;
                int index = 0;
                List<string> newFiles = new List<string>();
                foreach (KeyValuePair<string, SessionConfig> item in SessionConfigDict)
                {
                    try
                    {
                        sconfig = JsonConvert.SerializeObject(item.Value, Formatting.Indented);
                        if (!string.IsNullOrWhiteSpace(sconfig))
                        {
                            scname = string.Format("session{0}.json", index);
                            YSTools.YSFile.writeFileByString(MainForm.SESSION_DIR + scname, sconfig, false, CONFIG_KEY);
                            newFiles.Add(scname);
                            index++;
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error("保存Session配置文件异常:" + ex.Message);
                        logger.Error("--->" + item.Key);
                    }
                }

                DirectoryInfo dirs = new DirectoryInfo(MainForm.SESSION_DIR);
                FileInfo[] files = dirs.GetFiles();
                foreach(FileInfo file in files){
                    if (!newFiles.Contains(file.Name))
                    {
                        file.Delete();
                    }
                }
            }
            
        }

19 Source : MainWindow.xaml.cs
with GNU General Public License v3.0
from 1RedOne

private void RegisterClient(int thisIndex)
        {
            GetWait();
            string ThisFilePath = System.IO.Directory.GetCurrentDirectory();
            Device ThisClient = Devices[thisIndex];
            log.Info($"[{ThisClient.Name}] - Beginning to process");
            //Update UI
            FireProgress(thisIndex, "CreatingCert...", 15);
            log.Info($"[{ThisClient.Name}] - About to generate cert at {ThisFilePath}...");
            X509Certificate2 newCert = FauxDeployCMAgent.CreateSelfSignedCertificate(ThisClient.Name);
            string myPath = ExportCert(newCert, ThisClient.Name, ThisFilePath);
            log.Info($"[{ThisClient.Name}] - Cert generated at {myPath}!");
            //Update UI
            FireProgress(thisIndex, "CertCreated!", 25);
            System.Threading.Thread.Sleep(1500);
            FireProgress(thisIndex, "Registering Client...", 30);
            SmsClientId clientId;
            log.Info($"[{ThisClient.Name}] - About to register with CM...");
            try
            {
                clientId = FauxDeployCMAgent.RegisterClient(CmServer, ThisClient.Name, DomainName, myPath, Preplacedword, log);
            }
            catch (Exception e)
            {
                log.Error($"[{ThisClient.Name}] - Failed to register with {e.Message}...");
                if (noisy)
                {
                    System.Windows.MessageBox.Show(" We failed with " + e.Message);
                    throw;
                }
                FireProgress(thisIndex, "ManagementPointErrorResponse...", 100);
                return;
            }
            //SmsClientId clientId = FauxDeployCMAgent.RegisterClient(CmServer, ThisClient.Name, DomainName, myPath, Preplacedword);

            FireProgress(thisIndex, "Starting Inventory...", 50);
            FauxDeployCMAgent.SendDiscovery(CmServer, ThisClient.Name, DomainName, SiteCode, myPath, Preplacedword, clientId, log, InventoryIsChecked);

            FireProgress(thisIndex, "RequestingPolicy", 75);
            //FauxDeployCMAgent.GetPolicy(CMServer, SiteCode, myPath, Preplacedword, clientId);

            FireProgress(thisIndex, "SendingCustom", 85);
            FauxDeployCMAgent.SendCustomDiscovery(CmServer, ThisClient.Name, SiteCode, ThisFilePath, CustomClientRecords);

            FireProgress(thisIndex, "Complete", 100);
        }

19 Source : Program.cs
with MIT License
from 1upD

private static object HandleParseError(object errs)
        {
            log.Error(string.Format("Parsing error: {0}", errs.ToString()));
            return null;
        }

19 Source : HttpUtil.cs
with Apache License 2.0
from 214175590

private void HandException(Exception ex, StateObject state)
        {
            string message = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " : " + state.ResponseInfo.RequestInfo.Url + " : " + ex.Message;
            if (state.Action != null)
            {
                state.Action(state.ResponseInfo);
            }
            logger.Error(message);
        }

19 Source : SftpForm.cs
with Apache License 2.0
from 214175590

private void RunLocalToRemote() {
            getTransferItem("L2R", (item) => {
                if (item != null)
                {
                    transfering = true;
                    try
                    {
                        if (RemoteExist(item.RemotePath, item.Name))
                        {
                            this.BeginInvoke((MethodInvoker)delegate()
                            {
                                DialogResult dr = MessageBox.Show(this, item.RemotePath + "已存在,是否覆盖?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                                if (dr == System.Windows.Forms.DialogResult.Yes)
                                {
                                    WriteLog("L2R", item.Id, item.LocalPath, item.RemotePath);
                                    SftpProgressMonitor monitor = rightForm.TransfersToRemote(item.Id, item.LocalPath, item.RemotePath, ChannelSftp.OVERWRITE, new ProgressDelegate(TransfersFileProgress), new TransfersEndDelegate(TransfersFileEnd));
                                }
                                else
                                {
                                    ChangeTransferItemStatus("L2R", item.Id, TransferStatus.Cancel);
                                }
                            });
                        }
                        else
                        {
                            createRemoteDir(item.RemotePath, () =>
                            {
                                WriteLog("L2R", item.Id, item.LocalPath, item.RemotePath);
                                SftpProgressMonitor monitor = rightForm.TransfersToRemote(item.Id, item.LocalPath, item.RemotePath, ChannelSftp.OVERWRITE, new ProgressDelegate(TransfersFileProgress), new TransfersEndDelegate(TransfersFileEnd));
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error("传输文件的到服务器时异常:" + ex.Message);
                        ChangeTransferItemStatus("L2R", item.Id, TransferStatus.Failed);
                    }
                }
                else
                {
                    localToRemoteRun = false;
                }
            });            
        }

19 Source : Program.cs
with Apache License 2.0
from 214175590

static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.Exception, e.ToString());
            MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            logger.Error(str);
        }

19 Source : Program.cs
with Apache License 2.0
from 214175590

static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            string str = GetExceptionMsg(e.ExceptionObject as Exception, e.ToString());
            MessageBox.Show(str, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            logger.Error(str);
        }

19 Source : Program.cs
with GNU General Public License v3.0
from Agasper

public static void Main(string[] args)
        {
            System.Reflection.replacedembly replacedembly = System.Reflection.replacedembly.GetEntryreplacedembly();
            string ApplicationPath = System.IO.Path.GetDirectoryName(replacedembly.Location);
            XmlConfigurator.Configure(new FileInfo(Path.Combine(ApplicationPath, "logging.xml")));

            log.Info("Asert Unity Build Protection");
            log.Info("Copyright (c) 2017 - Alexander Melkozerov");
            log.Info("-------------------------------------------------");

            Arguments parsedArgs = new Arguments(args);

            if (!parsedArgs.ContainsArg("filename"))
            {
                PrintUsage();
                return;
            }
            string filename = parsedArgs["filename"];


            if (parsedArgs.ContainsArg("anreplacedamper") && !parsedArgs.ContainsArg("unitylib"))
            {
                log.Error("You're going to use anti tampering protection, but forgot to specify location of the unityengine.dll with --unitylib argument");
                return;
            }

            Asert asert = new Asert(filename)
            {
                StrongRenaming = !parsedArgs.ContainsArg("softrenaming"),
                RenameEvents = parsedArgs.ContainsArg("renameevents") || parsedArgs.ContainsArg("renameall"),
                RenameProps = parsedArgs.ContainsArg("renameprops") || parsedArgs.ContainsArg("renameall"),
                RenameFields = parsedArgs.ContainsArg("renamefields") || parsedArgs.ContainsArg("renameall"),
                RenameTypes = parsedArgs.ContainsArg("renametypes") || parsedArgs.ContainsArg("renameall"),
                RenameMethodParams = parsedArgs.ContainsArg("renamemethodparams") || parsedArgs.ContainsArg("renameall"),
                RenameMethods = parsedArgs.ContainsArg("renamemethods") || parsedArgs.ContainsArg("renameall"),

                HideStrings = parsedArgs.ContainsArg("hidestrings"),
                HideIntegers = parsedArgs.ContainsArg("hideintegers"),
                EncryptStrings = parsedArgs.ContainsArg("encryptstrings"),

            };

			if (parsedArgs.ContainsArg("anreplacedamper"))
				asert.AnreplacedamperingProtect();
            asert.ProtectConstants();
            asert.PerformRenaming();
            asert.Save(filename);
            if (parsedArgs.ContainsArg("anreplacedamper"))
            {
                asert.AnreplacedamperingInjectUnity(asert.AnreplacedamperingSign(filename), parsedArgs["unitylib"]);
            }
        }

19 Source : EntryPoint.cs
with Apache License 2.0
from apache

[STAThread]
		static void Main(string[] args)
		{
			if (log.IsInfoEnabled) log.Info(args);

			if (args.Length != 2)
			{
				log.Error("Must supply 2 command line arguments");
			}
			else
			{
				int left = int.Parse(args[0]);
				int right = int.Parse(args[1]);
				int result = 0;

				if (log.IsDebugEnabled) log.Debug("Adding ["+left+"] to ["+right+"]");

				result = (new SimpleModule.Math()).Add(left, right);

				if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");

				Console.Out.WriteLine(result);


				if (log.IsDebugEnabled) log.Debug("Subtracting ["+right+"] from ["+left+"]");

				result = (new SharedModule.Math()).Subtract(left, right);

				if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");

				Console.Out.WriteLine(result);
			}
		}

19 Source : LoggingExample.cs
with Apache License 2.0
from apache

public static void Main(string[] args)
		{
			// Log an info level message
			if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");

			// Log a debug message. Test if debug is enabled before
			// attempting to log the message. This is not required but
			// can make running without logging faster.
			if (log.IsDebugEnabled) log.Debug("This is a debug message");

			try
			{
				Bar();
			}
			catch(Exception ex)
			{
				// Log an error with an exception
				log.Error("Exception thrown from method Bar", ex);
			}

			log.Error("Hey this is an error!");

			// Push a message on to the Nested Diagnostic Context stack
			using(log4net.NDC.Push("NDC_Message"))
			{
				log.Warn("This should have an NDC message");

				// Set a Mapped Diagnostic Context value  
				log4net.MDC.Set("auth", "auth-none");
				log.Warn("This should have an MDC message for the key 'auth'");

			} // The NDC message is popped off the stack at the end of the using {} block

			log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");

			// Log an info level message
			if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");

			Console.Write("Press Enter to exit...");
			Console.ReadLine();
		}

19 Source : LoggingExample.cs
with Apache License 2.0
from apache

public static void Main(string[] args)
		{
			log4net.ThreadContext.Properties["session"] = 21;

			// Hookup the FireEventAppender event
			if (FireEventAppender.Instance != null)
			{
				FireEventAppender.Instance.MessageLoggedEvent += new MessageLoggedEventHandler(FireEventAppender_MessageLoggedEventHandler);
			}

			// Log an info level message
			if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] Start");

			// Log a debug message. Test if debug is enabled before
			// attempting to log the message. This is not required but
			// can make running without logging faster.
			if (log.IsDebugEnabled) log.Debug("This is a debug message");

			// Log a custom object as the log message
			log.Warn(new MsgObj(42, "So long and thanks for all the fish"));

			try
			{
				Bar();
			}
			catch(Exception ex)
			{
				// Log an error with an exception
				log.Error("Exception thrown from method Bar", ex);
			}

			log.Error("Hey this is an error!");

			// Log an info level message
			if (log.IsInfoEnabled) log.Info("Application [ConsoleApp] End");

			Console.Write("Press Enter to exit...");
			Console.ReadLine();
		}

19 Source : LoggingExample.cs
with Apache License 2.0
from apache

public static void Main(string[] args)
		{
			// Log an info level message
			if (log.IsInfoEnabled) log.Info("Application [SampleLayoutsApp] Start");

			// Log a debug message. Test if debug is enabled before
			// attempting to log the message. This is not required but
			// can make running without logging faster.
			if (log.IsDebugEnabled) log.Debug("This is a debug message");

			log.Info("This is a long line of logging text. This should test if the LineWrappingLayout works. This text should be wrapped over multiple lines of output. Could you get a log message longer than this?");

			log.Error("Hey this is an error!");

			// Log an info level message
			if (log.IsInfoEnabled) log.Info("Application [SampleLayoutsApp] End");

			Console.Write("Press Enter to exit...");
			Console.ReadLine();
		}

19 Source : RemotingClient.cs
with Apache License 2.0
from apache

static void StessTest()
		{
			int milliStart = Environment.TickCount;
			for (int i=0; i<10000; i++)
			{
				log.Error("["+i+"] This is an error message");
			}
			int milliEnd = Environment.TickCount;

			Console.WriteLine("Test Run Time: "+TimeSpan.FromMilliseconds(milliEnd - milliStart).ToString());
		}

19 Source : EntryPoint.cs
with Apache License 2.0
from apache

[STAThread]
		public static void Main(string[] args)
		{
			if (log.IsInfoEnabled) log.Info(args);

			if (args.Length != 2)
			{
				log.Error("Must supply 2 command line arguments");
			}
			else
			{
				int left = int.Parse(args[0]);
				int right = int.Parse(args[1]);
				int result = 0;

				if (log.IsDebugEnabled) log.Debug("Adding [" + left + "] to [" + right + "]");

				result = (new SimpleModule.Math()).Add(left, right);

				if (log.IsDebugEnabled) log.Debug("Result [" + result + "]");

				Console.Out.WriteLine(result);


				if (log.IsDebugEnabled) log.Debug("Subtracting [" + right + "] from [" + left + "]");

				result = (new SharedModule.Math()).Subtract(left, right);

				if (log.IsDebugEnabled) log.Debug("Result [" + result + "]");

				Console.Out.WriteLine(result);
			}
		}

19 Source : EntryPoint.cs
with Apache License 2.0
from apache

static void Main(string[] args)
		{
			if (log.IsInfoEnabled) log.Info(args);

			if (args.Length != 2)
			{
				log.Error("Must supply 2 command line arguments");
			}
			else
			{
				int left = int.Parse(args[0]);
				int right = int.Parse(args[1]);
				int result = 0;

				if (log.IsDebugEnabled) log.Debug("Adding ["+left+"] to ["+right+"]");

				result = (new SimpleModule.Math()).Add(left, right);

				if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");

				Console.Out.WriteLine(result);


				if (log.IsDebugEnabled) log.Debug("Subtracting ["+right+"] from ["+left+"]");

				result = (new SharedModule.Math()).Subtract(left, right);

				if (log.IsDebugEnabled) log.Debug("Result ["+result+"]");

				Console.Out.WriteLine(result);
			}
		}

19 Source : LoggingExample.cs
with Apache License 2.0
from apache

public static void LogEvents()
		{
			// Log a debug message. Test if debug is enabled before
			// attempting to log the message. This is not required but
			// can make running without logging faster.
			if (log.IsDebugEnabled) log.Debug("This is a debug message");

			try
			{
				Bar();
			}
			catch(Exception ex)
			{
				// Log an error with an exception
				log.Error("Exception thrown from method Bar", ex);
			}

			log.Error("Hey this is an error!");

			// Push a message on to the Nested Diagnostic Context stack
			using(log4net.NDC.Push("NDC_Message"))
			{
				log.Warn("This should have an NDC message");

				// Set a Mapped Diagnostic Context value  
				log4net.MDC.Set("auth", "auth-none");
				log.Warn("This should have an MDC message for the key 'auth'");

			} // The NDC message is popped off the stack at the end of the using {} block

			log.Warn("See the NDC has been popped of! The MDC 'auth' key is still with us.");
		}

19 Source : StringFormatTest.cs
with Apache License 2.0
from apache

[Test]
		public void TestLogFormatApi_Error()
		{
			StringAppender stringAppender = new StringAppender();
			stringAppender.Layout = new PatternLayout("%level:%message");

			ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
			BasicConfigurator.Configure(rep, stringAppender);

			ILog log1 = LogManager.GetLogger(rep.Name, "TestLogFormatApi_Error");

			// ***
			log1.Error("TestMessage");
			replacedert.AreEqual("ERROR:TestMessage", stringAppender.GetString(), "Test simple ERROR event 1");
			stringAppender.Reset();

			// ***
			log1.Error("TestMessage", null);
			replacedert.AreEqual("ERROR:TestMessage", stringAppender.GetString(), "Test simple ERROR event 2");
			stringAppender.Reset();

			// ***
			log1.Error("TestMessage", new Exception("Exception message"));
			replacedert.AreEqual("ERROR:TestMessageSystem.Exception: Exception message" + Environment.NewLine, stringAppender.GetString(), "Test simple ERROR event 3");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat("a{0}", "1");
			replacedert.AreEqual("ERROR:a1", stringAppender.GetString(), "Test formatted ERROR event with 1 parm");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat("a{0}b{1}", "1", "2");
			replacedert.AreEqual("ERROR:a1b2", stringAppender.GetString(), "Test formatted ERROR event with 2 parm");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat("a{0}b{1}c{2}", "1", "2", "3");
			replacedert.AreEqual("ERROR:a1b2c3", stringAppender.GetString(), "Test formatted ERROR event with 3 parm");
			stringAppender.Reset();


			// ***
			log1.ErrorFormat("a{0}b{1}c{2}d{3}e{4}f", "Q", "W", "E", "R", "T", "Y");
			replacedert.AreEqual("ERROR:aQbWcEdReTf", stringAppender.GetString(), "Test formatted ERROR event with 5 parms (only 4 used)");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat(null, "Before {0} After {1}", "Middle", "End");
			replacedert.AreEqual("ERROR:Before Middle After End", stringAppender.GetString(), "Test formatting with null provider");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat(new CultureInfo("en"), "Before {0} After {1}", "Middle", "End");
			replacedert.AreEqual("ERROR:Before Middle After End", stringAppender.GetString(), "Test formatting with 'en' provider");
			stringAppender.Reset();
		}

19 Source : StringFormatTest.cs
with Apache License 2.0
from apache

[Test]
		public void TestLogFormatApi_NoError()
		{
			StringAppender stringAppender = new StringAppender();
			stringAppender.Threshold = Level.Fatal;
			stringAppender.Layout = new PatternLayout("%level:%message");

			ILoggerRepository rep = LogManager.CreateRepository(Guid.NewGuid().ToString());
			BasicConfigurator.Configure(rep, stringAppender);

			ILog log1 = LogManager.GetLogger(rep.Name, "TestLogFormatApi_Error");

			// ***
			log1.Error("TestMessage");
			replacedert.AreEqual("", stringAppender.GetString(), "Test simple ERROR event 1");
			stringAppender.Reset();

			// ***
			log1.Error("TestMessage", null);
			replacedert.AreEqual("", stringAppender.GetString(), "Test simple ERROR event 2");
			stringAppender.Reset();

			// ***
			log1.Error("TestMessage", new Exception("Exception message"));
			replacedert.AreEqual("", stringAppender.GetString(), "Test simple ERROR event 3");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat("a{0}", "1");
			replacedert.AreEqual("", stringAppender.GetString(), "Test formatted ERROR event with 1 parm");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat("a{0}b{1}", "1", "2");
			replacedert.AreEqual("", stringAppender.GetString(), "Test formatted ERROR event with 2 parm");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat("a{0}b{1}c{2}", "1", "2", "3");
			replacedert.AreEqual("", stringAppender.GetString(), "Test formatted ERROR event with 3 parm");
			stringAppender.Reset();


			// ***
			log1.ErrorFormat("a{0}b{1}c{2}d{3}e{4}f", "Q", "W", "E", "R", "T", "Y");
			replacedert.AreEqual("", stringAppender.GetString(), "Test formatted ERROR event with 5 parms (only 4 used)");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat(null, "Before {0} After {1}", "Middle", "End");
			replacedert.AreEqual("", stringAppender.GetString(), "Test formatting with null provider");
			stringAppender.Reset();

			// ***
			log1.ErrorFormat(new CultureInfo("en"), "Before {0} After {1}", "Middle", "End");
			replacedert.AreEqual("", stringAppender.GetString(), "Test formatting with 'en' provider");
			stringAppender.Reset();
		}

19 Source : Logger.cs
with Apache License 2.0
from aws-samples

public static void LogError(string message) {
            log.Error(message);
        }

19 Source : Logger.cs
with Apache License 2.0
from aws-samples

public static void LogError(string message)
        {
            if (!IsLog4netConfigured)
            {
                ConfigureLog4Net();
            }
            log.Error(message);
        }

19 Source : Log4NetHandler.cs
with Apache License 2.0
from beetlex-io

public void Process(LogType type, string message)
		{
			switch (type)
			{
				case LogType.DEBUG:
					mLoger.Debug(message);
					break;
				case LogType.ERROR:
					mLoger.Error(message);
					break;
				case LogType.FATAL:
					mLoger.Fatal(message);
					break;
				case LogType.INFO:
					mLoger.Info(message);
					break;
				case LogType.WARN:
					mLoger.Warn(message);
					break;
				case LogType.NONE:
					break;

			}

		}

19 Source : MainWindow.xaml.cs
with GNU General Public License v3.0
from BLinssen

private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            //AVOID UAC Crash
            try
            {
                //Scan Screen for Tems
                ScanScreenTem(false);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                log.Error(ex.StackTrace);
            }

            //Force the CommandManager to raise the RequerySuggested event
            CommandManager.InvalidateRequerySuggested();
        }

19 Source : FsxController.cs
with MIT License
from breeswish

public bool Connect()
        {
            if (ValueBag.Connected)
            {
                return false;
            }
            try
            {
                FSUIPCConnection.Open();
                ValueBag.Clear();
                ValueBag.Connected = true;
                FsxiConnected?.Invoke(this, EventArgs.Empty);
                FsxiValueBagUpdated?.Invoke(this, EventArgs.Empty);

                updateThread = new Thread(new ParameterizedThreadStart(ThreadFunc));
                updateThread.Start(this);
                return true;
            }
            catch (FSUIPCException)
            {
                return false;
            }
            catch (Exception e)
            {
                log.Error(e);
                return false;
            }
        }

19 Source : HexiController.cs
with MIT License
from breeswish

private async Task RunServer()
        {
            serverCancelTokenSource = new CancellationTokenSource();
            TcpListener listener = new TcpListener(new IPAddress(new byte[] { 0, 0, 0, 0 }), ListenPort);
            listener.Start();
            try
            {
                while (true)
                {
                    try
                    {
                        TcpClient tcpClient = await Task.Run(() => listener.AcceptTcpClientAsync(), serverCancelTokenSource.Token);
                        HandleTcpClientConnectionAsync(tcpClient, serverCancelTokenSource.Token);
                    }
                    catch (OperationCanceledException)
                    {
                        throw;
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex);
                    }
                }
            }
            catch (OperationCanceledException)
            {
            }
        }

19 Source : LogHelper.cs
with MIT License
from chi8708

public void Error(object message)
        {
            this.logger.Error(message);
        }

19 Source : SIPMessageDaemon.cs
with BSD 2-Clause "Simplified" License
from double-hi

public void Stop()
        {
            try
            {
                logger.Debug("SIP Registrar daemon stopping...");

                logger.Debug("Shutting down SIP Transport.");
                m_sipTransport.Shutdown();

                logger.Debug("sip message service stopped.");
                MessageCore.Stop();

                logger.Debug("SIP Registrar daemon stopped.");
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPRegistrarDaemon Stop. " + excp.Message);
            }
        }

19 Source : SIPMessageDaemon.cs
with BSD 2-Clause "Simplified" License
from double-hi

public void Start()
        {
            try
            {
                logger.Debug("SIP Registrar daemon starting...");


                // Configure the SIP transport layer.
                m_sipTransport = new SIPTransport(SIPDNSManager.ResolveSIPService, new SIPTransactionEngine(), false);
                m_sipTransport.PerformanceMonitorPrefix = SIPSorceryPerformanceMonitor.REGISTRAR_PREFIX;
                SIPAccount account = SIPSqlite.Instance.Accounts.FirstOrDefault();
                List<SIPChannel> sipChannels = SIPTransportConfig.ParseSIPChannelsNode(account.LocalIP, account.LocalPort);
                m_sipTransport.AddSIPChannel(sipChannels);


                MessageCore = new SIPMessageCore(m_sipTransport, SIPConstants.SIP_SERVER_STRING);
                MessageCore.Initialize(SIPAuthenticateRequest_External, _platformList,_account);
                GB28181Catalog.Instance.MessageCore = MessageCore;
                m_sipTransport.SIPTransportRequestReceived += MessageCore.AddMessageRequest;
                m_sipTransport.SIPTransportResponseReceived += MessageCore.AddMessageResponse;

                Console.ForegroundColor = ConsoleColor.Green;
                logger.Debug("SIP Registrar successfully started.");
                Console.ForegroundColor = ConsoleColor.White;
            }
            catch (Exception excp)
            {
                logger.Error("Exception SIPRegistrarDaemon Start. " + excp.Message);
            }
        }

19 Source : Form1.cs
with BSD 2-Clause "Simplified" License
from double-hi

private void Initialize()
        {
            _devList = new List<ListViewItem>();
            txtStopTime.Text = DateTime.Now.ToString("yyyy-MM-dd 9:00:00");

            var configType = new Dictionary<string, string>
            {
                { "BasicParam", "基本参数配置" },
                { "VideoParamOpt", "视频参数范围" },
                { "SVACEncodeConfig", "SVAC编码配置" },
                { "SVACDecodeConfig", "SVAC解码配置" }
            };
            BindingSource bs = new BindingSource
            {
                DataSource = configType
            };

            cbxConfig.DataSource = bs;
            cbxConfig.DisplayMember = "Value";
            cbxConfig.ValueMember = "Key";

            Dictionary<string, string> recordType = new Dictionary<string, string>
            {
                { "time", "time" },
                { "alarm", "alarm" },
                { "manual", "manual" },
                { "all", "all" }
            };
            BindingSource bsRecord = new BindingSource
            {
                DataSource = recordType
            };

            cbxRecordType.DataSource = bsRecord;
            cbxRecordType.DisplayMember = "Value";
            cbxRecordType.ValueMember = "Key";

            SIPSqlite.Instance.Read();
            IList<CameraInfo> cameras = new List<CameraInfo>();
            var account = SIPSqlite.Instance.Accounts.First();
            if (account == null)
            {
                logger.Error("Account Config NULL,SIP not started");
                return;
            }
            _keepaliveTime = DateTime.Now;
            _cataThread = new Thread(new ThreadStart(HandleCata));
            _keepaliveThread = new Thread(new ThreadStart(HandleKeepalive));
            _messageCore = new SIPMessageCore(cameras, account);
        }

19 Source : Log4NetWriter.cs
with MIT License
from ecjtuseclab

public void WriteLogInfo(string txt)
        {
            ILog logWriete = log4net.LogManager.GetLogger("Demo");
            logWriete.Error(txt);
        }

19 Source : FileHelpers.cs
with MIT License
from ekblom

public static T LoadObjectFromFile<T>(FileInfo file)
        {
            if (!file.Exists)
                return default(T);

            var fs = WaitForFileAccess(file.FullName, FileMode.Open, FileAccess.Read, FileShare.None, new TimeSpan(0, 0, 0, 10));
            if (fs == null)
            {
                Log.Error("Unable to open " + file.FullName);
                throw new Exception("Unable to open " + file.Name);
            }

            string fileContent;
            using (var sr = new StreamReader(fs, Encoding.UTF8, true, 1024, false))
            {
                fileContent = sr.ReadToEnd();
            }

            var result = JsonConvert.DeserializeObject<T>(fileContent);
            if (result == null)
                Log.Error("Unable do deserialize " + file.FullName + "\n\n" + fileContent);

            return result;
        }

19 Source : App.xaml.cs
with MIT License
from ekblom

private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            _log.Error(e.ExceptionObject);
        }

19 Source : ErrorHandler.cs
with MIT License
from Excel-projects

public static void DisplayMessage(Exception ex, Boolean isSilent = false)
        {
            // gather context
            var sf = new System.Diagnostics.StackFrame(1);
            var caller = sf.GetMethod();
            var errorDescription = ex.ToString().Replace("\r\n", " "); // the carriage returns were messing up my log file
            var currentProcedure = caller.Name.Trim();
            var currentFileName = replacedemblyInfo.GetCurrentFileName();

            // handle log record
            var logMessage = string.Concat(new Dictionary<string, string>
            {
                ["PROCEDURE"] = currentProcedure,
                ["USER NAME"] = Environment.UserName,
                ["MACHINE NAME"] = Environment.MachineName,
                ["FILE NAME"] = currentFileName,
                ["DESCRIPTION"] = errorDescription,
            }.Select(x => $"[{x.Key}]=|{x.Value}|"));
            log.Error(logMessage);

            // format message
            var userMessage = new StringBuilder()
                .AppendLine("Contact your system administrator. A record has been created in the log file.")
                .AppendLine("Procedure: " + currentProcedure)
                .AppendLine("Description: " + errorDescription)
                .ToString();

            // handle message
            if (isSilent == false)
            {
                MessageBox.Show(userMessage, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

19 Source : ErrorHandler.cs
with MIT License
from Excel-projects

public static void DisplayMessage(Exception ex, Boolean isSilent = false)
        {
            var sf = new System.Diagnostics.StackFrame(1);
            var caller = sf.GetMethod();
            var errorDescription = ex.ToString().Replace("\r\n", " "); 
            var currentProcedure = caller.Name.Trim();
            var currentFileName = replacedemblyInfo.GetCurrentFileName();

            var logMessage = string.Concat(new Dictionary<string, string>
            {
                ["PROCEDURE"] = currentProcedure,
                ["USER NAME"] = Environment.UserName,
                ["MACHINE NAME"] = Environment.MachineName,
                ["FILE NAME"] = currentFileName,
                ["DESCRIPTION"] = errorDescription,
            }.Select(x => $"[{x.Key}]=|{x.Value}|"));
            log.Error(logMessage);

            var userMessage = new StringBuilder()
                .AppendLine("Contact your system administrator. A record has been created in the log file.")
                .AppendLine("Procedure: " + currentProcedure)
                .AppendLine("Description: " + errorDescription)
                .ToString();

            if (isSilent == false)
            {
                MessageBox.Show(userMessage, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

19 Source : DownloadFromRestServiceCurriculumVitaeController.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

private void DownloadCurriculumVitae(RetryMessage retryMessage, ManualResetEvent doneDownloadEvent)
        {
            var curriculumVitae = retryMessage.CurriculumVitae;
            var wc = new WebClient();
            try
            {
                var stream = wc.OpenRead(String.Format(_urlMetadata, curriculumVitae.NumeroCurriculo));

                DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(MetadataResponse));
                var response = ser.ReadObject(stream) as MetadataResponse;

                if (response.CodRhCript == null || response.CodRhCript.Trim().Length == 0)
                {
                    Logger.Error($"Não foi possível baixar o currículo de número {curriculumVitae.NumeroCurriculo}");
                    return;
                }

                curriculumVitae.NomeProfessor = response.Doreplacedent.NomeCompleto;

                if (NeedsToBeUpdated(curriculumVitae, response) == false)
                {
                    Logger.Info($"Currículo {curriculumVitae.NumeroCurriculo} - {curriculumVitae.NomeProfessor} já esta atualizado.");
                    return;
                }

                DownloadXml(curriculumVitae, response, wc);

                if (curriculumVitae.NomeProfessor == null || curriculumVitae.NomeProfessor.Trim().Length == 0)
                {
                    Logger.Info($"Curriculo {curriculumVitae.NumeroCurriculo} baixado");
                    return;
                }

                Logger.Info($"Curriculo {curriculumVitae.NumeroCurriculo} - {curriculumVitae.NomeProfessor} baixado");
            }
            catch (WebException exception)
            {
                Logger.Error(
                    $"Erro ao realizar requisão do Currículo {curriculumVitae.NumeroCurriculo} (Tentativas Sobrando {retryMessage.PendingRetries}): {exception.Message}\n{exception.StackTrace}"
                );
                retryMessage.PendingRetries--;
                if (retryMessage.PendingRetries > 0)
                {
                    Thread.Sleep(10000);
                    Interlocked.Increment(ref _pendingCurriculums);
                    _retryDownload.Send(retryMessage);
                }
            }
            finally
            {
                wc.Dispose();
                if (Interlocked.Decrement(ref _pendingCurriculums) == 0)
                {
                    doneDownloadEvent.Set();
                    _retryDownload.Close();
                }
            }
        }

19 Source : DownloadFromWebServiceCurriculumVitaeController.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

private void DownloadCurriculumVitae(CurriculoEntry curriculumVitae)
        {
            try
            {
                if (curriculumVitae.NumeroCurriculo == null || curriculumVitae.NumeroCurriculo.Trim().Length == 0)
                {
                    Logger.Error($"O número do curríuculo Lattes do professor {curriculumVitae.NomeProfessor} não foi encontrado");
                    return;
                }

                int read;
                byte[] buffer = new byte[4096];
                MemoryStream ms = _dcvs.GetCurriculumVitaeIfUpdated(curriculumVitae);

                if (ms == null)
                {
                    return;
                }

                if (File.Exists(_lattesModule.GetCurriculumVitaeFileName(curriculumVitae.NumeroCurriculo)))
                {
                    File.Delete(_lattesModule.GetCurriculumVitaeFileName(curriculumVitae.NumeroCurriculo));
                }

                FileStream wc = new FileStream(_lattesModule.GetCurriculumVitaeFileName(curriculumVitae.NumeroCurriculo), FileMode.CreateNew);
                while ((read = ms.Read(buffer, 0, buffer.Length)) > 0)
                {
                    wc.Write(buffer, 0, read);
                }
                ms.Close();

                _curriculumVitaesForProcess.Send(curriculumVitae);

                wc.Flush();
                wc.Close();

                if (curriculumVitae.NomeProfessor == null || curriculumVitae.NomeProfessor.Trim().Length == 0)
                {
                    Logger.Info($"Curriculo {curriculumVitae.NumeroCurriculo} baixado");
                    return;
                }

                Logger.Info($"Curriculo {curriculumVitae.NumeroCurriculo} - {curriculumVitae.NomeProfessor} baixado");
            }
            catch (Exception exception)
            {
                Logger.Error($"Erro ao buscar o currículo {curriculumVitae.NumeroCurriculo}, mensagem: {exception.Message}\n{exception.StackTrace}");
            }
        }

19 Source : DownloadCurriculumVitaeWebService.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

public MemoryStream GetCurriculumVitaeIfUpdated(CurriculoEntry curriculumVitae)
        {
            Nullable<DateTime> dataAtualizacaoLattes = null;
            Nullable<DateTime> dataAtualizacaoSistema;
            string dataAtualizacaoString;

            if (curriculumVitae.NumeroCurriculo == null || curriculumVitae.NumeroCurriculo == "")
            {
                Logger.Info(
                    $"Buscando Número do Currículo do Professor {curriculumVitae.NomeProfessor}"
                );
                curriculumVitae.NumeroCurriculo = ws.getIdentificadorCNPq(curriculumVitae.CPF, curriculumVitae.NomeProfessor, curriculumVitae.DataNascimento);

                if (curriculumVitae.NumeroCurriculo == null || curriculumVitae.NumeroCurriculo == "" || curriculumVitae.NumeroCurriculo.Contains("ERRO"))
                    return null;

                Logger.Info(
                    $"Número do Currículo do Professor {curriculumVitae.NomeProfessor} encontrado: {curriculumVitae.NumeroCurriculo}"
                );
            }

            // verificar se a data de atualizacao do CV é maior que a do sistema

            dataAtualizacaoSistema = this.GetDataAtualizacaoProfessor(curriculumVitae.NumeroCurriculo);

            if (dataAtualizacaoSistema != null)
            {
                dataAtualizacaoString = ws.getDataAtualizacaoCV(curriculumVitae.NumeroCurriculo);

                if (dataAtualizacaoString == "")
                    dataAtualizacaoLattes = DateTime.Today;
                else
                    dataAtualizacaoLattes = DateTime.ParseExact(dataAtualizacaoString, "dd/MM/yyyy %H:mm:ss", null);

                if (dataAtualizacaoSistema >= dataAtualizacaoLattes)
                    return null; // curriculo não precisa curriculumVitaeUnserializer atualizado
            }

            if (dataAtualizacaoLattes != null)
                curriculumVitae.DataUltimaAtualizacao = (DateTime)dataAtualizacaoLattes;

            byte[] zip = ws.getCurriculoCompactado(curriculumVitae.NumeroCurriculo);

            if (zip == null || zip.Length == 0)
            {
                Logger.Error(
                    $"Aconteceu um erro ao tentar buscar o currículo de Número {curriculumVitae.NumeroCurriculo}, favor verificar o mesmo"
                );
                return null;
            }

            return ProcessarRetornoCurriculo(zip);
        }

19 Source : LattesModule.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

private void ShowException(Exception ex)
        {
            Logger.Error($"Erros durante a execução: {ex.Message}\n{ex.StackTrace}");
            if (ex.InnerException != null)
            {
                int sequencia = 1;
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                    Logger.Error($"Excessão Interna [{sequencia++}]: {ex.Message}\n{ex.StackTrace}");
                }
            }
        }

19 Source : CurriculumVitaeProcessorController.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

private void ProcessCurriculumVitae(CurriculoEntry curriculoEntry, ManualResetEvent doneEvent)
        {
            XmlDoreplacedent curriculumVitaeXml = new XmlDoreplacedent();
            try
            {
                var filename = _lattesModule.GetCurriculumVitaeFileName(curriculoEntry.NumeroCurriculo);

                curriculumVitaeXml.Load(filename);

                // nescessário para o deserialize reconhecer o Xml
                curriculumVitaeXml.DoreplacedentElement.SetAttribute("xmlns", "http://tempuri.org/LMPLCurriculo");

                XDoreplacedent curriculumVitaeXDoreplacedent = XDoreplacedent.Parse(curriculumVitaeXml.InnerXml);
                CurriculoVitaeXml curriculumVitae = _curriculumVitaeUnserializer.Deserialize(curriculumVitaeXDoreplacedent.CreateReader()) as CurriculoVitaeXml;
                curriculoEntry.NomeProfessor = curriculumVitae.DADOSGERAIS.NOMECOMPLETO;

                ProfessorDAOService professorDAOService = new ProfessorDAOService(new LattesDatabase());
                Logger.Debug($"Iniciando processamento currículo {curriculoEntry.NumeroCurriculo} do Professor {curriculumVitae.DADOSGERAIS.NOMECOMPLETO}...");

                if (professorDAOService.ProcessCurriculumVitaeXML(curriculumVitae, curriculoEntry))
                {
                    Logger.Info($"Currículo {curriculoEntry.NumeroCurriculo} do Professor {curriculumVitae.DADOSGERAIS.NOMECOMPLETO} processado com sucesso !");
                    File.Delete(filename);
                }
            }

            catch (Exception ex)
            {
                Logger.Error($"Erro durante a leitura do XML {curriculoEntry.NumeroCurriculo}: {ex.Message}\n{ex.StackTrace}");

                int sequencia = 1;
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                    Logger.Error($"Excessão Interna [{sequencia++}]: {ex.Message}\n{ex.StackTrace}");
                }
            }
            finally
            {
                if (Interlocked.Decrement(ref _workItemCount) == 0)
                {
                    doneEvent.Set();
                }
                // Allow another add to the queue
                WorkLimiter.Release();
            }
        }

19 Source : ImportCurriculumVitaeFromFolderController.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

private void UnzipAndCopy(ManualResetEvent doneEvent, string filename, CurriculoEntry curriculumVitae)
        {
            try
            {
                int read;
                byte[] buffer = new byte[4096];
                using (var ms = UnzipCurriculumVitae(filename))
                {
                    using (FileStream wc = new FileStream(_lattesModule.GetCurriculumVitaeFileName(curriculumVitae.NumeroCurriculo), FileMode.CreateNew))
                    {
                        while ((read = ms.Read(buffer, 0, buffer.Length)) > 0)
                        {
                            wc.Write(buffer, 0, read);
                        }
                    }
                }
                _channel.Send(curriculumVitae);
            }
            catch (ZipException exception)
            {
                Logger.Error($"Erro ao importar currículo {curriculumVitae.NumeroCurriculo}: {exception.Message}\n{exception.StackTrace}");
            }
            finally
            {
                if (Interlocked.Decrement(ref _workItemCount) == 0)
                {
                    doneEvent.Set();
                }
            }
        }

19 Source : LattesModule.cs
with GNU General Public License v3.0
from FabricadeSoftwareUNIVILLE

public void Extract()
        {
            try
            {
                if (UseNewCNPqRestService)
                {
                    Logger.Error("A opção de utilizar o serviço \"buscacv\" do CNPq esta temporáriamente indisponível até se tornar estável");
                }

                Logger.Info("Começando Processamento...");

                var processor = new CurriculumVitaeProcessorController(this, CurriculumVitaeForProcess);
                QueueThreadProcessCurriculumVitae(processor.ProcessCurriculumVitaes);

                LoadCurriculums();

                Logger.Info("Iniciando Processamento dos Currículos...");

                if (_doneEventsListCurriculumVitae.Count > 0)
                {
                    WaitHandle.WaitAll(_doneEventsListCurriculumVitae.ToArray());
                    Logger.Info("Todos os Currículos Foram Listados...");
                }
                CurriculumVitaeForDownload.Close();

                WaitHandle.WaitAll(_doneEventsGetCurriculumVitae.ToArray());
                Logger.Info("Todos os Currículos Foram Adicionados para Processamento...");
                CurriculumVitaeForProcess.Close();

                WaitHandle.WaitAll(_doneEventsProcessCurriculumVitae.ToArray());
                Logger.Info("Todos os Currículos Foram Processados...");
            }
            catch (Exception ex)
            {
                ShowException(ex);
            }

            Logger.Info("Encerrando Execução...");
        }

19 Source : Peer.cs
with MIT License
from FICTURE7

public bool Authenticate(string authToken, string magicHash)
        {
            AuthToken = authToken ?? throw new ArgumentNullException(nameof(authToken));

            if (magicHash == null)
                throw new ArgumentNullException(nameof(magicHash));

            Log.Info($"Authenticating {authToken}:{magicHash} at {RemoteIP}:{RemotePort}");

            var userView = GetUser(true);
            OnAuthenticate(userView);

#if !DEBUG
            bool isAdmin = userView.CmuneMemberView.PublicProfile.AccessLevel != MemberAccessLevel.Admin;
            if (Configuration.CompositeHashes.Count > 0 && isAdmin)
            {
                var authTokenBytes = Encoding.ASCII.GetBytes(authToken);
                for (int i = 0; i < Configuration.CompositeHashes.Count; i++)
                {
                    var compositeHash = Configuration.CompositeHashes[i];
                    var reMagicHash = HashBytes(compositeHash, authTokenBytes);
                    if (reMagicHash == magicHash)
                    {
                        Log.Debug($"MagicHash: {reMagicHash} == {magicHash}");
                        return true;
                    }

                    Log.Error($"MagicHash: {reMagicHash} != {magicHash}");
                }

                return false;
            }
#endif
            return true;
        }

19 Source : BaseApplicationWebService.cs
with MIT License
from FICTURE7

byte[] IApplicationWebServiceContract.AuthenticateApplication(byte[] data)
        {
            try
            {
                using (var bytes = new MemoryStream(data))
                {
                    var version = StringProxy.Deserialize(bytes); // 4.7.1
                    var channelType = EnumProxy<ChannelType>.Deserialize(bytes); // Steam
                    var publicKey = StringProxy.Deserialize(bytes); // string.Empty;

                    var view = OnAuthenticateApplication(version, channelType, publicKey);
                    using (var outBytes = new MemoryStream())
                    {
                        AuthenticateApplicationViewProxy.Serialize(outBytes, view);
                        return outBytes.ToArray();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle AuthenticateApplication request:");
                Log.Error(ex);
                return null;
            }
        }

19 Source : BaseApplicationWebService.cs
with MIT License
from FICTURE7

byte[] IApplicationWebServiceContract.GetConfigurationData(byte[] data)
        {
            try
            {
                using (var bytes = new MemoryStream(data))
                {
                    var version = StringProxy.Deserialize(bytes);

                    var view = OnGetConfigurationData(version);
                    using (var outBytes = new MemoryStream())
                    {
                        ApplicationConfigurationViewProxy.Serialize(outBytes, view);
                        return outBytes.ToArray();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle GetConfigurationData request:");
                Log.Error(ex);
                return null;
            }
        }

19 Source : BaseApplicationWebService.cs
with MIT License
from FICTURE7

byte[] IApplicationWebServiceContract.GetMaps(byte[] data)
        {
            try
            {
                using (var bytes = new MemoryStream(data))
                {
                    var version = StringProxy.Deserialize(bytes);
                    var definitionType = EnumProxy<DefinitionType>.Deserialize(bytes);

                    var view = OnGetMaps(version, definitionType);
                    using (var outBytes = new MemoryStream())
                    {
                        ListProxy<MapView>.Serialize(outBytes, view, MapViewProxy.Serialize);
                        return outBytes.ToArray();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle GetMaps request:");
                Log.Error(ex);
                return null;
            }
        }

19 Source : BaseApplicationWebService.cs
with MIT License
from FICTURE7

byte[] IApplicationWebServiceContract.SetMatchScore(byte[] data)
        {
            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle GetMaps request:");
                Log.Error(ex);
                return null;
            }
        }

19 Source : BaseAuthenticationWebService.cs
with MIT License
from FICTURE7

byte[] IAuthenticationWebServiceContract.CompleteAccount(byte[] data)
        {
            try
            {
                using (var bytes = new MemoryStream(data))
                {
                    var cmid = Int32Proxy.Deserialize(bytes);
                    var name = StringProxy.Deserialize(bytes);
                    var channelType = EnumProxy<ChannelType>.Deserialize(bytes);
                    var locale = StringProxy.Deserialize(bytes);
                    var machineId = StringProxy.Deserialize(bytes);

                    var view = OnCompleteAccount(cmid, name, channelType, locale, machineId);
                    using (var outBytes = new MemoryStream())
                    {
                        AccountCompletionResultViewProxy.Serialize(outBytes, view);
                        return outBytes.ToArray();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle CompleteAccount request:");
                Log.Error(ex);
                return null;
            }
        }

19 Source : BaseAuthenticationWebService.cs
with MIT License
from FICTURE7

byte[] IAuthenticationWebServiceContract.CreateUser(byte[] data)
        {
            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle CreateUser request:");
                Log.Error(ex);
                return null;
            }
        }

19 Source : BaseAuthenticationWebService.cs
with MIT License
from FICTURE7

byte[] IAuthenticationWebServiceContract.LinkSteamMember(byte[] data)
        {
            try
            {
                throw new NotImplementedException();
            }
            catch (Exception ex)
            {
                Log.Error("Unable to handle LinkSteamMember request:");
                Log.Error(ex);
                return null;
            }
        }

See More Examples