Example #1
0
 // Use this for initialization
 void Start()
 {
     rend          = Info.GetComponent <Renderer>();
     rend.enabled  = false;
     rend2         = Info1.GetComponent <Renderer>();
     rend2.enabled = false;
     rend3         = Info2.GetComponent <Renderer>();
     rend3.enabled = false;
     rend4         = Info3.GetComponent <Renderer>();
     rend4.enabled = false;
 }
Example #2
0
        private static void DisplayInfo2(Info2 info)
        {
            if (_fluentCommandLineParser.Object.Quiet == false)
            {
                _logger.Warn($"Source file: {info.SourceName}");

                _logger.Info("");
                _logger.Info($"Version: {info.Version}");

                _logger.Info("");
                _logger.Warn("File records");
            }

            foreach (var infoFileRecord in info.FileRecords)
            {
                var fn = infoFileRecord.FileNameAscii;
                if (infoFileRecord.FileNameUnicode.IsNullOrEmpty() == false)
                {
                    fn = infoFileRecord.FileNameUnicode;
                }

                var csv = new CsvOut
                {
                    FileSize   = infoFileRecord.FileSize,
                    FileName   = fn,
                    SourceName = info.SourceName,
                    DeletedOn  = infoFileRecord.DeletedOn.ToUniversalTime()
                                 .ToString(_fluentCommandLineParser.Object.DateTimeFormat),
                    FileType = "INFO2"
                };


                _csvOuts.Add(csv);

                if (_fluentCommandLineParser.Object.Quiet)
                {
                    continue;
                }

                _logger.Info($"Index: {infoFileRecord.Index}");
                _logger.Info($"Drive #: {infoFileRecord.DriveNumber}");
                _logger.Info($"File size: {infoFileRecord.FileSize} ({BytesToString(infoFileRecord.FileSize)})");

                _logger.Info($"File name: {fn}");

                _logger.Fatal(
                    $"Deleted on: {infoFileRecord.DeletedOn.ToUniversalTime().ToString(_fluentCommandLineParser.Object.DateTimeFormat)}");

                _logger.Info("");
            }
        }
Example #3
0
        private Info2 ExtractLine2(string line)
        {
            Info2 info = new Info2();
            var   a    = line.Split(':');

            info.password = a[1].Trim();
            var b = a[0].Split(' ');

            info.c = b[1][0];
            var c = b[0].Trim().Split('-').Select(x => int.Parse(x)).ToArray();

            info.a = c[0];
            info.b = c[1];
            return(info);
        }
Example #4
0
    private static void DisplayInfo2(Info2 info, bool q, string dt)
    {
        if (q == false)
        {
            Log.Information("Source file: {SourceName}", info.SourceName);

            Console.WriteLine();
            Log.Information("Version: {Version}", info.Version);

            Console.WriteLine();
            Log.Information("File records");
        }

        foreach (var infoFileRecord in info.FileRecords)
        {
            var fn = infoFileRecord.FileNameAscii;
            if (infoFileRecord.FileNameUnicode.IsNullOrEmpty() == false)
            {
                fn = infoFileRecord.FileNameUnicode;
            }

            var csv = new CsvOut
            {
                FileSize   = infoFileRecord.FileSize,
                FileName   = fn,
                SourceName = info.SourceName,
                DeletedOn  = infoFileRecord.DeletedOn.ToUniversalTime()
                             .ToString(dt),
                FileType = "INFO2"
            };
            _csvOuts.Add(csv);

            if (q)
            {
                continue;
            }

            Log.Information("Index: {Index}", infoFileRecord.Index);
            Log.Information("Drive #: {DriveNumber}", infoFileRecord.DriveNumber);
            Log.Information("File size: {FileSize:N0} ({Size})", infoFileRecord.FileSize, BytesToString(infoFileRecord.FileSize));

            Log.Information("File name: {Fn}", fn);

            Log.Information("Deleted on: {DeletedOn}", infoFileRecord.DeletedOn);

            Console.WriteLine();
        }
    }
