Commit 5235c843 authored by shubham's avatar shubham

Wrapped up with 3 modules

parent 61aa971d
......@@ -14,7 +14,7 @@ namespace Personal_Insight.ComputeProduct
private GoogleProductModel googleProduct;
private IntroPage_5 page;
public GoogleProductModel GoogleProduct { get => googleProduct; set => googleProduct = value; }
public List<Devices> devicesList;
public List<Device> devicesList;
public Android_Device_Configuration_Service()
{
......@@ -31,11 +31,26 @@ namespace Personal_Insight.ComputeProduct
private void gatherDevices()
{
devicesList = new List<Devices>();
devicesList = new List<Device>();
string[] files = Directory.GetFiles(googleProduct.ProductFolderPath);
foreach(String file in files)
{
page.enterLog(file);
String fileText = File.ReadAllText(file);
String model = fileText.Substring(fileText.IndexOf("Model: "));
model = model.Substring(0, model.IndexOf("<br/>"));
String manufacturer = fileText.Substring(fileText.IndexOf("Manufacturer: "));
manufacturer = manufacturer.Substring(0, manufacturer.IndexOf("<br/>"));
String iMEI = fileText.Substring(fileText.IndexOf("IMEI(s): "));
iMEI = iMEI.Substring(0, iMEI.IndexOf("<br/>"));
String lastConnection = fileText.Substring(fileText.IndexOf("Time of Last Data Connection: "));
lastConnection = lastConnection.Substring(0, lastConnection.IndexOf("<br/>"));
devicesList.Add(new Device(model, manufacturer, iMEI, lastConnection));
page.enterLog("["+model+","+manufacturer+","+iMEI+","+lastConnection+"]");
}
}
......@@ -47,17 +62,19 @@ namespace Personal_Insight.ComputeProduct
page.enterLog("Num of files: " + googleProduct.NumItems);
}
public class Devices
public class Device
{
public String Model { get; set; }
public String Brand { get; set; }
public String Manufacturer { get; set; }
public String IMEI { get; set; }
public String LastConnection { get; set; }
public Devices(string model, string brand, string iMEI)
public Device(string model, string manufacturer, string iMEI, string lastConnection)
{
Model = model;
Brand = brand;
Manufacturer = manufacturer;
IMEI = iMEI;
LastConnection = lastConnection;
}
}
}
......
using Personal_Insight.Models;
using Personal_Insight.Pages;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
namespace Personal_Insight.ComputeProduct
{
class Assistant_Notes_and_Lists
{
private GoogleProductModel googleProduct;
private IntroPage_5 page;
public GoogleProductModel GoogleProduct { get => googleProduct; set => googleProduct = value; }
public List<ShoppingList> shoppingList_list;
public Assistant_Notes_and_Lists()
{
}
public void startWork(IntroPage_5 page)
{
this.page = page;
page.enterLog("Starting work on Assistant_Notes_and_Lists");
calculate_numFiles();
gatherData();
}
private void gatherData()
{
shoppingList_list = new List<ShoppingList>();
string[] files = Directory.GetFiles(googleProduct.ProductFolderPath);
foreach (String file in files)
{
string[] lines = File.ReadAllLines(file);
int listItems = 0;
foreach (string line in lines)
listItems++;
listItems -= 3; //Removing the first 3 lines as they are not needed
String fileText = File.ReadAllText(file);
int checkedItems = new Regex(Regex.Escape("Checked")).Matches(fileText).Count;
int uncheckedItems = new Regex(Regex.Escape("Unchecked")).Matches(fileText).Count;
shoppingList_list.Add(new ShoppingList(listItems, checkedItems, uncheckedItems));
//page.enterLog(listItems + "," + checkedItems + "," + uncheckedItems);
}
}
private void calculate_numFiles()
{
string[] files = Directory.GetFiles(googleProduct.ProductFolderPath);
googleProduct.NumItems = files.Length;
page.enterLog("Num of files: " + googleProduct.NumItems);
}
public class ShoppingList
{
public int ListItems { get; set; }
public int CheckedItems { get; set; }
public int UncheckedItems { get; set; }
public ShoppingList(int listItems, int checkedItems, int uncheckedItems)
{
ListItems = listItems;
CheckedItems = checkedItems;
UncheckedItems = uncheckedItems;
}
}
}
}
using Personal_Insight.Models;
using Personal_Insight.Pages;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Personal_Insight.ComputeProduct
{
class Blogger
{
private GoogleProductModel googleProduct;
private IntroPage_5 page;
public GoogleProductModel GoogleProduct { get => googleProduct; set => googleProduct = value; }
public List<Blog> blogList;
public Blogger()
{
}
public void startWork(IntroPage_5 page)
{
this.page = page;
page.enterLog("Starting work on Blogger");
calculate_numFiles();
gatherData();
}
private void gatherData()
{
blogList = new List<Blog>();
string[] dirs = Directory.GetDirectories(googleProduct.ProductFolderPath+ "\\Blogs");
foreach (String dir in dirs)
{
string[] files = Directory.GetFiles(dir);
foreach(String file in files)
{
if (file.Contains("settings.csv"))
{
String[] lines = File.ReadAllLines(file);
//Get the second line of the CSV
String blogAdmin = lines[1];
String blogName = lines[1];
String blogURL = lines[1];
//ADMIN
int index = blogAdmin.IndexOf(",");
blogAdmin = blogAdmin.Substring(index + 1);
blogAdmin = blogAdmin.Remove(blogAdmin.IndexOf(","));
//NAME
for(int i=0; i<38; i++)
{
index = blogName.IndexOf(",");
blogName = blogName.Substring(index + 1);
}
blogName = blogName.Remove(blogName.IndexOf(","));
//URL
for (int i = 0; i < 50; i++)
{
index = blogURL.IndexOf(",");
blogURL = blogURL.Substring(index + 1);
}
blogURL = blogURL.Remove(blogURL.IndexOf(","));
blogURL = blogName + ".blogspot.com";
blogList.Add(new Blog(blogURL, blogName, blogAdmin));
page.enterLog("Name: "+blogName+", URL: "+blogURL+", Admin: " + blogAdmin);
}
}
}
}
private void calculate_numFiles()
{
string[] dirs = Directory.GetDirectories(googleProduct.ProductFolderPath + "\\Blogs");
googleProduct.NumItems = dirs.Length;
page.enterLog("Num of blogs: " + googleProduct.NumItems);
}
public class Blog
{
public String blogURL { get; set; }
public String blogName { get; set; }
public String blogAdmin { get; set; }
public Blog(string blogURL, string blogName, string blogAdmin)
{
this.blogURL = blogURL;
this.blogName = blogName;
this.blogAdmin = blogAdmin;
}
}
}
}
using Personal_Insight.Models;
using Personal_Insight.Pages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Personal_Insight.ComputeProduct
{
class YouTube
{
private GoogleProductModel googleProduct;
private IntroPage_5 page;
public GoogleProductModel GoogleProduct { get => googleProduct; set => googleProduct = value; }
public List<Device> devicesList;
public YouTube()
{
}
public void startWork(IntroPage_5 page)
{
this.page = page;
page.enterLog("Starting work on YouTube");
}
public class Device
{
}
}
}
......@@ -65,217 +65,174 @@ namespace Personal_Insight.Models
{
case ADCS:
fileName = "ADCS";
productObject = new Android_Device_Configuration_Service();
break;
case ANL:
fileName = "ANL";
productObject = new Android_Device_Configuration_Service();
break;
case Blogger:
fileName = "Blogger";
productObject = new Android_Device_Configuration_Service();
break;
case Bookmarks:
fileName = "Bookmarks";
productObject = new Android_Device_Configuration_Service();
break;
case Calendar:
fileName = "Calendar";
productObject = new Android_Device_Configuration_Service();
break;
case Chrome:
fileName = "Chrome";
productObject = new Android_Device_Configuration_Service();
break;
case GPC:
fileName = "GPC";
productObject = new Android_Device_Configuration_Service();
break;
case Contacts:
fileName = "Contacts";
productObject = new Android_Device_Configuration_Service();
break;
case CP:
fileName = "CP";
productObject = new Android_Device_Configuration_Service();
break;
case CS:
fileName = "CS";
productObject = new Android_Device_Configuration_Service();
break;
case Drive:
fileName = "Drive";
productObject = new Android_Device_Configuration_Service();
break;
case Fit:
fileName = "Fit";
productObject = new Android_Device_Configuration_Service();
break;
case GC:
fileName = "GC";
productObject = new Android_Device_Configuration_Service();
break;
case GMB:
fileName = "GMB";
productObject = new Android_Device_Configuration_Service();
break;
case GPay:
fileName = "GPay";
productObject = new Android_Device_Configuration_Service();
break;
case GPB:
fileName = "GPB";
productObject = new Android_Device_Configuration_Service();
break;
case GPGS:
fileName = "GPGS";
productObject = new Android_Device_Configuration_Service();
break;
case GPhotos:
fileName = "GPhotos";
productObject = new Android_Device_Configuration_Service();
break;
case GPlusS:
fileName = "GPlusS";
productObject = new Android_Device_Configuration_Service();
break;
case GPM:
fileName = "GPM";
productObject = new Android_Device_Configuration_Service();
break;
case GPMTV:
fileName = "GPMTV";
productObject = new Android_Device_Configuration_Service();
break;
case GPS:
fileName = "GPS";
productObject = new Android_Device_Configuration_Service();
break;
case GS:
fileName = "GS";
productObject = new Android_Device_Configuration_Service();
break;
case GSM:
fileName = "GSM";
productObject = new Android_Device_Configuration_Service();
break;
case GW:
fileName = "GW";
productObject = new Android_Device_Configuration_Service();
break;
case HA:
fileName = "HA";
productObject = new Android_Device_Configuration_Service();
break;
case Hangouts:
fileName = "Hangouts";
productObject = new Android_Device_Configuration_Service();
break;
case Keep:
fileName = "Keep";
productObject = new Android_Device_Configuration_Service();
break;
case LH:
fileName = "LH";
productObject = new Android_Device_Configuration_Service();
break;
case MA:
fileName = "MA";
productObject = new Android_Device_Configuration_Service();
break;
case Mail:
fileName = "Mail";
productObject = new Android_Device_Configuration_Service();
break;
case Maps:
fileName = "Maps";
productObject = new Android_Device_Configuration_Service();
break;
case MapsYP:
fileName = "MapsYP";
productObject = new Android_Device_Configuration_Service();
break;
case News:
fileName = "News";
productObject = new Android_Device_Configuration_Service();
break;
case PR:
fileName = "PR";
productObject = new Android_Device_Configuration_Service();
break;
case Profile:
fileName = "Profile";
productObject = new Android_Device_Configuration_Service();
break;
case Reminders:
fileName = "Reminders";
productObject = new Android_Device_Configuration_Service();
break;
case Saved:
fileName = "Saved";
productObject = new Android_Device_Configuration_Service();
break;
case SL:
fileName = "SL";
productObject = new Android_Device_Configuration_Service();
break;
case Tasks:
fileName = "Tasks";
productObject = new Android_Device_Configuration_Service();
break;
case Voice:
fileName = "Voice";
productObject = new Android_Device_Configuration_Service();
break;
case YouTube:
fileName = "YouTube";
productObject = new Android_Device_Configuration_Service();
break;
default:
fileName = "NotFound";
productObject = new Android_Device_Configuration_Service();
break;
}
......@@ -291,17 +248,22 @@ namespace Personal_Insight.Models
switch (productName)
{
case ADCS:
productObject = new Android_Device_Configuration_Service();
((Android_Device_Configuration_Service) productObject ).GoogleProduct = googleProductModel;
((Android_Device_Configuration_Service)productObject).startWork(page);
((Android_Device_Configuration_Service) productObject).startWork(page);
break;
case ANL:
productObject = new Android_Device_Configuration_Service();
productObject = new Assistant_Notes_and_Lists();
((Assistant_Notes_and_Lists) productObject).GoogleProduct = googleProductModel;
((Assistant_Notes_and_Lists) productObject).startWork(page);
break;
case Blogger:
productObject = new Android_Device_Configuration_Service();
productObject = new Blogger();
((Blogger)productObject).GoogleProduct = googleProductModel;
((Blogger)productObject).startWork(page);
break;
case Bookmarks:
......
......@@ -73,7 +73,7 @@ namespace Personal_Insight.Pages
private void product_worker(GoogleProductModel product)
{
enterLog("Working on module: " + product.ProductName + " in path, " + product.ProductFolderPath + "\n");
enterLog("Working on module: " + product.ProductName + " in path, " + product.ProductFolderPath);
enterLog("The size is " + HelpfulMethods.DirSize(new DirectoryInfo(product.ProductFolderPath)) + "bytes");
//Starting worker
......
......@@ -112,6 +112,9 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="ComputeProduct\Android Device Configuration Service.cs" />
<Compile Include="ComputeProduct\Assistant Notes and Lists.cs" />
<Compile Include="ComputeProduct\Blogger.cs" />
<Compile Include="ComputeProduct\YouTube.cs" />
<Compile Include="Models\GoogleProductModel.cs" />
<Compile Include="Models\GoogleProductsList.cs" />
<Compile Include="Models\HelpfulMethods.cs" />
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment