Ejemplo n.º 1
0
 private static void Init()
 {
     Option.AssemblyPath = AppDomain.CurrentDomain.BaseDirectory;
     Option.EditorDefaultResourcePath = Path.Combine(Option.AssemblyPath, "EditorDefaultRes");
     Option.UserCustomerConfigFolder  = Path.Combine(Option.GetConfigFolderLocation(), "Cocos", "CocosStudio2");
     Log4Wrap.SetLocation(Option.UserCustomerConfigFolder);
     Option.SamplesRootFolder   = Option.GetSamplesFolderLocation();
     Option.SamplesFolder       = Path.Combine(Option.SamplesRootFolder, "Cocos", "CocosStudio2");
     Option.DefaultProjectsDir  = Path.Combine(Option.UserCustomerConfigFolder, "Projects");
     Option.AddinLocationFolder = Path.Combine(Option.UserCustomerConfigFolder, "Addins");
     Option.AddinConfigFolder   = Path.Combine(Option.UserCustomerConfigFolder, "AddinConfig");
     Option.MyDocumentsFolder   = Option.GetMyDocumentsFolder();
     Option.CheckResourceDir();
     Option.CheckUserConfigDir();
     Option.CheckDefaultPojectsDir();
     Option.CheckPluginDir();
     Option.UserConfig = UserConfig.Create();
     Option.HelpLink   = Option.GetHelpLink();
 }
Ejemplo n.º 2
0
 private static void Init(string configFolder)
 {
     try
     {
         string withoutExtension = Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0]);
         string str1             = Path.Combine(configFolder, "log4net_config");
         string str2             = Path.Combine(configFolder, "logs");
         Log4Wrap.logfilename = withoutExtension + "_" + DateTime.Now.ToString("o") + ".log";
         Log4Wrap.logfilename = Log4Wrap.logfilename.Replace(":", ".");
         Log4Wrap.logfilename = Path.Combine(str2, Log4Wrap.logfilename);
         if (!Directory.Exists(str1))
         {
             Directory.CreateDirectory(str1);
         }
         if (!Directory.Exists(str2))
         {
             Directory.CreateDirectory(str2);
         }
         Log4Wrap.configPath = Path.Combine(str1, withoutExtension + ".xml");
         if (!File.Exists(Log4Wrap.configPath))
         {
             Log4Wrap.CreateDefaultConfigFile(Log4Wrap.configPath);
         }
         else
         {
             XElement xelement = XElement.Load(Log4Wrap.configPath);
             xelement.Descendants((XName)"appender").First <XElement>((Func <XElement, bool>)(n => n.Attribute((XName)"name").Value == "RollingFileAppender")).Element((XName)"file").Attribute((XName)"value").Value = Log4Wrap.logfilename;
             xelement.Save(Log4Wrap.configPath);
         }
         XmlConfigurator.ConfigureAndWatch(new FileInfo(Log4Wrap.configPath));
         Log4Wrap.logger = LogManager.GetLogger("CKLog");
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 3
0
 internal static void SetLocation(string configFolder)
 {
     Log4Wrap.Init(configFolder);
 }