Example #5
0
        public void Info2Test()
        {
            var infoPath = Path.Combine(BasePath, "WinXp - mueller1", "INFO2");

            var i2 = new Info2(File.ReadAllBytes(infoPath), infoPath);

            i2.Version.Should().Be(5);
            i2.FileEntrySize.Should().Be(800);
            i2.Unknown3.Should().Be(0);

            foreach (var i2FileRecord in i2.FileRecords)
            {
                i2FileRecord.FileNameAscii.Should().NotBeNullOrEmpty();
                i2FileRecord.FileNameUnicode.Should().NotBeNullOrEmpty();

                Debug.WriteLine(i2FileRecord);
            }
        }
Example #6
0
        private DispatcherTimer readDataTimer = new DispatcherTimer();//通讯定时器类
        public SetWindow()
        {
            InitializeComponent();
            //CpuInfo1.SetBinding(TextBlock.TextProperty, new Binding("MaxTime_SchedLock") { Source = DataList });
            //CpuInfo2.SetBinding(TextBlock.TextProperty, new Binding("MaxTime_interrupt") { Source = DataList });
            //CpuInfo3.SetBinding(TextBlock.TextProperty, new Binding("CpuClikFreq") { Source = DataList });
            //CpuInfo4.SetBinding(TextBlock.TextProperty, new Binding("TaskCtxSwCtr") { Source = DataList });
            //CpuInfo5.SetBinding(TextBlock.TextProperty, new Binding("UcosVer") { Source = DataList });
            //CpuInfo6.SetBinding(TextBlock.TextProperty, new Binding("CPU_Usage") { Source = DataList });
            CpuInfo7.SetBinding(TextBlock.TextProperty, new Binding("CPU_MaxUsage")
            {
                Source = DataList
            });

            Info1.SetBinding(TextBlock.TextProperty, new Binding("Info1")
            {
                Source = DataList
            });
            Info2.SetBinding(TextBlock.TextProperty, new Binding("Info2")
            {
                Source = DataList
            });
            Info3.SetBinding(TextBlock.TextProperty, new Binding("Info3")
            {
                Source = DataList
            });
            Info4.SetBinding(TextBlock.TextProperty, new Binding("Info4")
            {
                Source = DataList
            });
            myGauge2.SetBinding(CircularGaugeControl.DialTextProperty, new Binding("CPU_Usage")
            {
                Source = DataList
            });
            myGauge2.SetBinding(CircularGaugeControl.CurrentValueProperty, new Binding("CPU_Usage")
            {
                Source = DataList
            });

            readDataTimer.Tick += new EventHandler(ShowCurTimer);//起个Timer一直获取当前时间
                        readDataTimer.Interval = new TimeSpan(0, 0, 0, 1, 0);

            readDataTimer.Start();
        }
Example #7
0
        private static void ProcessFile(string file)
        {
            try
            {
                var raw = File.ReadAllBytes(file);

                if (raw[0] == 1 || raw[0] == 2)
                {
                    var di = new DollarI(raw, file);

                    DisplayDollarI(di);
                }
                else if (raw[0] == 5)
                {
                    var info = new Info2(raw, file);

                    DisplayInfo2(info);
                }
                else
                {
                    _logger.Warn(
                        $"Unknown header '0x{raw[0]:X}! Send file to [email protected] so support can be added");
                    _failedFiles.Add(file);
                }

                if (_fluentCommandLineParser.Object.Quiet == false)
                {
                    _logger.Info("");
                }
            }
            catch (UnauthorizedAccessException ua)
            {
                _logger.Error(
                    $"Unable to access '{_fluentCommandLineParser.Object.File}'. Are you running as an administrator? Error: {ua.Message}");
                _failedFiles.Add(file);
            }
            catch (Exception ex)
            {
                _failedFiles.Add(file);
                _logger.Error(
                    $"Error processing file '{_fluentCommandLineParser.Object.File}' Please send it to [email protected]. Error: {ex.Message}");
            }
        }
