Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
estape committed Nov 8, 2023
0 parents commit 4fed608
Show file tree
Hide file tree
Showing 1,316 changed files with 398,188 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
8 changes: 8 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application
x:Class="IMAC.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:IMAC"
StartupUri="MainWindow.xaml">
<Application.Resources />
</Application>
17 changes: 17 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace IMAC
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
22 changes: 22 additions & 0 deletions BackEnd/Base.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Security.Principal;

namespace IMAC.BackEnd
{
class Base
{
public static string BuildUrl(string lati, string longi)
{
string configPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "IMAC/config.cfg");
string baseUrl = "http://worldsatdobrasil.ddns.net:8081/cobertura_gsm/claro.php";
string operadora = "169094";
string ParamChar = "&";

string url = $"{baseUrl}?operadora={operadora}{ParamChar}latitude={lati}{ParamChar}longitude={longi}";

return url;
}
}
}
20 changes: 20 additions & 0 deletions BackEnd/GoogleLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace IMAC.BackEnd
{
class GoogleLink
{
public static (string, string) CallGoogleLink(string googleUrl)
{
int latiStartIndex = googleUrl.IndexOf("@") + 1; // Índice de início da latitude
int commaIndex = googleUrl.IndexOf(",", latiStartIndex); // Índice da vírgula após a latitude
string latiGoogle = googleUrl.Substring(latiStartIndex, commaIndex - latiStartIndex); // Extrai a latitude
int longiStartIndex = commaIndex + 1; // Índice do início da longitude
int commaIndex2 = googleUrl.IndexOf(",", longiStartIndex); // **Índice do início da string que contém o nível de zoom**
string longiGoogle = googleUrl.Substring(longiStartIndex, commaIndex2 - longiStartIndex - 1); // Extrai a longitude

_ = latiGoogle.Replace("@", ""); // Remove o caractere "@" do início da string da latitude
_ = longiGoogle.Replace(",", ""); // Remove a vírgula no final da longitude

return (latiGoogle, longiGoogle);
}
}
}
20 changes: 20 additions & 0 deletions BackEnd/LinkWeb.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace IMAC.BackEnd
{
class LinkWeb
{

public void CTA(string link, string Mlati, string Mlongi)
{
if (Mlati == "0" && Mlongi == "0")
{
(string lati, string longi) = GoogleLink.CallGoogleLink(link);
string FullUrl = Base.BuildUrl(lati, longi);
}

else
{
string FullUrl = Base.BuildUrl(Mlati, Mlongi);
}
}
}
}
126 changes: 126 additions & 0 deletions BackEnd/Updater.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Windows;

