static log() { var file = AppDomain.CurrentDomain.BaseDirectory + "logsettings.json"; if (File.Exists(file)) { var cnt = File.ReadAllText(file); var cfg = Dobj.FromJson(cnt); settings = cfg; } else { settings = new Dobj(); Dobj.Settings(settings).AutoCreate = true; settings.logger.file.name = typeof (FileLogger).AssemblyQualifiedName; settings.logger.file.args.folder = "logs"; Dobj.Settings(settings).AutoCreate = false; var cnt = Dobj.ToJson(settings); File.WriteAllText(file, cnt); } var loggers = settings.logger; Dobj.Enum(loggers,new Func<string, dynamic, bool>((k, v) => { string name = v.name; var lg = (Logger)ReflectionExtensions.CreateInstance(name, AppDomain.CurrentDomain, v.args); logger.Add(lg); return false; })); queue.OnDequeue += Queue_OnDequeue; }
protected override void ProcessContext(object context) { var ctx = (IOwinContext) context; IFormCollection forms = null; if (string.Equals(ctx.Request.Method, "post", StringComparison.OrdinalIgnoreCase)) { var task = ctx.Request.ReadFormAsync(); task.Wait(); forms = task.Result; } else { forms = new FormCollection(new Dictionary<string, string[]>()); } foreach (var i in forms) { Dobj.Set(Forms, i.Key, i.Value); } foreach (var i in ctx.Request.Cookies) { Dobj.Set(Cookies, i.Key, i.Value); } Headers = new Dobj(); foreach (var i in ctx.Request.Headers.Keys) { Dobj.Set(Headers, i, ctx.Request.Headers[i]); } Body = ctx.Request.Body; ContentType = ctx.Request.ContentType; Url = new RequestUrl(ctx.Request.Uri); }
public override void Load() { if (File.Exists(file)) { var json = File.ReadAllText(file); if (!string.IsNullOrWhiteSpace(json)) { cache = Dobj.FromJson(json); } } else { cache = new Dobj(); } }
public OwinAdapter(Dobj config) { settings = config; string cn = Dobj.Exists(settings, "cn") ? settings.cn : "localhost"; string d = Dobj.Exists(settings, "domain")?settings.domain:"+"; bool ssl = Dobj.Get<bool>(settings, "ssl"); var port = settings.port; mre = new ManualResetEvent(false); this.port = port; if (ssl) { var file = AppDomain.CurrentDomain.BaseDirectory + "cert.pfx"; var cert = GetCert(cn, TimeSpan.FromDays(3650), "addincer", file); ActivateCert((X509Certificate2) cert, port, GetAppId()); } var so = new StartOptions(); so.Urls.Add($"{(ssl ? "https" : "http")}://{d}:{port}/"); options = so; }
static void Main(string[] args) { Console.WriteLine(AppDomain.CurrentDomain.FriendlyName); dynamic settings = new Dobj(new DobjSettings { AutoCreate = true }); settings.name = "TestContainer"; settings.basedir = AppDomain.CurrentDomain.BaseDirectory; settings.pattern = "addin.dll"; settings.entry = ".ConsoleAddin"; settings.settings.port = 80; var rp = new FolderRepository(settings); rp.Load(); Console.WriteLine("Press any key to unload ..."); Console.ReadKey(); rp.Unload(); Console.WriteLine("Press any key to exit ..."); Console.ReadKey(); //HappyPath(); //Test(); }
private void Update() { PassengerSection = GameObject.FindGameObjectsWithTag("Passenger"); DriverSection = GameObject.FindGameObjectsWithTag("Driver"); MoneySection = GameObject.FindGameObjectsWithTag("Money"); ReputationSection = GameObject.FindGameObjectsWithTag("Reputation"); switch (btn) { case 1: { foreach (GameObject Dobj in DriverSection) { if (Dobj.GetComponent <Text>() != null) { Dobj.GetComponent <Text>().enabled = true; } if (Dobj.GetComponent <InputField>() != null) { Dobj.GetComponent <InputField>().enabled = true; } if (Dobj.GetComponent <Image>() != null) { Dobj.GetComponent <Image>().enabled = true; } } foreach (GameObject Pobj in PassengerSection) { if (Pobj.GetComponent <Text>() != null) { Pobj.GetComponent <Text>().enabled = false; } if (Pobj.GetComponent <InputField>() != null) { Pobj.GetComponent <InputField>().enabled = false; } if (Pobj.GetComponent <Image>() != null) { Pobj.GetComponent <Image>().enabled = false; } } foreach (GameObject Robj in ReputationSection) { if (Robj.GetComponent <Text>() != null) { Robj.GetComponent <Text>().enabled = false; } if (Robj.GetComponent <InputField>() != null) { Robj.GetComponent <InputField>().enabled = false; } if (Robj.GetComponent <Image>() != null) { Robj.GetComponent <Image>().enabled = false; } } foreach (GameObject Mobj in MoneySection) { if (Mobj.GetComponent <Text>() != null) { Mobj.GetComponent <Text>().enabled = false; } if (Mobj.GetComponent <InputField>() != null) { Mobj.GetComponent <InputField>().enabled = false; } if (Mobj.GetComponent <Image>() != null) { Mobj.GetComponent <Image>().enabled = false; } } break; } case 2: { foreach (GameObject Robj in ReputationSection) { if (Robj.GetComponent <Text>() != null) { Robj.GetComponent <Text>().enabled = false; } if (Robj.GetComponent <InputField>() != null) { Robj.GetComponent <InputField>().enabled = false; } if (Robj.GetComponent <Image>() != null) { Robj.GetComponent <Image>().enabled = false; } } foreach (GameObject _Dobj in DriverSection) { if (_Dobj.GetComponent <Text>() != null) { _Dobj.GetComponent <Text>().enabled = false; } if (_Dobj.GetComponent <InputField>() != null) { _Dobj.GetComponent <InputField>().enabled = false; } if (_Dobj.GetComponent <Image>() != null) { _Dobj.GetComponent <Image>().enabled = false; } } foreach (GameObject _Pobj in PassengerSection) { if (_Pobj.GetComponent <Text>() != null) { _Pobj.GetComponent <Text>().enabled = true; } if (_Pobj.GetComponent <InputField>() != null) { _Pobj.GetComponent <InputField>().enabled = true; } if (_Pobj.GetComponent <Image>() != null) { _Pobj.GetComponent <Image>().enabled = true; } } foreach (GameObject Mobj in MoneySection) { if (Mobj.GetComponent <Text>() != null) { Mobj.GetComponent <Text>().enabled = false; } if (Mobj.GetComponent <InputField>() != null) { Mobj.GetComponent <InputField>().enabled = false; } if (Mobj.GetComponent <Image>() != null) { Mobj.GetComponent <Image>().enabled = false; } } break; } case 3: { foreach (GameObject Robj in ReputationSection) { if (Robj.GetComponent <Text>() != null) { Robj.GetComponent <Text>().enabled = false; } if (Robj.GetComponent <InputField>() != null) { Robj.GetComponent <InputField>().enabled = false; } if (Robj.GetComponent <Image>() != null) { Robj.GetComponent <Image>().enabled = false; } } foreach (GameObject _Dobj in DriverSection) { if (_Dobj.GetComponent <Text>() != null) { _Dobj.GetComponent <Text>().enabled = false; } if (_Dobj.GetComponent <InputField>() != null) { _Dobj.GetComponent <InputField>().enabled = false; } if (_Dobj.GetComponent <Image>() != null) { _Dobj.GetComponent <Image>().enabled = false; } } foreach (GameObject _Pobj in PassengerSection) { if (_Pobj.GetComponent <Text>() != null) { _Pobj.GetComponent <Text>().enabled = false; } if (_Pobj.GetComponent <InputField>() != null) { _Pobj.GetComponent <InputField>().enabled = false; } if (_Pobj.GetComponent <Image>() != null) { _Pobj.GetComponent <Image>().enabled = false; } } foreach (GameObject Mobj in MoneySection) { if (Mobj.GetComponent <Text>() != null) { Mobj.GetComponent <Text>().enabled = true; } if (Mobj.GetComponent <InputField>() != null) { Mobj.GetComponent <InputField>().enabled = true; } if (Mobj.GetComponent <Image>() != null) { Mobj.GetComponent <Image>().enabled = true; } } break; } case 4: { foreach (GameObject Robj in ReputationSection) { if (Robj.GetComponent <Text>() != null) { Robj.GetComponent <Text>().enabled = true; } if (Robj.GetComponent <InputField>() != null) { Robj.GetComponent <InputField>().enabled = true; } if (Robj.GetComponent <Image>() != null) { Robj.GetComponent <Image>().enabled = true; } } foreach (GameObject _Dobj in DriverSection) { if (_Dobj.GetComponent <Text>() != null) { _Dobj.GetComponent <Text>().enabled = false; } if (_Dobj.GetComponent <InputField>() != null) { _Dobj.GetComponent <InputField>().enabled = false; } if (_Dobj.GetComponent <Image>() != null) { _Dobj.GetComponent <Image>().enabled = false; } } foreach (GameObject _Pobj in PassengerSection) { if (_Pobj.GetComponent <Text>() != null) { _Pobj.GetComponent <Text>().enabled = false; } if (_Pobj.GetComponent <InputField>() != null) { _Pobj.GetComponent <InputField>().enabled = false; } if (_Pobj.GetComponent <Image>() != null) { _Pobj.GetComponent <Image>().enabled = false; } } foreach (GameObject Mobj in MoneySection) { if (Mobj.GetComponent <Text>() != null) { Mobj.GetComponent <Text>().enabled = false; } if (Mobj.GetComponent <InputField>() != null) { Mobj.GetComponent <InputField>().enabled = false; } if (Mobj.GetComponent <Image>() != null) { Mobj.GetComponent <Image>().enabled = false; } } break; } } }
public static void Start() { node = new PassiveNode(); Dobj d = new Dobj(new { Port = 20000, Threads = 1, Handler = "Infrastructure.DomainSocketHandler,Infrastructure" }); node.Listen(d); }