Example #8
0
        static public List <string> GetList(Type _type, string _field = "")
        {
            var result = new List <string>();

            try
            {
                Assembly    assembly = Assembly.GetExecutingAssembly();
                List <Type> types    = assembly.GetTypes().Where(t => (_type.IsAssignableFrom(t))).ToList();

                foreach (Type info1 in types)
                {
                    FieldInfo[] field = info1.GetFields();
                    int         i     = 0;
                    foreach (FieldInfo Info2 in field)
                    {
                        if (_field == "string")
                        {
                            if (Info2.FieldType == typeof(string))
                            {
                                dynamic dynamic = Info2.GetValue(_type);
                                if (!String.IsNullOrWhiteSpace(dynamic))
                                {
                                    result.Add(dynamic);
                                }
                            }
                        }
                        else if (_field == "")
                        {
                            if (Info2.Name != "value__")
                            {
                                dynamic dynamic = Info2.GetValue(_type);
                                result.Add(dynamic);
                            }
                        }
                    }
                }
            }
            catch (Exception _e)
            {
                Log.ShowMessage("Expection", _e.Message);
            }
            return(result);
        }
Example #9
0
    private static void ProcessFile(string file, bool q, string dt)
    {
        try
        {
            var raw = File.ReadAllBytes(file);

            if (raw[0] == 1 || raw[0] == 2)
            {
                var di = new DollarI(raw, file);

                DisplayDollarI(di, dt, q);
            }
            else if (raw[0] == 5)
            {
                var info = new Info2(raw, file);

                DisplayInfo2(info, q, dt);
            }
            else
            {
                Log.Warning(
                    "Unknown header 0x{Raw:X}! Send file to {Email} so support can be added", raw[0], "*****@*****.**");
                _failedFiles.Add(file);
            }

            if (q == false)
            {
                Console.WriteLine();
            }
        }
        catch (UnauthorizedAccessException ua)
        {
            Log.Error(ua,
                      "Unable to access {File}. Are you running as an administrator? Error: {Message}", file, ua.Message);
            _failedFiles.Add(file);
        }
        catch (Exception ex)
        {
            _failedFiles.Add(file);
            Log.Error(ex,
                      "Error processing file {File} Please send it to {Email}. Error: {Message}", file, "*****@*****.**", ex.Message);
        }
    }
Example #10
0
        public void TestMethod5()
        {
            var source = @"
 [
  [""Jack Smith"",""22.33.44.55:6666""],
  [""John Doe"",""22.33.44.11:6666""]
  ]			
			
			"            ;

            var a = Info2.Parse(source);


            foreach (var k in a)
            {
                Console.WriteLine(new { k.Name, k.Target });
            }

            // talk about dynamic contexts... :)
            Console.WriteLine(Info2.ToString(a.ToArray()));
        }
Example #11
0
            public static Info2[] Parse(string source)
            {
                var a = new ArrayList();

                JSONDocument.ParseMatrix(source,
                                         delegate
                {
                    var n = new Info2();

                    a.Add(n);

                    return(new JSONDocument.ParseArguments[]
                    {
                        (JSONDocument.StringAction)(Name => n.Name = Name),
                        (JSONDocument.StringAction)(Target => n.Target = Target)
                    });
                }
                                         );

                return((Info2[])a.ToArray(typeof(Info2)));
            }
Example #12
0
			public static string ToString(Info2[] a)
			{
				return JSONDocument.ToString(
					delegate
					{
						var i = -1;

						return delegate
						{
							i++;

							if (i < a.Length)
							{
								var c = a[i];

								return new[] { c.Name, c.Target };
							}

							return null;
						};
					}
				);
			}
