示例#1
0
        private void LogDelete(Soa entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.DeleteSoa);

            creator.AddSoa(entity.Id);
            creator.SaveToLog(false);
        }
示例#2
0
        private void LogInvoiceEdit(Invoice entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.ModifyInvoice);

            creator.AddInvoice(entity.Id);
            creator.SaveToLog(false);
        }
        public void ExportingConversationIncludingReport()
        {
            var exporter = new ConversationExporter();

            string[] args        = { "--report" };
            var      editorCofig = new EditorConfiguration(args);
            var      editor      = new ConversationEditor(editorCofig);
            var      logCreator  = new LogCreator(editorCofig);

            exporter.ExportConversation("chat.txt", "chatReport.json", editor, logCreator);

            var serializedConversation = new StreamReader(new FileStream("chatReport.json", FileMode.Open)).ReadToEnd();

            var savedConversation = JsonConvert.DeserializeObject <Conversation>(serializedConversation);

            Assert.That(savedConversation.name, Is.EqualTo("My Conversation"));

            var messages   = savedConversation.messages.ToList();
            var reportList = savedConversation.activity.ToList();

            Assert.That(messages[0].timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470901)));
            Assert.That(messages[0].senderId, Is.EqualTo("bob"));
            Assert.That(messages[0].content, Is.EqualTo("Hello there!"));

            Assert.That(reportList[0].sender, Is.EqualTo("bob"));
            Assert.That(reportList[0].count, Is.EqualTo(3));

            Assert.That(reportList[1].sender, Is.EqualTo("mike"));
            Assert.That(reportList[1].count, Is.EqualTo(2));

            Assert.That(reportList[2].sender, Is.EqualTo("angus"));
            Assert.That(reportList[2].count, Is.EqualTo(2));
        }
示例#4
0
        private void LogAdd(Soa entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.AddSoa);

            creator.AddSoa(entity.Id);
            creator.SaveToLog();
        }
示例#5
0
        public UnprotectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + (!Titan.Instance.Options.Secure ? " (Unprotected)" : ""));

            _steamConfig = SteamConfiguration.Create(builder =>
            {
                builder.WithConnectionTimeout(TimeSpan.FromMinutes(1));
                //builder.WithWebAPIKey(Titan.Instance.WebHandle.GetKey()); Is null at time of this creation - needs fix
            });

            _steamClient     = new SteamClient(_steamConfig);
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            _titanHandle = new TitanHandler();
            _steamClient.AddHandler(_titanHandle);

            // Initialize debug network sniffer when debug mode is enabled
            if (Titan.Instance.Options.Debug)
            {
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            _log.Debug("Successfully initialized account object for {Username}.", json.Username);
        }
    public bool ExportAssembly(Project project)
    {
        var failReason = project.LogWriterSettings.Validate(fs);

        if (failReason != null)
        {
            logger.Error($"invalid assembly build settings {failReason}");
            return(false);
        }

        var lc = new LogCreator
        {
            Settings = project.LogWriterSettings,
            Data     = new LogCreatorByteSource(project.Data),
        };

        logger.Debug("Building....");
        var result = lc.CreateLog();

        if (!result.Success)
        {
            logger.Error($"Failed to build, error was: {result.OutputStr}");
            return(false);
        }

        logger.Info("Successfully exported assembly output.");
        return(true);
    }
示例#7
0
        private void LogDelete(Policy entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.DeletePolicy);

            creator.AddPolicy(entity.Id);
            creator.SaveToLog(false);
        }
示例#8
0
        private void LogEdit(Policy entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.ModifyPolicy);

            creator.AddPolicy(entity.Id);
            creator.SaveToLog(false);
        }