namespace IMAC.BackEnd
{
internal class Updater
{
public static void CallUpdate()
{
string MainUpdatePath = "@\\\\serverip\\f\\Servidor\\Rodrigo\\Programas\\IMAC";
string RuntimesUpdatePath = "@\\\\serverip\\f\\Servidor\\Rodrigo\\Programas\\IMAC\\runtimes\\win-x64\\native";
string MainPath = AppDomain.CurrentDomain.BaseDirectory;
string RuntimesPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "runtimes", "win-x64", "native");


string[] MainFiles = { "IMAC.exe", "IMAC.pdb", "WebView2Loader.dll" };
string[] RuntimesFiles = { "WebView2Loader.dll" };

int UpdateFlag = 0; //0 = Null, 1 = No Update, 2 = Parcial Update, 3 = Full Update
bool MainUpdateFlag = false;
bool RuntimesUpdateFlag = false;

if (Directory.Exists(MainUpdatePath) && Directory.Exists(RuntimesUpdatePath))
{
foreach (string file in MainFiles)
{
//Faz a validação dos arquivos do programa.
if (File.Exists(Path.Combine(MainUpdatePath, file)))
{
DateTime MainUpdateLast = File.GetLastWriteTime(Path.Combine(MainUpdatePath, file));
DateTime MainLast = File.GetLastWriteTime(Path.Combine(MainPath, file));
if (MainUpdateLast < MainLast)
{
MainUpdateFlag = true;
//call Program Updater...
Process UpdateBat = Process.Start(MainPath + "UpdateBatch.bat");
Thread.Sleep(1000);
Environment.Exit(1);
}

else
{
MainUpdateFlag = false;
}
}
else
{
MainUpdateFlag = false;
MessageBox.Show("Os arquivos não são validos, por favor refaça a instalação. Código: Flag 1", "Atualização", MessageBoxButton.OK, MessageBoxImage.Stop);
}
}

foreach (string file in RuntimesFiles)
{
if (File.Exists(Path.Combine(RuntimesUpdatePath, file)))
{
DateTime RUpdateLastEdit = File.GetLastWriteTime(Path.Combine(RuntimesUpdatePath, file));
DateTime RuntimesLastEdit = File.GetLastWriteTime(Path.Combine(RuntimesPath, file));
if (RUpdateLastEdit < RuntimesLastEdit)
{
RuntimesUpdateFlag = true;
//call Program Updater
}

else
{
RuntimesUpdateFlag = false;
}
}
else
{
RuntimesUpdateFlag = false;
MessageBox.Show("Os arquivos não são validos, por favor refaça a instalação. Código: Flag 2", "Atualização", MessageBoxButton.OK, MessageBoxImage.Stop);
}
}

if (MainUpdateFlag && RuntimesUpdateFlag)
{
// Atualização completa (ambos os componentes foram atualizados)
UpdateFlag = 3;
}
else if (MainUpdateFlag || RuntimesUpdateFlag)
{
// Atualização parcial (apenas um dos componentes foi atualizado)
UpdateFlag = 2;
}
else
{
// Nenhuma atualização encontrada
UpdateFlag = 1;
}

switch (UpdateFlag)
{
case 0:
MessageBox.Show("Erro fatal na atualização. Código: Flag 0", "Atualização", MessageBoxButton.OK, MessageBoxImage.Error);
break;

case 1:
MessageBox.Show("Nenhuma atualização foi encontrada.", "Atualização", MessageBoxButton.OK, MessageBoxImage.Warning);
break;

case 2:
MessageBox.Show("Atualização básica concluída.", "Atualização", MessageBoxButton.OK, MessageBoxImage.Information);
break;

case 3:
MessageBox.Show("Atualização completa concluída.", "Atualização", MessageBoxButton.OK, MessageBoxImage.Information);
break;

default:
MessageBox.Show("Erro desconhecido na atualização. Código: Flag FF", "Atualização", MessageBoxButton.OK, MessageBoxImage.Error);
break;
}
}

else
{
MessageBox.Show("Não foi possivel localizar as pastas de destino", "Atualização", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
}
Binary file added GPS_Icon_256x256.ico
Binary file not shown.
19 changes: 19 additions & 0 deletions IMAC.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>GPS_Icon_256x256.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Content Include="GPS_Icon_256x256.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1823.32" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions IMAC.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_LastSelectedProfileId>C:\Users\Rodrigo\OneDrive - Cruzeiro do Sul Educacional - Acadêmico\Documentos\Game_Dev\VisualStudio\IMAC\IMAC\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId>
</PropertyGroup>
<ItemGroup>
<ApplicationDefinition Update="App.xaml">
<SubType>Designer</SubType>
</ApplicationDefinition>
</ItemGroup>
<ItemGroup>
<Page Update="MainWindow.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
</Project>
54 changes: 54 additions & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:IMAC"
xmlns:Wpf="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" x:Class="IMAC.MainWindow"
mc:Ignorable="d"
Title="IMAC - Interface de Mapa de Área de Cobertura" Height="720" Width="1280">
<Grid>
<StackPanel>
<Menu x:Name="BarraMenu" Height="20" Background="White">
<MenuItem x:Name="Menu" Header="Menu">
<Button x:Name="Btn_Atualizar" Content="Atualizar" Background="{x:Null}" Click="BtnUpdateImac"/>
</MenuItem>
<MenuItem x:Name="Ferramentas" Header="Ferramentas">
<Button x:Name="Btn_LimparCache" Content="Limpar Cache"/>
</MenuItem>
</Menu>
<Grid x:Name="Search" Height="52" Width="800" Margin="0,9,0,22">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="TXT__Title" TextWrapping="Wrap" Text="Link" Foreground="#FF1362E4" FontWeight="Bold" FontSize="20" Margin="10,0,613,9" VerticalAlignment="Top" HorizontalAlignment="Right"/>
<TextBox x:Name="GMapsInput" TextWrapping="Wrap" Text="Cole o link do Google Maps aqui..." BorderBrush="#FFC7C7C7" Foreground="#FFA7A7A7" FontSize="14" Panel.ZIndex="1" Background="White" Margin="192,0,186,23" VerticalContentAlignment="Center" GotFocus="GMapsInput_GotFocus" LostFocus="GMapsInput_LostFocus"/>
<Button x:Name="Btn_Gmap" Content="Localizar" Margin="620,1,100,25" BorderBrush="#FF2A587B" Background="#FF1362E4" Foreground="White" Click="Button_Click"/>
<TextBox x:Name="LatiInput" TextWrapping="Wrap" Text="Latitude" BorderBrush="#FFC7C7C7" Foreground="#FFA7A7A7" FontSize="14" Panel.ZIndex="1" Background="White" Margin="192,0,402,23" VerticalContentAlignment="Center" GotFocus="LatiInput_GotFocus" LostFocus="LatiInput_LostFocus" HorizontalContentAlignment="Center"/>
<TextBox x:Name="LongiInput" TextWrapping="Wrap" Text="Longitude" BorderBrush="#FFC7C7C7" Foreground="#FFA7A7A7" FontSize="14" Panel.ZIndex="1" Background="White" Margin="403,0,186,23" VerticalContentAlignment="Center" GotFocus="LongiInput_GotFocus" LostFocus="LongiInput_LostFocus" HorizontalContentAlignment="Center"/>
<Button x:Name="Btn_LatiLongi" Content="Localizar" Margin="620,1,100,25" BorderBrush="#FF2A587B" Background="#FF1362E4" Foreground="White" Click="Btn_LatiLongi_Click"/>
<CheckBox Content="Avançado" Margin="192,31,537,2" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked"/>
</Grid>
</StackPanel>
<Wpf:WebView2 x:Name="WebXAML" Margin="20,90,20,120" Source="http://worldsatdobrasil.ddns.net:8081/cobertura_gsm/claro.php?operadora=169094&amp;latitude=-23.018781830198083&amp;longitude=-46.9779966686927"/>
<Viewbox x:Name="ViewB" Stretch="Uniform" Margin="0,604,1001,0">
<Grid x:Name="Legenda" HorizontalAlignment="Left" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="605*"/>
<RowDefinition Height="31*"/>
<RowDefinition Height="68*"/>
</Grid.RowDefinitions>
<Border x:Name="Heat5g" BorderBrush="Black" BorderThickness="1" Margin="42,0,0,18" Background="#FFC792EF" Grid.RowSpan="2" HorizontalAlignment="Left" Width="20" Height="18" VerticalAlignment="Bottom"/>
<TextBlock x:Name="TextHeat5g" TextWrapping="Wrap" Text="Cobertura 5G" Margin="74,0,0,19" VerticalAlignment="Bottom" Grid.RowSpan="2" HorizontalAlignment="Left" Width="76"/>
<Border x:Name="Heat4g" BorderBrush="Black" BorderThickness="1" Margin="42,0,0,59" Background="#FFD5777B" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="20" Height="18" VerticalAlignment="Bottom"/>
<TextBlock x:Name="TextHeat4g" TextWrapping="Wrap" Text="Cobertura 4G" Margin="74,0,0,60" VerticalAlignment="Bottom" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Left" Width="76"/>
<Border x:Name="Heat3g" BorderBrush="Black" BorderThickness="1" Margin="42,0,0,32" Background="#FFF1A16B" Grid.Row="2" HorizontalAlignment="Left" Width="20" Height="18" VerticalAlignment="Bottom"/>
<TextBlock x:Name="TextHeat3g" TextWrapping="Wrap" Text="Cobertura 3G" Margin="74,0,0,33" VerticalAlignment="Bottom" Grid.Row="2" HorizontalAlignment="Left" Width="76"/>
<Border x:Name="Heat5g_Copy" BorderBrush="Black" BorderThickness="1" Margin="162,0,0,18" Background="#FFCFE68B" Grid.RowSpan="2" HorizontalAlignment="Left" Width="20" Height="18" VerticalAlignment="Bottom"/>
<TextBlock x:Name="TextHeat5g_Copy" TextWrapping="Wrap" Text="Cobertura 2G" Margin="194,0,0,19" Grid.RowSpan="2" HorizontalAlignment="Left" Width="86" Height="16" VerticalAlignment="Bottom"/>
<Border x:Name="HeatGSM" BorderBrush="Black" BorderThickness="1" Margin="162,0,0,59" Background="#FF9D9B98" Grid.Row="1" Grid.RowSpan="2" Height="18" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="20"/>
<TextBlock x:Name="TextHeatGSM" TextWrapping="Wrap" Margin="194,0,0,60" Text="Cobertura GSM" Grid.Row="1" Grid.RowSpan="2" Height="16" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="86"/>
</Grid>
</Viewbox>
</Grid>
</Window>
Loading

0 comments on commit 4fed608

Please sign in to comment.