Example #13
0
			public static Info2[] Parse(string source)
			{
				var a = new ArrayList();

				JSONDocument.ParseMatrix(source,
					delegate
					{
						var n = new Info2();

						a.Add(n);

						return new JSONDocument.ParseArguments[] 
							{
								(JSONDocument.StringAction)(Name => n.Name = Name),
								(JSONDocument.StringAction)(Target => n.Target = Target)
							};
					}
				);

				return (Info2[])a.ToArray(typeof(Info2));
			}
Example #14
0
            public static ClsResultado ImportarCSVConvierteAEntidad(String ruta, Func <List <List <String> >,
                                                                                       List <Dictionary <String, String> >, ClsResultado> DelegadoValidaCamposParaImportacion,
                                                                    Func <Dictionary <String, String>, List <Object> > DelegadoConvierteListaAEntidad,
                                                                    ref IEnumerable <Object> ListaDeEntidad)
            {
                ClsResultado          Resultado    = new ClsResultado(true, String.Empty);
                List <ClsResultado>   lstResultado = new List <ClsResultado>();
                List <List <String> > Info         = new List <List <String> >();
                List <List <String> > Info2        = new List <List <String> >();
                List <List <String> > Info3        = new List <List <String> >();
                List <List <String> > InfoTemp     = new List <List <String> >();

                try
                {
                    Info3 = ImportarCSV(ruta);
                    if (Info3.Count > 1)
                    {
                        Info3.RemoveAt(0);
                    }
                    else
                    {
                        Resultado.Resultado = false;
                        Resultado.Mensaje   = "Los datos del archivo no pudieron ser validados debido a que vienen vacios, verifique";
                    }
                }
                catch (Exception e)
                {
                    Resultado.Resultado = false;
                    Resultado.Mensaje   = e.Message;
                }
                Info.Add(Info3.FirstOrDefault());
                Info2.Add(Info3.FirstOrDefault());
                int RegistrosDescatados = 0;

                try
                {
                    bool          Encontrado = false;
                    List <Object> lista      = new List <Object>();
                    foreach (var elem1 in Info3)
                    {
                        Encontrado = false;
                        foreach (var elem2 in Info2)
                        {
                            if (ComparaLista(elem1, elem2))
                            {
                                Encontrado = true;
                                break;
                            }
                        }
                        bool FilaConContenido = false;
                        foreach (var celda in elem1)
                        {
                            if (!String.IsNullOrEmpty(celda))
                            {
                                FilaConContenido = true;
                                break;
                            }
                        }
                        if (!FilaConContenido)
                        {
                            break;
                        }
                        if (!Encontrado)
                        {
                            Info.Add(elem1);
                            Info2 = new List <List <String> >();
                            Info2.AddRange(Info);
                        }
                        RegistrosDescatados = Info3.Count() - Info.Count();
                        List <Dictionary <String, String> > lstInfo = new List <Dictionary <String, String> >();
                        InfoTemp = new List <List <String> >();
                        InfoTemp.Add(elem1);
                        Resultado = DelegadoValidaCamposParaImportacion(InfoTemp, lstInfo);
                        if (lstInfo.FirstOrDefault().ContainsKey("Secuencial"))
                        {
                            lstInfo.FirstOrDefault()["Secuencial"] = Info2.Count().ToString();
                        }
                        lstResultado.Add(Resultado);
                        if (lstInfo.Count() > 0)
                        {
                            foreach (var item in lstInfo)
                            {
                                lista.AddRange(DelegadoConvierteListaAEntidad(item));
                            }
                        }
                        else
                        {
                            Resultado.Resultado = false;
                            Resultado.Mensaje   = "Informacion a validar no es valida para ser capturada";
                        }
                    }
                    if (lista.Count > 0)
                    {
                        ListaDeEntidad = lista;
                    }
                    if (lstResultado.Exists(x => x.Resultado == false))
                    {
                        Resultado = ClsResultado.ValidaLista(lstResultado);
                    }
                    else
                    {
                        Resultado.Mensaje = "Archivo listo para cargar";
                    }
                    return(Resultado);
                }
                catch (Exception e)
                {
                }
                return(new ClsResultado());
            }