示例#9
0
        private void LogAdd(Policy entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.AddPolicy);

            creator.AddPolicy(entity.Id);
            creator.SaveToLog();
        }
        protected override string Generate(int offset, int length)
        {
            // what we're given: a PC offset in ROM.
            // what we need to find: any labels (SNES addresses) that refer to it.
            //
            // i.e. given that we are at PC offset = 0,
            // we find valid SNES offsets mirrored of 0xC08000 and 0x808000 which both refer to the same place
            //
            // TODO: we may still need to deal with that mirroring here
            // TODO: eventually, support multiple labels tagging the same address, it may not always be just one.

            var snesAddress = Data.ConvertPCtoSnes(offset);
            var label       = Data.Labels.GetLabelName(snesAddress);

            if (label == null)
            {
                return("");
            }

            LogCreator.OnLabelVisited(snesAddress);

            var noColon = label.Length == 0 || label[0] == '-' || label[0] == '+';

            var str = $"{label}{(noColon ? "" : ":")}";

            return(Util.LeftAlign(length, str));
        }
示例#11
0
        private void LogEdit(Client entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.ModifyClient);

            creator.AddClient(entity.Id);
            creator.SaveToLog(false);
        }
示例#12
0
        private void LogEdit(Form entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.ModifyForm);

            creator.AddForm(entity.Id);
            creator.SaveToLog(false);
        }
            internal static void Run(string environment, LogConfig config)
            {
                Logger logger = new LogCreator(environment, config).GetLogger();

                logger.Trace("A");
                logger.Warning("B");
            }
示例#14
0
        public UnprotectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + " (Unprotected)");

            _steamClient     = new SteamClient();
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            // Initialize debug network sniffer when debug mode is enabled
            if (Titan.Instance.Options.Debug)
            {
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            _log.Debug("Successfully initialized account object for {0}.", json.Username);
        }
示例#15
0
        private void LogAdd(Form entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.AddForm);

            creator.AddForm(entity.Id);
            creator.SaveToLog();
        }
示例#16
0
        private void LogDelete(Client entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.DeleteClient);

            creator.AddClient(entity.Id);
            creator.SaveToLog(false);
        }
示例#17
0
        public void ReportTest()
        {
            var messages   = new List <Message>();
            var messageOne = new Message(DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64("1448470901")), "stan", "i tested string");

            messages.Add(messageOne);
            var messageTwo = new Message(DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64("1448470901")), "stan", "i tested string");

            messages.Add(messageTwo);
            var messageThree = new Message(DateTimeOffset.FromUnixTimeSeconds(Convert.ToInt64("1448470901")), "bob", "i tested string");

            messages.Add(messageThree);

            var testConversation = new Conversation("test", messages);

            string[] args        = { "--report" };
            var      editorCofig = new EditorConfiguration(args);
            var      logCreator  = new LogCreator(editorCofig);

            var reportList = logCreator.AddReport(testConversation);

            Assert.That(reportList[0].sender, Is.EqualTo("stan"));
            Assert.That(reportList[0].count, Is.EqualTo(2));

            Assert.That(reportList[1].sender, Is.EqualTo("bob"));
            Assert.That(reportList[1].count, Is.EqualTo(1));
        }
示例#18
0
        private void LogEdit(Soa entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.ModifySoa);

            creator.AddSoa(entity.Id);
            creator.SaveToLog(false);
        }
示例#19
0
        private void LogAdd(Client entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.AddClient);

            creator.AddClient(entity.Id);
            creator.SaveToLog();
        }
示例#20
0
        private void LogDelete(Form entity)
        {
            var creator = new LogCreator(this, ActivityLogTypeEnum.DeleteForm);

            creator.AddForm(entity.Id);
            creator.SaveToLog(false);
        }
 protected FbClient(string user, string password)
 {
     Logger          = LogCreator.Create();
     _requestHandler = new HttpRequestHandler();
     Username        = user;
     Password        = password;
     Authorize();
 }
示例#22
0
            internal static void Run(string environment, LogConfig config)
            {
                LogCreator logCreator = GetLoggCreator(environment);
                Logger     logger     = logCreator.Create(config);

                logger.Trace("A");
                logger.Warning("B");
            }
        private void WriteUnusedLabel(int snesAddress)
        {
            // shove this in here even though what we SHOULD do is express it as a ROM offset.
            // however, we need to be able to pass in non-ROM SNES addresses.
            var stuffSnesAddressInOffset = snesAddress;

            LogCreator.WriteLine(LogCreator.LineGenerator.GenerateSpecialLine("labelassign", stuffSnesAddressInOffset));
        }
        protected override void Execute()
        {
            LogCreator.SwitchOutputStream("labels");

            foreach (var(snesAddress, _) in LabelTracker.UnvisitedLabels)
            {
                WriteUnusedLabel(snesAddress);
            }
        }
