public ElasticReader( IConnectionContext context, Field[] fields, IElasticLowLevelClient client, IRowFactory rowFactory, ReadFrom readFrom ) { _context = context; _fields = fields; _fieldNames = fields.Select(f => _readFrom == ReadFrom.Input ? f.Name : f.Alias.ToLower()).ToArray(); _client = client; _rowFactory = rowFactory; _readFrom = readFrom; _typeName = readFrom == ReadFrom.Input ? context.Entity.Name : context.Entity.Alias.ToLower(); _context.Entity.ReadSize = _context.Entity.ReadSize == 0 ? DefaultSize : _context.Entity.ReadSize; if (_context.Entity.ReadSize > ElasticsearchDefaultSizeLimit) { _context.Warn("Elasticsearch's default size limit is 10000. {0} may be too high.", _context.Entity.ReadSize); } _version = ElasticVersionParser.ParseVersion(_context); }
private Get GetFromBinary(byte[] bytes) { var proto = Proto.Msg.Get.Parser.ParseFrom(bytes); var key = (IKey)_ser.OtherMessageFromProto(proto.Key); var request = proto.Request != null?_ser.OtherMessageFromProto(proto.Request) : null; var timeout = new TimeSpan(proto.Timeout * TimeSpan.TicksPerMillisecond); var minCap = proto.HasConsistencyMinCap ? proto.ConsistencyMinCap : 0; IReadConsistency consistency; switch (proto.Consistency) { case 0: if (proto.HasConsistencyAdditional) { consistency = new ReadMajorityPlus(timeout, proto.ConsistencyAdditional, minCap); } else { consistency = new ReadMajority(timeout, minCap); } break; case -1: consistency = new ReadAll(timeout); break; case 1: consistency = ReadLocal.Instance; break; default: consistency = new ReadFrom(proto.Consistency, timeout); break; } return(new Get(key, consistency, request)); }
public SqlReader(IContext context, Field[] fields, ReadFrom readFrom) { _context = context; _connection = readFrom == ReadFrom.Output ? context.Process.Connections.First(c => c.Name == "output") : context.Process.Connections.First(c => c.Name == context.Entity.Connection); _tableOrView = readFrom == ReadFrom.Output ? context.Entity.OutputTableName(context.Process.Name) : context.Entity.Name; _fields = fields; _readFrom = readFrom; _rowCreator = new SqlRowCreator(context); }
public AdoReader(IContext context, Field[] fields, IConnectionFactory cf, IRowFactory rowFactory, ReadFrom readFrom) { _context = context; _cf = cf; _connection = readFrom == ReadFrom.Output ? context.Process.Connections.First(c => c.Name == "output") : context.Process.Connections.First(c => c.Name == context.Entity.Connection); _tableOrView = readFrom == ReadFrom.Output ? context.Entity.OutputTableName(context.Process.Name) : context.Entity.Name; _schemaPrefix = readFrom == ReadFrom.Output ? string.Empty : (context.Entity.Schema == string.Empty ? string.Empty : cf.Enclose(context.Entity.Schema) + "."); _filter = readFrom == ReadFrom.Output ? $"WHERE {cf.Enclose(_context.Entity.TflDeleted().FieldName())} != 1" : string.Empty; _fields = fields; _readFrom = readFrom; _rowCreator = new AdoRowCreator(context, rowFactory); }
public ElasticReader( IConnectionContext context, Field[] fields, IElasticLowLevelClient client, IRowFactory rowFactory, ReadFrom readFrom ) { _context = context; _fields = fields; _fieldNames = fields.Select(f => _readFrom == ReadFrom.Input ? f.Name : f.Alias.ToLower()).ToArray(); _client = client; _rowFactory = rowFactory; _readFrom = readFrom; _typeName = readFrom == ReadFrom.Input ? context.Entity.Name : context.Entity.Alias.ToLower(); }
public LuceneReader( IConnectionContext context, IEnumerable <Field> fields, SearcherFactory searcherFactory, Analyzer analyzer, IndexReaderFactory readerFactory, IRowFactory rowFactory, ReadFrom readFrom) { _context = context; _fields = fields; _searcherFactory = searcherFactory; _analyzer = analyzer; _readerFactory = readerFactory; _rowFactory = rowFactory; _readFrom = readFrom; }
public ReplicatorSpec(ReplicatorSpecConfig config) : base(config) { _config = config; _cluster = Cluster.Cluster.Get(Sys); var settings = ReplicatorSettings.Create(Sys).WithGossipInterval(TimeSpan.FromSeconds(1.0)).WithMaxDeltaElements(10); var props = Replicator.Props(settings); _replicator = Sys.ActorOf(props, "replicator"); _timeOut = Dilated(TimeSpan.FromSeconds(2.0)); _writeTwo = new WriteTo(2, _timeOut); _writeMajority = new WriteMajority(_timeOut); _writeAll = new WriteAll(_timeOut); _readTwo = new ReadFrom(2, _timeOut); _readMajority = new ReadMajority(_timeOut); _readAll = new ReadAll(_timeOut); }
protected ReplicatorSpec(ReplicatorSpecConfig config) : base(config, typeof(ReplicatorSpec)) { _config = config; _first = config.First; _second = config.Second; _third = config.Third; _cluster = Akka.Cluster.Cluster.Get(Sys); var settings = ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1.0)) .WithMaxDeltaElements(10); var props = Replicator.Props(settings); _replicator = Sys.ActorOf(props, "replicator"); _timeOut = Dilated(TimeSpan.FromSeconds(3.0)); _writeTwo = new WriteTo(2, _timeOut); _writeMajority = new WriteMajority(_timeOut); _writeAll = new WriteAll(_timeOut); _readTwo = new ReadFrom(2, _timeOut); _readMajority = new ReadMajority(_timeOut); _readAll = new ReadAll(_timeOut); }
public ReplicatorSpecs(ITestOutputHelper helper) : base(SpecConfig, helper) { _sys1 = Sys; _sys3 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _timeOut = Dilated(TimeSpan.FromSeconds(3.0)); _writeTwo = new WriteTo(2, _timeOut); _writeMajority = new WriteMajority(_timeOut); _writeAll = new WriteAll(_timeOut); _readTwo = new ReadFrom(2, _timeOut); _readMajority = new ReadMajority(_timeOut); _readAll = new ReadAll(_timeOut); var settings = ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1.0)) .WithMaxDeltaElements(10); var props = Replicator.Props(settings); _replicator1 = _sys1.ActorOf(props, "replicator"); _replicator2 = _sys2.ActorOf(props, "replicator"); _replicator3 = _sys3.ActorOf(props, "replicator"); }
/// <summary> /// 添加服务。将模块服务添加到依赖注入服务容器中 /// </summary> /// <param name="services">服务集合</param> public override IServiceCollection AddServices(IServiceCollection services) { //services.AddNLog(); // 同时输出2种方式的日志,可能存在重复 需要陆续兼容 Logs.Exceptionless.Extensions.AddExceptionless(services, o => { o.ApiKey = "ez9jumyxVxjTxqSm0oUQhCML3OGCkDfMGyW1hfmn"; o.ServerUrl = "http://10.186.132.40:5100"; }); //ExceptionlessClient.Default.Configuration.ApiKey= "ez9jumyxVxjTxqSm0oUQhCML3OGCkDfMGyW1hfmn"; //ExceptionlessClient.Default.Configuration.ServerUrl = "http://10.186.132.40:5100"; //ExceptionlessClient.Default.Startup(); services.AddLogging(loggingBuilder => { var configuration = services.GetConfiguration(); serilog.Log.Logger = new serilog.LoggerConfiguration() .Enrich.FromLogContext() .Enrich.WithLogContext() .Enrich.WithLogLevel() .Enrich.WithSpan() .WriteTo.Exceptionless(additionalOperation: (builder) => { if (builder.Target.Data.TryGetValue("TraceId", out var traceId)) { builder.Target.AddTags(traceId.ToString() ?? string.Empty); } builder.Target.AddTags((TraceIdContext.Current ??= new TraceIdContext(string.Empty)).TraceId); return(builder); }) .ReadFrom.Configuration(configuration) .ConfigLogLevel(configuration) .CreateLogger(); loggingBuilder.AddSerilog(); }); return(services); }
private string WriteQuery( IEnumerable <Field> fields, ReadFrom readFrom, IContext context, int from = 0, int size = 10 ) { var sb = new StringBuilder(); var sw = new StringWriter(sb); using (var writer = new JsonTextWriter(sw)) { writer.WriteStartObject(); writer.WritePropertyName("from"); writer.WriteValue(from); writer.WritePropertyName("size"); writer.WriteValue(size); writer.WritePropertyName("_source"); writer.WriteStartObject(); writer.WritePropertyName("includes"); writer.WriteStartArray(); foreach (var field in fields) { writer.WriteValue(readFrom == ReadFrom.Input ? field.Name : field.Alias.ToLower()); } writer.WriteEndArray(); writer.WriteEndObject(); if (readFrom == ReadFrom.Input) { if (context.Entity.Filter.Any(f => f.Value != "*")) { writer.WritePropertyName("query"); writer.WriteStartObject(); writer.WritePropertyName("constant_score"); writer.WriteStartObject(); writer.WritePropertyName("filter"); writer.WriteStartObject(); writer.WritePropertyName("bool"); writer.WriteStartObject(); writer.WritePropertyName("must"); writer.WriteStartArray(); foreach (var filter in context.Entity.Filter.Where(f => (f.Expression != string.Empty && f.Expression != "*") || (f.Value != "*" && f.Value != string.Empty)) ) { writer.WriteStartObject(); switch (filter.Type) { case "facet": if (filter.Value.Contains(",")) { writer.WritePropertyName("terms"); writer.WriteStartObject(); writer.WritePropertyName(filter.LeftField.Name); writer.WriteStartArray(); // values foreach (var value in filter.Value.Split(',')) { writer.WriteValue(value); } writer.WriteEndArray(); //values writer.WriteEndObject(); } else { writer.WritePropertyName("term"); writer.WriteStartObject(); writer.WritePropertyName(filter.LeftField.Name); writer.WriteValue(filter.Value); writer.WriteEndObject(); } break; case "range": break; default: //search if (filter.Expression == string.Empty) { if (_isQueryString.IsMatch(filter.Value)) { // query_string query writer.WritePropertyName("query_string"); writer.WriteStartObject(); // query_string writer.WritePropertyName("query"); writer.WriteValue(filter.Value); writer.WritePropertyName("default_field"); writer.WriteValue(filter.LeftField.Name); writer.WritePropertyName("analyze_wildcard"); writer.WriteValue(true); writer.WritePropertyName("default_operator"); writer.WriteValue("AND"); writer.WriteEnd(); // query_string } else { // match query writer.WritePropertyName("match"); writer.WriteStartObject(); // match writer.WritePropertyName(filter.LeftField.Name); writer.WriteStartObject(); // field name writer.WritePropertyName("query"); writer.WriteValue(filter.Value); writer.WritePropertyName("operator"); writer.WriteValue(filter.Continuation.ToLower()); writer.WriteEndObject(); // field name writer.WriteEndObject(); // match } } else { writer.WritePropertyName("query_string"); writer.WriteStartObject(); // query_string writer.WritePropertyName("query"); writer.WriteValue(filter.Expression); if (filter.Field != string.Empty) { writer.WritePropertyName("default_field"); writer.WriteValue(filter.LeftField.Name); } writer.WritePropertyName("analyze_wildcard"); writer.WriteValue(true); writer.WritePropertyName("default_operator"); writer.WriteValue("AND"); writer.WriteEnd(); // query_string } break; } writer.WriteEndObject(); //must } writer.WriteEndArray(); writer.WriteEndObject(); //bool writer.WriteEndObject(); //filter writer.WriteEndObject(); //constant_score writer.WriteEndObject(); //query } } else { writer.WritePropertyName("query"); writer.WriteStartObject(); writer.WritePropertyName("constant_score"); writer.WriteStartObject(); writer.WritePropertyName("filter"); writer.WriteStartObject(); writer.WritePropertyName("term"); writer.WriteStartObject(); writer.WritePropertyName("tfldeleted"); writer.WriteValue(false); writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); } if (context.Entity.Order.Any()) { writer.WritePropertyName("sort"); writer.WriteStartArray(); foreach (var orderBy in context.Entity.Order) { Field field; if (context.Entity.TryGetField(orderBy.Field, out field)) { var name = _readFrom == ReadFrom.Input ? field.SortField.ToLower() : field.Alias.ToLower(); writer.WriteStartObject(); writer.WritePropertyName(name); writer.WriteStartObject(); writer.WritePropertyName("order"); writer.WriteValue(orderBy.Sort); writer.WriteEndObject(); writer.WriteEndObject(); } } writer.WriteEndArray(); } if (_readFrom == ReadFrom.Input && context.Entity.Filter.Any(f => f.Type == "facet")) { writer.WritePropertyName("aggs"); writer.WriteStartObject(); foreach (var filter in context.Entity.Filter.Where(f => f.Type == "facet")) { writer.WritePropertyName(filter.Key); writer.WriteStartObject(); writer.WritePropertyName("terms"); writer.WriteStartObject(); writer.WritePropertyName("field"); writer.WriteValue(filter.LeftField.Name); writer.WritePropertyName("size"); writer.WriteValue(filter.Size); writer.WritePropertyName("min_doc_count"); writer.WriteValue(filter.Min); writer.WritePropertyName("order"); writer.WriteStartObject(); writer.WritePropertyName(filter.OrderBy); writer.WriteValue(filter.Order); writer.WriteEndObject(); //order writer.WriteEndObject(); // terms writer.WriteEndObject(); // the field name + _filter } writer.WriteEndObject(); //aggs } writer.WriteEndObject(); writer.Flush(); return(sb.ToString()); } }
private string WriteQuery( IEnumerable <Field> fields, ReadFrom readFrom, IContext context, int from = 0, int size = 10 ) { var sb = new StringBuilder(); var sw = new StringWriter(sb); using (var writer = new JsonTextWriter(sw)) { writer.WriteStartObject(); writer.WritePropertyName("from"); writer.WriteValue(from); writer.WritePropertyName("size"); writer.WriteValue(size); writer.WritePropertyName("_source"); writer.WriteStartObject(); writer.WritePropertyName("includes"); writer.WriteStartArray(); foreach (var field in fields) { writer.WriteValue(readFrom == ReadFrom.Input ? field.Name : field.Alias.ToLower()); } writer.WriteEndArray(); writer.WriteEndObject(); if (readFrom == ReadFrom.Input) { if (context.Entity.Filter.Any(f => f.Value != "*")) { writer.WritePropertyName("query"); writer.WriteStartObject(); writer.WritePropertyName("constant_score"); writer.WriteStartObject(); writer.WritePropertyName("filter"); writer.WriteStartObject(); writer.WritePropertyName("bool"); writer.WriteStartObject(); writer.WritePropertyName("must"); writer.WriteStartArray(); foreach (var filter in context.Entity.Filter.Where(f => f.Value != "*")) { writer.WriteStartObject(); writer.WritePropertyName("term"); writer.WriteStartObject(); writer.WritePropertyName(filter.LeftField.Name); writer.WriteValue(filter.Value); writer.WriteEndObject(); writer.WriteEndObject(); } writer.WriteEndArray(); writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); //query } } else { writer.WritePropertyName("query"); writer.WriteStartObject(); writer.WritePropertyName("constant_score"); writer.WriteStartObject(); writer.WritePropertyName("filter"); writer.WriteStartObject(); writer.WritePropertyName("term"); writer.WriteStartObject(); writer.WritePropertyName("tfldeleted"); writer.WriteValue(false); writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); writer.WriteEndObject(); } if (context.Entity.Order.Any()) { writer.WritePropertyName("sort"); writer.WriteStartArray(); foreach (var orderBy in context.Entity.Order) { Field field; if (context.Entity.TryGetField(orderBy.Field, out field)) { var name = _readFrom == ReadFrom.Input ? field.Name : field.Alias.ToLower(); writer.WriteStartObject(); writer.WritePropertyName(name); writer.WriteStartObject(); writer.WritePropertyName("order"); writer.WriteValue(orderBy.Sort); writer.WriteEndObject(); writer.WriteEndObject(); } } writer.WriteEndArray(); } if (_readFrom == ReadFrom.Input && context.Entity.Filter.Any(f => f.Type == "facet")) { writer.WritePropertyName("aggs"); writer.WriteStartObject(); foreach (var filter in context.Entity.Filter.Where(f => f.Type == "facet")) { writer.WritePropertyName(filter.Key); writer.WriteStartObject(); writer.WritePropertyName("terms"); writer.WriteStartObject(); writer.WritePropertyName("field"); writer.WriteValue(filter.LeftField.Name); writer.WritePropertyName("size"); writer.WriteValue(filter.Size); writer.WritePropertyName("min_doc_count"); writer.WriteValue(filter.Min); writer.WritePropertyName("order"); writer.WriteStartObject(); writer.WritePropertyName(filter.OrderBy); writer.WriteValue(filter.Order); writer.WriteEndObject(); //order writer.WriteEndObject(); // terms writer.WriteEndObject(); // the field name + _filter } writer.WriteEndObject(); //aggs } writer.WriteEndObject(); writer.Flush(); return(sb.ToString()); } }
private static Logger CreateLogger(string[] args) { var environment = GetEnvironment(); var configuration = GetConfiguration(); var basePath = GetBasePath(); var outputTemplate = "{Timestamp:HH:mm:ss.fff} [{Level:u4}] {ThreadName}#{ThreadId:000} ({SourceContext}) {Message}{NewLine}{Exception}"; return(new LoggerConfiguration() .WriteTo.Async(asyncConfig => { asyncConfig.Debug(outputTemplate: outputTemplate); asyncConfig.Console(outputTemplate: outputTemplate); asyncConfig.File( path: Path.Join(basePath, "logs\\Bidirectional.Demo.Server.-.log"), outputTemplate: outputTemplate, retainedFileCountLimit: 3, rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: false, shared: true ); }, bufferSize: 100_000, blockWhenFull: true) .ReadFrom.Configuration(configuration) .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithThreadId() .Enrich.WithThreadName() .CreateLogger()); string GetEnvironment() { return(new ConfigurationBuilder() .AddCommandLine(args) .AddEnvironmentVariables() .Build() .GetValue <string>("Environment") ?? ( DebugDetector.AreWeInDebugMode ? Environments.Development : Environments.Production )); } IConfigurationRoot GetConfiguration() { return(new ConfigurationBuilder() .SetBasePath(GetBasePath()) .AddJsonFile("appsettings.json", reloadOnChange: true, optional: false) .AddJsonFile($"appsettings.{environment}.json", reloadOnChange: true, optional: true) .AddJsonFile($"appsettings.{Environment.MachineName}.json", reloadOnChange: true, optional: true) .AddCommandLine(args) .AddEnvironmentVariables() .Build()); } string GetBasePath() { // When running as a Windows Service, the current directory will be C:\Windows\System32, so we must switch to the assembly directory return(WindowsServiceHelpers.IsWindowsService() ? AppContext.BaseDirectory : Directory.GetCurrentDirectory()); } }
public void OpenFormater(System.Windows.Forms.Label lbl_test) { Excel excel = new Excel(@"format", 3); Excel ReadFrom = new Excel(); try { Console.WriteLine("ok,cool"); int month = (int)excel.ReadCellD(0, 0); int year = (int)excel.ReadCellD(0, 1); bool newFile = false; bool make_changes = false; //Loads the File to read from if (month == 1) { int temp = year - 1; ReadFrom = new Excel(temp.ToString(), 12); newFile = true; } else { int temp = month - 1; ReadFrom = new Excel(year.ToString(), temp); } int change_row = 2; while (!excel.ReadCellS(change_row, 0).Equals("x")) { change_row++; } string[,] changes = new string[1, 1]; if (change_row != 2) { make_changes = true; changes = new string[change_row - 2, 5]; for (int i = 2; i < change_row; i++) { for (int a = 0; a < 5; a++) { changes[i - 2, a] = excel.ReadCellS(i, a); Console.WriteLine(changes[i - 2, a] + "|" + i + "|" + a); } if (excel.ReadCellS(i, 3).Equals("0")) { int dur = int.Parse(excel.ReadCellS(i, 4)); dur--; excel.WriteToCell(i, 4, dur.ToString()); } else { int start = int.Parse(excel.ReadCellS(i, 3)); start--; excel.WriteToCell(i, 3, start.ToString()); } } } excel.Save(); //load the format excel.changeWorksheet(1); //checks the row length int row = 0; while (!excel.ReadCellS(row, 0).Equals("x")) { row++; } int line = 0; //checks the line length while (!excel.ReadCellS(0, line).Equals("x")) { line++; } lbl_test.Text = row.ToString() + "|" + line.ToString(); //init all variables AllInfos = new string[row, line]; format = new string[row, line]; toLoad = new double[row, line]; calcInfo = new string[row, line]; //Loads the framework for the reader for (int i = 0; i < row; i++) { for (int a = 0; a < line; a++) { AllInfos[i, a] = excel.ReadCellS(i, a); } } //loads the information for the loading excel.changeWorksheet(2); for (int i = 0; i < row; i++) { for (int a = 0; a < line; a++) { calcInfo[i, a] = excel.ReadCellS(i, a); } } //loads the format bool AllFormats = true; int counter = 0; int lineFormat = 0; while (AllFormats) { int cur_counter = (int)excel.ReadCellD(row + lineFormat, 0); Console.WriteLine("hey" + cur_counter); for (int i = 0; i < cur_counter; i++) { for (int a = 0; a < line; a++) { Console.WriteLine(counter + "|" + i); format[counter, a] = excel.ReadCellS(row + lineFormat + 1, a); } counter++; } Console.WriteLine("hey" + cur_counter); lineFormat += 2; if (excel.ReadCellD(row + lineFormat, 0) == 0) { AllFormats = false; } } //load all the number for (int i = 0; i < row; i++) { for (int a = 1; a < line; a++) { Console.WriteLine(calcInfo[i, a]); if (!calcInfo[i, a].Equals("") && !calcInfo[i, a].Equals("gen_t")) { Console.WriteLine(i + "|" + a); toLoad[i, a] = ReadFrom.ReadCellD(i, a); Console.WriteLine(toLoad[i, a]); } } } Console.WriteLine(newFile); if (newFile) { ReadFrom = new Excel(); ReadFrom.changeWorksheetName(1, allMonths[0]); ReadFrom.SaveAs(year.ToString()); } else { Console.WriteLine("asdaf"); ReadFrom.CreateNewSheet(allMonths[month - 1]); ReadFrom.changeWorksheet(month); } if (make_changes) { for (int i = 0; i < change_row - 2; i++) { Console.WriteLine(i + "|" + change_row); if (changes[i, 3].Equals("0")) { int pos_x = int.Parse(changes[i, 0]); int pos_y = int.Parse(changes[i, 1]); if (calcInfo[pos_x, pos_y].Equals("load") || calcInfo[pos_x, pos_y].Equals("work")) { int start_y = pos_y; while (!calcInfo[pos_x, start_y].Equals("work")) { start_y--; } double[] allChanges = changeRate(pos_y - start_y, double.Parse(changes[i, 2]), toLoad[pos_x, start_y], toLoad[pos_x, start_y + 1], toLoad[pos_x, start_y + 2], toLoad[pos_x, start_y + 3], toLoad[pos_x, start_y + 4], toLoad[pos_x, start_y + 5]); toLoad[pos_x, start_y] = allChanges[0]; toLoad[pos_x, start_y + 1] = allChanges[1]; toLoad[pos_x, start_y + 2] = allChanges[2]; toLoad[pos_x, start_y + 3] = allChanges[3]; toLoad[pos_x, start_y + 4] = allChanges[4]; toLoad[pos_x, start_y + 5] = allChanges[5]; } else { Console.WriteLine(calcInfo[pos_x, pos_y]); double newWorth = double.Parse(calcInfo[pos_x, pos_y]); newWorth += double.Parse(changes[i, 2]); calcInfo[pos_x, pos_y] = newWorth.ToString(); } } } } double infaltion = 0; excel.changeWorksheet(3); for (int i = 0; i < row; i++) { for (int a = 0; a < line; a++) { ReadFrom.changeFormat(i, a, format[i, a].Substring(1)); double temp; ReadFrom.changeColor(i, a, returnColor(calcInfo[i, 0])); if (!AllInfos[i, a].Equals("")) { Console.WriteLine(AllInfos[i, a]); ReadFrom.WriteToCell(i, a, AllInfos[i, a]); } else if (calcInfo[i, a].StartsWith("!")) { if (calcInfo[i, a].StartsWith("!SUMME")) { ReadFrom.WriteToCell(i, a, convertSumme(calcInfo[i, a])); } else { ReadFrom.WriteToCell(i, a, "=" + calcInfo[i, a].Substring(1)); } } else if (double.TryParse(calcInfo[i, a], out temp)) { temp = manipulateChange(temp); double calculated = toLoad[i, a - 1] * (1 + temp); ReadFrom.WriteToCell(i, a, temp.ToString()); ReadFrom.WriteToCell(i, a - 1, calculated.ToString()); if (AllInfos[i, a - 2].Equals("Infaltion")) { infaltion = calculated; } } else if (calcInfo[i, a].Equals("work")) { ReadFrom.WriteToCell(i, a, toLoad[i, a].ToString()); ReadFrom.WriteToCell(i, a + 1, toLoad[i, a + 1].ToString()); ReadFrom.WriteToCell(i, a + 2, toLoad[i, a + 2].ToString()); ReadFrom.WriteToCell(i, a + 3, toLoad[i, a + 3].ToString()); ReadFrom.WriteToCell(i, a + 4, toLoad[i, a + 4].ToString()); ReadFrom.WriteToCell(i, a + 5, toLoad[i, a + 5].ToString()); } } //Console.WriteLine("lol"); } ReadFrom.Save(); Console.WriteLine(ReadFrom.ReadCellS(3, 1)); //Console.WriteLine("sdlliiki"); for (int i = 0; i < row; i++) { for (int a = 0; a < line; a++) { double temp; if (calcInfo[i, a].Equals("inf")) { if (!calcInfo[i, a - 2].Equals("calc")) { temp = ReadFrom.ReadCellD(i, a - 3); temp = temp * (1 + infaltion); ReadFrom.WriteToCell(i, a - 1, temp.ToString()); } } else if (calcInfo[i, a].Equals("calc")) { double read = ReadFrom.ReadCellD(i, a - 1); ReadFrom.WriteToCell(i, a, writeEquation(read, toLoad[i, a - 1]).ToString()); } } } ReadFrom.Save(); Console.WriteLine(ReadFrom.ReadCellS(3, 1)); for (int i = 0; i < row; i++) { for (int a = 0; a < line; a++) { if (calcInfo[i, a].Equals("inf")) { double read = ReadFrom.ReadCellD(i, a - 1); ReadFrom.WriteToCell(i, a, writeEquation(read, toLoad[i, a - 1]).ToString()); } } } ReadFrom.Save(); Console.WriteLine(ReadFrom.ReadCellS(3, 1)); excel.changeWorksheet(3); for (int i = 2; i < change_row; i++) { if (excel.ReadCellS(i, 3).Equals("0") && excel.ReadCellS(i, 4).Equals("0")) { for (int a = i; a < change_row + 1; a++) { for (int t = 0; t < 5; t++) { excel.WriteToCell(a, t, excel.ReadCellS(a + 1, t)); } } change_row--; i--; } } int mon = int.Parse(excel.ReadCellS(0, 0)); mon++; if (mon > 12) { int y = int.Parse(excel.ReadCellS(0, 1)); y++; excel.WriteToCell(0, 1, y.ToString()); mon = 1; } excel.WriteToCell(0, 0, mon.ToString()); excel.Save(); } catch (Exception e) { Console.Write(e.StackTrace); } finally { ReadFrom.close(); excel.close(); } }
public static ReadFrom <string> Twitter(this ReadFrom <string> readFrom, string handle) { return(null); }