Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SyncManager sm = new SyncManager();
            sm.Start();
            return;
            string path = Request.PhysicalApplicationPath;

            // if (!ClientScript.IsStartupScriptRegistered("JSScript"))
            {
                APIServiceProviderNamespace.main.projectsDataTable dt = DBModule.GetProjects();

                string treejs = "";
                treejs += "var treeItems, rootItem, rootItemElement;\r\n";

                int j = 0;

                foreach (APIServiceProviderNamespace.main.projectsRow pr in dt.Rows)
                {
                    treejs += "$('#jqxTree').jqxTree('addTo', { label: '" + pr.name + "', id:'" + pr.id.ToString() + "' });\r\n";
                    treejs += "treeItems = $(\"#jqxTree\").jqxTree('getItems');\r\n";
                    treejs += "rootItem = treeItems[" + j.ToString() + "];\r\n";
                    treejs += "rootItemElement = rootItem.element;\r\n";

                    APIServiceProviderNamespace.main.campaignsDataTable cdt = DBModule.GetCampaignsByProjectID(pr.id);

                    foreach (APIServiceProviderNamespace.main.campaignsRow cr in cdt.Rows)
                    {
                        treejs += "$('#jqxTree').jqxTree('addTo', { label: '" + cr.name + "', id:'" + cr.id.ToString() + "' }, rootItemElement);\r\n\r\n";
                        j++;
                    }

                    j++;
                }

                //treejs += "</script>";
                string js = System.IO.File.ReadAllText(path + "\\ui\\ui_tpl.js");
                js = js.Replace("{[(TREE)]}", treejs);
                System.IO.File.WriteAllText(path + "\\ui\\ui.js", js);

                //ClientScript.RegisterStartupScript(this.GetType(), "JSScript", js);
            }

            //Response.Redirect("index.html");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            float R = 255;
            float G = 255;
            float B = 255;

            float y = 0.299f * R + 0.587f * G + 0.114f * B;
            float cb = -0.168736f * R - 0.331264f * G + 0.50000f * B;
            float cr = 0.50000f * R - 0.41869f * G - 0.08131f * B;

            /*Assembly asm = Assembly.LoadFrom("D:\\Hayk\\Work\\Office\\Clients\\Vizerra\\Tatev_Animation\\Assets\\Plugins\\theorawrapper.dll");
            Type[] t = asm.GetTypes();*/

            /*var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);
            provider.ClientIdentifier = "783795063122.apps.googleusercontent.com";
            provider.ClientSecret = "_OQKo8_narny3sSrFcgCBWQV";
            var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthentication);
            //auth.LoadAccessToken();
            AnalyticsService analyticsService = new AnalyticsService(auth);


            Accounts accounts = analyticsService.Management.Accounts.List().Fetch();

            Profiles profiles = analyticsService.Management.Profiles.List("~all", "~all").Fetch();

            Profile profile = profiles.Items[0];

            float ff = 1000000.4564f;


            Google.Apis.Analytics.v3.DataResource.GaResource.GetRequest gr = analyticsService.Data.Ga.Get("ga:" + profile.Id, "2012-08-22", "2012-09-21", "ga:visits,ga:visitBounceRate,ga:avgTimeOnSite,ga:percentNewVisits,ga:pageviewsPerVisit");
            gr.Dimensions = "ga:source";
            Google.Apis.Analytics.v3.Data.GaData data = gr.Fetch();*/

            float f = float.Parse("9.414285714285715");

            /*int totalclicks = 0;

            XmlDocument xml = new XmlDocument();
            for (int i = 0; i < 18; i++)
            {
                xml.Load("D:\\Hayk\\Work\\Vigen\\fitmedia\\WSStatusChecker\\bin\\Debug\\sep\\getreport_" + i.ToString() + ".xml");
                XmlElement root = xml["report"];

                XmlElement cid = root["campaignID"];

                XmlElement stat = root["stat"];

                int clicks = 0;

                foreach (XmlNode node in stat.ChildNodes)
                {
                    XmlAttribute att = node.Attributes["clicks"];
                    clicks += int.Parse(att.Value);
                }

                totalclicks += clicks;

                System.IO.File.WriteAllText("D:\\Hayk\\Work\\Vigen\\fitmedia\\WSStatusChecker\\bin\\Debug\\sep\\getreport_" + i.ToString() + ".txt", cid.InnerText + "\r\n" + clicks.ToString());
            }

            System.IO.File.WriteAllText("D:\\Hayk\\Work\\Vigen\\fitmedia\\WSStatusChecker\\bin\\Debug\\sep\\getreport_total.txt", totalclicks.ToString());
            return;*/

            SyncManager sm = new SyncManager();
            sm.Start();
     

            try
            {
                ServiceController sc = new ServiceController("Fitmedia Sync");

                switch (sc.Status)
                {
                    case ServiceControllerStatus.Running:
                        Console.WriteLine("Running");
                        break;
                    case ServiceControllerStatus.Stopped:
                        Console.WriteLine("Stopped"); break;
                    case ServiceControllerStatus.Paused:
                        Console.WriteLine("Paused"); break;
                    case ServiceControllerStatus.StopPending:
                        Console.WriteLine("Stopping"); break;
                    case ServiceControllerStatus.StartPending:
                        Console.WriteLine("Starting"); break;
                    default:
                        Console.WriteLine("Status Changing"); break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.Write("Press any key to close...");
            Console.ReadKey();

        }
Exemplo n.º 3
0
       /* private static IAuthorizationState GetAuthorization(NativeApplicationClient arg)
        {
            // Get the auth URL:
            IAuthorizationState state = new AuthorizationState(new[] { AnalyticsService.Scopes.AnalyticsReadonly.ToString() });
            state.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
            Uri authUri = arg.RequestUserAuthorization(state);

            // Request authorization from the user (by opening a browser window):
            Process.Start(authUri.ToString());
            Console.Write("  Authorization Code: ");
            string authCode = Console.ReadLine();
            Console.WriteLine();

            // Retrieve the access token by using the authorization code:
            return arg.ProcessUserAuthorization(authCode, state);
        }*/

        protected void Page_Load(object sender, EventArgs e)
        {
            /*var provider = new NativeApplicationClient(GoogleAuthenticationServer.Description);
            provider.ClientIdentifier = "753811298394-qn5uqbhjk83tq5osjqnp7jmdu3b1eggf.apps.googleusercontent.com";
            provider.ClientSecret = "-2hRIom9w9g_kuRLeNLTw26n";
            var auth = new OAuth2Authenticator<NativeApplicationClient>(provider, GetAuthorization);

            AnalyticsService aservice = new AnalyticsService(auth);

            //aservice.Key = "AIzaSyC1O0Dq8KVBJEaOTe2HFV9940_xQfinN3Y";
            //aservice.CreateRequest("sss", "ddd");
            Accounts res = aservice.Management.Accounts.List().Fetch();

            return;*/

            /*string s = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><aaa>&D</aaa>";
            s = HttpUtility.UrlEncode(s);
            XmlDocument xml = new XmlDocument();
            xml.LoadXml(s);*/

            //XmlDocument xml = new XmlDocument();
            //XmlNode nd = xml.CreateNode(XmlNodeType.Text, "hhh", null);


            DateTime d = new DateTime(2012, 7, 30, 1, 59, 59);
            DateTime d1 = new DateTime(2012, 7, 30, 2, 59, 58);
            TimeSpan ts = d1 - d;

            TimeSpan ts1 = new TimeSpan(590000000);

            int aa = 01;

            bool b = (0.99 > 0.991);

            SyncManager sm = new SyncManager();
            sm.Start();
            return;
            string path = Request.PhysicalApplicationPath;

            // if (!ClientScript.IsStartupScriptRegistered("JSScript"))
            {
                APIServiceProviderNamespace.main.projectsDataTable dt = DBModule.GetProjects();

                string treejs = "";
                treejs += "var treeItems, rootItem, rootItemElement;\r\n";

                int j = 0;

                foreach (APIServiceProviderNamespace.main.projectsRow pr in dt.Rows)
                {
                    treejs += "$('#jqxTree').jqxTree('addTo', { label: '" + pr.name + "', id:'" + pr.id.ToString() + "' });\r\n";
                    treejs += "treeItems = $(\"#jqxTree\").jqxTree('getItems');\r\n";
                    treejs += "rootItem = treeItems[" + j.ToString() + "];\r\n";
                    treejs += "rootItemElement = rootItem.element;\r\n";

                    APIServiceProviderNamespace.main.campaignsDataTable cdt = DBModule.GetCampaignsByProjectID(pr.id);

                    foreach (APIServiceProviderNamespace.main.campaignsRow cr in cdt.Rows)
                    {
                        treejs += "$('#jqxTree').jqxTree('addTo', { label: '" + cr.name + "', id:'" + cr.id.ToString() + "' }, rootItemElement);\r\n\r\n";
                        j++;
                    }

                    j++;
                }

                //treejs += "</script>";
                string js = System.IO.File.ReadAllText(path + "\\ui\\ui_tpl.js");
                js = js.Replace("{[(TREE)]}", treejs);
                System.IO.File.WriteAllText(path + "\\ui\\ui.js", js);

                //ClientScript.RegisterStartupScript(this.GetType(), "JSScript", js);
            }

            //Response.Redirect("index.html");
        }
Exemplo n.º 4
0
        public bool LoadProjects(SyncManager manager, Project.LoadOptions lo)
        {
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            if (!System.IO.Directory.Exists(path.Replace("file:\\", "") + "\\projects")) return false;

            string[] files = System.IO.Directory.GetFiles(path.Replace("file:\\", "") + "\\projects", "*.xml");

            if (lo == Project.LoadOptions.All)
                items.Clear();

            for (int i = 0; i < files.Length; i++)
            {
                Project prj = null;
                if (lo == Project.LoadOptions.All)
                {
                    prj = new Project();
                    prj.XmlFileName = files[i];
                    items.Add(prj);
                }
                else
                    for (int j = 0; j < items.Count; j++)
                        if (((Project)items[j]).XmlFileName == files[i])
                            prj = (Project)items[j];

                if (prj == null)
                {
                    prj = new Project();
                    prj.XmlFileName = files[i];
                    items.Add(prj);
                }

                if (!prj.LoadFromXML(files[i], lo))
                {
                    items.Clear();
                    return false;
                }

                prj.Manager = manager;
                prj.DbId = DBModule.AddProject(prj.Name, prj.Id, prj.StartFrom);

                foreach(object k in prj.Coefs.Keys)
                {
                    ProjectCoef pc = (ProjectCoef)prj.Coefs[k.ToString()];
                    if (pc != null)
                    {
                        APIServiceProvider sp = (APIServiceProvider)SyncManager.Providers.ServiceProviders[pc.ProviderName];
                        DBModule.AddCoef(prj.DbId, pc.CoefDate, pc.CoefValue, sp.ServiceProviderType);
                    }
                }
            }

            return true;
        }
Exemplo n.º 5
0
        public bool LoadProjects(SyncManager manager)
        {
            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
            if (!System.IO.Directory.Exists(path.Replace("file:\\", "") + "\\projects")) return false;

            string[] files = System.IO.Directory.GetFiles(path.Replace("file:\\", "") + "\\projects", "*.xml");

            items.Clear();

            for (int i = 0; i < files.Length; i++)
            {
                Project prj = new Project();
                if (!prj.LoadFromXML(files[i]))
                {
                    items.Clear();
                    return false;
                }

                prj.Manager = manager;
                prj.DbId = DBModule.AddProject(prj.Name, prj.Id, prj.StartFrom);

                items.Add(prj);
            }

            return true;
        }