示例#25
0
        public SharedSecret(TitanAccount account)
        {
            _log = LogCreator.Create("Shared Secret - " + account.JsonAccount.Username);

            _steamGuardAccount = new SteamGuardAccount
            {
                SharedSecret = account.JsonAccount.SharedSecret
            };
        }
示例#26
0
        public ProtectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + (!Titan.Instance.Options.Secure ? " (Protected)" : ""));

            _steamConfig = SteamConfiguration.Create(builder =>
            {
                builder.WithConnectionTimeout(TimeSpan.FromMinutes(1));

                var key = Titan.Instance.WebHandle.GetKey();

                if (!string.IsNullOrEmpty(key))
                {
                    builder.WithWebAPIKey(key);
                    _log.Debug("Initializing with preloaded API key.");
                }
                else
                {
                    _log.Debug("Initializing without API key.");
                }
            });

            _sentry   = new Sentry.Sentry(this);
            _loginKey = new LoginKey(this);

            _steamClient     = new SteamClient(_steamConfig);
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            // This clause excludes SteamKit debug mode as that mode is handeled seperately.
            // Normal debug mode doesn't equal SteamKit debug mode.
            if (Titan.Instance.Options.Debug)
            {
                _titanHandle = new TitanHandler();
                _steamClient.AddHandler(_titanHandle);

                // Initialize debug network sniffer when debug mode is enabled
                var dir = new DirectoryInfo(Path.Combine(Titan.Instance.DebugDirectory.ToString(), json.Username));
                if (!dir.Exists)
                {
                    dir.Create();
                }

                _steamClient.DebugNetworkListener = new NetHookNetworkListener(
                    dir.ToString()
                    );
            }

            if (!string.IsNullOrWhiteSpace(JsonAccount.SharedSecret))
            {
                _sharedSecretGenerator = new SharedSecret(this);
            }

            _log.Debug("Successfully initialized account object for " + json.Username + ".");
        }
        private void WriteLabel(int snesAddress)
        {
            // not the best place to add formatting, TODO: cleanup
            var category = LabelTracker.UnvisitedLabels.ContainsKey(snesAddress) ? "UNUSED" : "USED";

            // shove this in here even though what we SHOULD do is express it as a ROM offset.
            // however, we need to be able to pass in non-ROM SNES addresses.
            var stuffSnesAddressInOffset = snesAddress;

            LogCreator.WriteLine($";!^!-{category}-! " + LogCreator.LineGenerator.GenerateSpecialLine("labelassign", stuffSnesAddressInOffset));
        }
示例#28
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
示例#29
0
        public UnprotectedAccount(JsonAccounts.JsonAccount json) : base(json)
        {
            _log = LogCreator.Create("GC - " + json.Username + " (Unprotected)");

            _steamClient     = new SteamClient();
            _callbacks       = new CallbackManager(_steamClient);
            _steamUser       = _steamClient.GetHandler <SteamUser>();
            _steamFriends    = _steamClient.GetHandler <SteamFriends>();
            _gameCoordinator = _steamClient.GetHandler <SteamGameCoordinator>();

            _log.Debug("Successfully initialized account object for {0}.", json.Username);
        }
        protected override void Execute()
        {
            // part 2: optional: if requested, print all labels regardless of use.
            // Useful for debugging, documentation, or reverse engineering workflow.
            // this file shouldn't need to be included in the build, it's just reference documentation
            LogCreator.SwitchOutputStream("all-labels.txt"); // TODO: csv in the future. escape commas

            foreach (var(snesAddress, _) in Data.Labels.Labels)
            {
                WriteLabel(snesAddress);
            }
        }