private List<OutlookMailBox> GetOutlookMailBoxes(Folders rootFolders)
        {
            var mailBoxes = new List<OutlookMailBox>();
            if (rootFolders.Count > 0)
            {
                foreach (Folder rootFolder in rootFolders)
                {
                    var mailBoxName = rootFolder.Name;

                    //All mailBoxes Scanned Leave Public calendars and Folders
                    if (mailBoxName.Contains("Public Folders"))
                    {
                        Marshal.FinalReleaseComObject(rootFolder);
                        continue;
                    }

                    var mailBox = new OutlookMailBox
                    {
                        Name = mailBoxName,
                        EntryId = rootFolder.EntryID,
                        StoreId = rootFolder.StoreID
                    };
                    mailBoxes.Add(mailBox);

                    GetTaskLists(rootFolder, mailBox.Folders);

                    Marshal.FinalReleaseComObject(rootFolder);
                }
            }
            return mailBoxes;
        }
Ejemplo n.º 2
0
 static void ListFolders(int level, Folders coll)
 {
     foreach (MAPIFolder childFolder in coll)
     {
         Console.WriteLine("{0}{1}", new String(' ', level), childFolder.FullFolderPath);
         ListFolders(level + 1, childFolder.Folders);
     }
 }
Ejemplo n.º 3
0
 public object FromXml(XStreamReader reader, UnmarshallingContext context)
 {
     var folders = new Folders();
     var count = reader.NoOfChildren();
     reader.MoveDown();
     for (var i = 0; i < count; i++) {
         folders.Add((Folder) context.ConvertAnother());
         reader.MoveNext();
     }
     reader.MoveUp();
     return folders;
 }
Ejemplo n.º 4
0
        static MAPIFolder Find(string path, Folders folders)
        {
            foreach (MAPIFolder childFolder in folders)
            {
                if (childFolder.FullFolderPath == path)
                    return childFolder;

                MAPIFolder found = Find(path, childFolder.Folders);
                if (found != null) return found;
            }

            return null;
        }
Ejemplo n.º 5
0
        public void CompileAndLoadScripts(Folders folders)
        {
            Init();
            string languageExtension = "*.cs";

            List<string> filesToCompile = new List<string>();
            if (Directory.Exists(folders.EntitiesFolder))
                filesToCompile.AddRange(Directory.GetFiles(folders.EntitiesFolder, languageExtension, SearchOption.AllDirectories));
            if (Directory.Exists(folders.NodeFolder))
                filesToCompile.AddRange(Directory.GetFiles(folders.NodeFolder, languageExtension, SearchOption.AllDirectories));
            if (Directory.Exists(folders.LogicFolder))
                filesToCompile.AddRange(Directory.GetFiles(folders.LogicFolder, languageExtension, SearchOption.AllDirectories));

            CodeDomProvider provider = new CSharpCodeProvider();
            CompilerParameters compilerParameters = new CompilerParameters();

            compilerParameters.GenerateExecutable = false;
            compilerParameters.GenerateInMemory = true;
            #if DEBUG
            compilerParameters.IncludeDebugInformation = true;
            #else
            parameters.IncludeDebugInformation = false;
            #endif
            // TODO: Add more references
            compilerParameters.ReferencedAssemblies.Add("System.dll");

            var assemblies = AppDomain.CurrentDomain.GetAssemblies().Select(a => a.Location);
            foreach (var assemblyPath in assemblies)
            {
                compilerParameters.ReferencedAssemblies.Add(assemblyPath);
            }

            CompilerResults results = provider.CompileAssemblyFromFile(compilerParameters, filesToCompile.ToArray());

            // Log compilation result
            foreach (var item in results.Output)
            {
                Console.WriteLine(item);
            }

            if (results.CompiledAssembly != null)
            {
                LoadGameAssembly(results.CompiledAssembly);
            }
        }
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            #region settings
            // check for settings upgrade after outlook update
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }

            // check if we have settings
            if (Properties.Settings.Default.MeetingDeclineRules == null)
            {
                Properties.Settings.Default.MeetingDeclineRules = new Dictionary <string, DeclineRuleSetting>();
                Properties.Settings.Default.Save();
            }
            if (Properties.Settings.Default.LastMailCheck == null)
            {
                Properties.Settings.Default.LastMailCheck = new Dictionary <string, DateTime>();
                Properties.Settings.Default.Save();
            }
            #endregion

            // make sure that a deleted folder removes the meetingdecline rule
            Folder deletedItemsFolder = (Folder)Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderDeletedItems);
            DeletedItemsFolder            = deletedItemsFolder.Folders; // keep a reference at class level so it wont be GCed and event handler lost
            DeletedItemsFolder.FolderAdd += DeletedItems_FolderAdd;

            // enumerate non user folder entry ids for later
            #region hashes
            Array    systemFolders = Enum.GetValues(typeof(OlDefaultFolders));
            string[] customFolders = new string[] { "Yammer Root", "Files", "Conversation History", "Social Activity Notifications", "Scheduled", "Quick Step Settings", "Archive", "Conversation Action Settings" };
            SystemFoldersIDs = new int[systemFolders.Length + customFolders.Length];
            int i;
            for (i = 0; i < systemFolders.Length; i++)
            {
                try
                {
                    SystemFoldersIDs[i] = this.Application.Session.DefaultStore.GetDefaultFolder((OlDefaultFolders)systemFolders.GetValue(i))
                                          .EntryID.GetHashCode();
                }
                catch { } // not all folders from OlDefaultFolders exist in outlook
            }
            for (; i < customFolders.Length + systemFolders.Length; i++)
            {
                try
                {
                    SystemFoldersIDs[i] = this.Application.Session.DefaultStore.GetRootFolder()
                                          .Folders[customFolders[i - systemFolders.Length]].EntryID.GetHashCode();
                }
                catch { } // being a hardcoded list, we can't be 100% sure it always exists from app to app
            }
            #endregion

            // timer thread for handling new mails in folders
            NewMailPeriodicTask.Run(new TimeSpan(0, 1, 0), CancelationTokenSource.Token); // TODO: make interval configurable?

            // register to process exit event for cleanup
            AppDomain.CurrentDomain.ProcessExit += Addin_ProcessExit;
        }
Ejemplo n.º 7
0
 static void ListFolders(Folders coll)
 {
     ListFolders(0, coll);
 }
Ejemplo n.º 8
0
        private void InitSave()
        {
            var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async() =>
            {
                if (_lastAction.LastActionWasRecent())
                {
                    return;
                }
                _lastAction = DateTime.UtcNow;

                if (!_connectivity.IsConnected)
                {
                    AlertNoConnection();
                    return;
                }

                if (string.IsNullOrWhiteSpace(NameCell.Entry.Text))
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
                                                                                      AppResources.Name), AppResources.Ok);
                    return;
                }

                var cipher = new Cipher
                {
                    Name     = NameCell.Entry.Text.Encrypt(),
                    Notes    = string.IsNullOrWhiteSpace(NotesCell.Editor.Text) ? null : NotesCell.Editor.Text.Encrypt(),
                    Favorite = FavoriteCell.On,
                    Type     = _type
                };

                switch (_type)
                {
                case CipherType.Login:
                    cipher.Login = new Login
                    {
                        Username = string.IsNullOrWhiteSpace(LoginUsernameCell.Entry.Text) ? null :
                                   LoginUsernameCell.Entry.Text.Encrypt(),
                        Password = string.IsNullOrWhiteSpace(LoginPasswordCell.Entry.Text) ? null :
                                   LoginPasswordCell.Entry.Text.Encrypt(),
                        Totp = string.IsNullOrWhiteSpace(LoginTotpCell.Entry.Text) ? null :
                               LoginTotpCell.Entry.Text.Encrypt(),
                    };

                    Helpers.ProcessUrisSectionForSave(UrisSection, cipher);
                    break;

                case CipherType.SecureNote:
                    cipher.SecureNote = new SecureNote
                    {
                        Type = SecureNoteType.Generic
                    };
                    break;

                case CipherType.Card:
                    string brand;
                    switch (CardBrandCell.Picker.SelectedIndex)
                    {
                    case 1:
                        brand = "Visa";
                        break;

                    case 2:
                        brand = "Mastercard";
                        break;

                    case 3:
                        brand = "Amex";
                        break;

                    case 4:
                        brand = "Discover";
                        break;

                    case 5:
                        brand = "Diners Club";
                        break;

                    case 6:
                        brand = "JCB";
                        break;

                    case 7:
                        brand = "Maestro";
                        break;

                    case 8:
                        brand = "UnionPay";
                        break;

                    case 9:
                        brand = "Other";
                        break;

                    default:
                        brand = null;
                        break;
                    }

                    var expMonth = CardExpMonthCell.Picker.SelectedIndex > 0 ?
                                   CardExpMonthCell.Picker.SelectedIndex.ToString() : null;

                    cipher.Card = new Card
                    {
                        CardholderName = string.IsNullOrWhiteSpace(CardNameCell.Entry.Text) ? null :
                                         CardNameCell.Entry.Text.Encrypt(),
                        Number = string.IsNullOrWhiteSpace(CardNumberCell.Entry.Text) ? null :
                                 CardNumberCell.Entry.Text.Encrypt(),
                        ExpYear = string.IsNullOrWhiteSpace(CardExpYearCell.Entry.Text) ? null :
                                  CardExpYearCell.Entry.Text.Encrypt(),
                        Code = string.IsNullOrWhiteSpace(CardCodeCell.Entry.Text) ? null :
                               CardCodeCell.Entry.Text.Encrypt(),
                        Brand    = string.IsNullOrWhiteSpace(brand) ? null : brand.Encrypt(),
                        ExpMonth = string.IsNullOrWhiteSpace(expMonth) ? null : expMonth.Encrypt(),
                    };
                    break;

                case CipherType.Identity:
                    string title;
                    switch (IdTitleCell.Picker.SelectedIndex)
                    {
                    case 1:
                        title = AppResources.Mr;
                        break;

                    case 2:
                        title = AppResources.Mrs;
                        break;

                    case 3:
                        title = AppResources.Ms;
                        break;

                    case 4:
                        title = AppResources.Dr;
                        break;

                    default:
                        title = null;
                        break;
                    }

                    cipher.Identity = new Identity
                    {
                        Title     = string.IsNullOrWhiteSpace(title) ? null : title.Encrypt(),
                        FirstName = string.IsNullOrWhiteSpace(IdFirstNameCell.Entry.Text) ? null :
                                    IdFirstNameCell.Entry.Text.Encrypt(),
                        MiddleName = string.IsNullOrWhiteSpace(IdMiddleNameCell.Entry.Text) ? null :
                                     IdMiddleNameCell.Entry.Text.Encrypt(),
                        LastName = string.IsNullOrWhiteSpace(IdLastNameCell.Entry.Text) ? null :
                                   IdLastNameCell.Entry.Text.Encrypt(),
                        Username = string.IsNullOrWhiteSpace(IdUsernameCell.Entry.Text) ? null :
                                   IdUsernameCell.Entry.Text.Encrypt(),
                        Company = string.IsNullOrWhiteSpace(IdCompanyCell.Entry.Text) ? null :
                                  IdCompanyCell.Entry.Text.Encrypt(),
                        SSN = string.IsNullOrWhiteSpace(IdSsnCell.Entry.Text) ? null :
                              IdSsnCell.Entry.Text.Encrypt(),
                        PassportNumber = string.IsNullOrWhiteSpace(IdPassportNumberCell.Entry.Text) ? null :
                                         IdPassportNumberCell.Entry.Text.Encrypt(),
                        LicenseNumber = string.IsNullOrWhiteSpace(IdLicenseNumberCell.Entry.Text) ? null :
                                        IdLicenseNumberCell.Entry.Text.Encrypt(),
                        Email = string.IsNullOrWhiteSpace(IdEmailCell.Entry.Text) ? null :
                                IdEmailCell.Entry.Text.Encrypt(),
                        Phone = string.IsNullOrWhiteSpace(IdPhoneCell.Entry.Text) ? null :
                                IdPhoneCell.Entry.Text.Encrypt(),
                        Address1 = string.IsNullOrWhiteSpace(IdAddress1Cell.Entry.Text) ? null :
                                   IdAddress1Cell.Entry.Text.Encrypt(),
                        Address2 = string.IsNullOrWhiteSpace(IdAddress2Cell.Entry.Text) ? null :
                                   IdAddress2Cell.Entry.Text.Encrypt(),
                        Address3 = string.IsNullOrWhiteSpace(IdAddress3Cell.Entry.Text) ? null :
                                   IdAddress3Cell.Entry.Text.Encrypt(),
                        City = string.IsNullOrWhiteSpace(IdCityCell.Entry.Text) ? null :
                               IdCityCell.Entry.Text.Encrypt(),
                        State = string.IsNullOrWhiteSpace(IdStateCell.Entry.Text) ? null :
                                IdStateCell.Entry.Text.Encrypt(),
                        PostalCode = string.IsNullOrWhiteSpace(IdPostalCodeCell.Entry.Text) ? null :
                                     IdPostalCodeCell.Entry.Text.Encrypt(),
                        Country = string.IsNullOrWhiteSpace(IdCountryCell.Entry.Text) ? null :
                                  IdCountryCell.Entry.Text.Encrypt()
                    };
                    break;

                default:
                    break;
                }

                if (FolderCell.Picker.SelectedIndex > 0)
                {
                    cipher.FolderId = Folders.ElementAt(FolderCell.Picker.SelectedIndex - 1).Id;
                }

                Helpers.ProcessFieldsSectionForSave(FieldsSection, cipher);

                await _deviceActionService.ShowLoadingAsync(AppResources.Saving);
                var saveTask = await _cipherService.SaveAsync(cipher);
                await _deviceActionService.HideLoadingAsync();

                if (saveTask.Succeeded)
                {
                    _deviceActionService.Toast(AppResources.NewItemCreated);
                    if (_fromAutofill)
                    {
                        _googleAnalyticsService.TrackExtensionEvent("CreatedCipher");
                    }
                    else
                    {
                        _googleAnalyticsService.TrackAppEvent("CreatedCipher");
                    }

                    if (_fromAutofillFramework)
                    {
                        // close and go back to app
                        _deviceActionService.CloseAutofill();
                    }
                    else
                    {
                        await Navigation.PopForDeviceAsync();
                    }
                }
                else if (saveTask.Errors.Count() > 0)
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, saveTask.Errors.First().Message, AppResources.Ok);
                }
                else
                {
                    await DisplayAlert(null, AppResources.AnErrorHasOccurred, AppResources.Ok);
                }
            }, ToolbarItemOrder.Default, 0);

            ToolbarItems.Add(saveToolBarItem);
        }
Ejemplo n.º 9
0
 public Folder(Folders f)
 {
     CurrentFolder = f;
 }
        private void findCalendars(Folders folders, Dictionary<string, MAPIFolder> calendarFolders, MAPIFolder defaultCalendar) {
            string excludeDeletedFolder = folders.Application.Session.GetDefaultFolder(OlDefaultFolders.olFolderDeletedItems).EntryID;
            foreach (MAPIFolder folder in folders) {
                try {
                    OlItemType defaultItemType = folder.DefaultItemType;
                    if (defaultItemType == OlItemType.olAppointmentItem) {
                        if (defaultCalendar == null ||
                            (folder.EntryID != defaultCalendar.EntryID))
                            calendarFolders.Add(folder.Name, folder);
                    }
                    if (folder.EntryID != excludeDeletedFolder && folder.Folders.Count > 0) {
                        findCalendars(folder.Folders, calendarFolders, defaultCalendar);
                    }

                } catch (System.Exception ex) {
                    if (oApp.Session.ExchangeConnectionMode.ToString().Contains("Disconnected") ||
                        ex.Message.StartsWith("Network problems are preventing connection to Microsoft Exchange.")) {
                            log.Info("Currently disconnected from Exchange - unable to retrieve MAPI folders.");
                        MainForm.Instance.ToolTips.SetToolTip(MainForm.Instance.cbOutlookCalendars,
                            "The Outlook calendar to synchonize with.\nSome may not be listed as you are currently disconnected.");
                    } else {
                        log.Error("Failed to recurse MAPI folders.");
                        log.Error(ex.Message);
                        MessageBox.Show("A problem was encountered when searching for Outlook calendar folders.",
                            "Calendar Folders", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void DrawSelf(Graphics g, Rectangle bounds, bool selected)
        {
            controls = new List <FLIControl>();
            Size bigSize = new Size(int.MaxValue, int.MaxValue);

            Point p = new Point(bounds.Left + itemBorder.Left, bounds.Top + itemBorder.Top);
            Size  sz;

            if (path == "")
            {
                Drawing.DrawText(g, Messages.NONE, Font, p, ForeColor,
                                 g.TextContrast == 5 ? Program.TransparentUsually : Color.Transparent);
                sz   = Drawing.MeasureText(Messages.NONE, Font);
                p.X += sz.Width;
            }
            else
            {
                p.X += 3;  // this is necessary to compensate for TextFormatFlags.NoPadding below: all the other rows have padding
                String[] pathParts = Folders.PointToPath(path);
                int      trunc1, trunc2;
                CalcSizeAndTrunc(g, bounds.Width - itemBorder.Horizontal, out trunc1, out trunc2);
                if (trunc1 > 0)
                {
                    Drawing.DrawText(g, Messages.ELLIPSIS, Font, p, ForeColor,
                                     g.TextContrast == 5 ? Program.TransparentUsually : Color.Transparent, TextFormatFlags.NoPadding);
                    sz   = Drawing.MeasureText(g, Messages.ELLIPSIS, Font, bigSize, TextFormatFlags.NoPadding);
                    p.X += sz.Width + INNER_PADDING;
                }
                for (int i = trunc1; i < pathParts.Length; ++i)
                {
                    if (i > 0)
                    {
                        g.DrawImage(Properties.Resources.folder_separator, p + new Size(0, IMAGE_OFFSET));
                        p.X += Properties.Resources.folder_separator.Width + INNER_PADDING;
                    }

                    string s = pathParts[i];
                    if (i == pathParts.Length - 1 && trunc2 > 0)  // need to truncate final component
                    {
                        s = s.Ellipsise(trunc2);
                    }

                    bool doSearch = (allowSearch == AllowSearch.All ||
                                     (allowSearch == AllowSearch.AllButLast && i != pathParts.Length - 1));

                    Drawing.DrawText(g, s, Font, p, doSearch ? Color.Blue : ForeColor,
                                     g.TextContrast == 5 ? Program.TransparentUsually : Color.Transparent, TextFormatFlags.NoPadding);
                    sz = Drawing.MeasureText(g, s, Font, bigSize, TextFormatFlags.NoPadding);
                    if (doSearch)
                    {
                        controls.Add(new FLIControl(Folders.PathToPoint(pathParts, i + 1),
                                                    p.X - bounds.Left, p.Y - bounds.Top, sz.Width, sz.Height));
                    }
                    p.X += sz.Width + INNER_PADDING;
                }
            }

            if (hasChangeButton)
            {
                p.X += RIGHT_PADDING;
                if (changeLabel != null)
                {
                    changeLabel.LinkClicked -= changeLabel_LinkClicked;
                    changeLabel.Dispose();
                }
                changeLabel              = new LinkLabel();
                changeLabel.Text         = Messages.CHANGE;
                changeLabel.TabStop      = true;
                changeLabel.LinkClicked += changeLabel_LinkClicked;
                changeLabel.Parent       = this.Parent;
                changeLabel.Left         = p.X - bounds.Left;
                changeLabel.Top          = p.Y - bounds.Top;
            }
        }
Ejemplo n.º 12
0
        // Given the MaxWidth, or the passed-in width if the MaxWidth has not been specified,
        // calculate the amount of truncation of the name required,
        // and the size of the resultant truncated name.
        // trunc1 is the number of components to *remove* from the front of the name
        // trunc2 is the number of characters to *retain* in the final component (inc ellipsis if necessary), or zero if not required
        private Size CalcSizeAndTrunc(Graphics g, int width, out int trunc1, out int trunc2)
        {
            Size bigSize = new Size(int.MaxValue, int.MaxValue);

            Size theSize = new Size(0, 0);

            String[] pathParts = Folders.PointToPath(path);
            if (pathParts == null)
            {
                theSize = Drawing.MeasureText(g, Messages.NONE, Font);
            }
            else
            {
                theSize.Width += 3;
                for (int i = 0; i < pathParts.Length; ++i)
                {
                    if (i > 0)
                    {
                        theSize.Width += Images.StaticImages.folder_separator.Width + INNER_PADDING;
                    }
                    string s  = pathParts[i];
                    Size   sz = Drawing.MeasureText(g, s, Font, bigSize, TextFormatFlags.NoPadding);
                    theSize.Width += sz.Width + INNER_PADDING;
                    theSize.Height = Math.Max(theSize.Height, sz.Height);
                }
            }

            if (hasChangeButton)
            {
                theSize.Width += RIGHT_PADDING;
                Size size2 = Drawing.MeasureText(g, Messages.CHANGE, UnderlineFont, bigSize, TextFormatFlags.NoPadding);
                theSize.Width += size2.Width;
                theSize.Height = Math.Max(theSize.Height, size2.Height);
            }
            else
            {
                theSize.Width -= INNER_PADDING;
            }

            theSize.Width  += this.itemBorder.Left + this.itemBorder.Right;
            theSize.Height += this.itemBorder.Top + this.itemBorder.Bottom;

            // theSize is now the width of the item without any truncation.
            // Calculate any truncation required.
            trunc1 = trunc2 = 0;
            if (pathParts != null)
            {
                int w = MaxWidth;
                if (w == 0)
                {
                    w = width;
                }
                for (; theSize.Width > w && trunc1 < pathParts.Length - 1; ++trunc1)
                {
                    // To truncate the first component, we replace the component with an ellipsis.
                    // Subsequently we delete a separator image and two paddings and the component. (Draw it!).
                    if (trunc1 == 0)
                    {
                        theSize.Width += Drawing.MeasureText(g, Messages.ELLIPSIS, Font, bigSize, TextFormatFlags.NoPadding).Width;
                    }
                    else
                    {
                        theSize.Width -= Images.StaticImages.folder_separator.Width + 2 * INNER_PADDING;
                    }
                    theSize.Width -= Drawing.MeasureText(g, pathParts[trunc1], Font, bigSize, TextFormatFlags.NoPadding).Width;
                }

                // It may still be that the text is too long, if the last component is very long.
                // In that case we need to ellipsise the final component.
                // (We just remove one character at a time: binary chop is overkill for normal folder lengths).
                if (theSize.Width > w)
                {
                    String s           = pathParts[trunc1];
                    int    needToLose  = theSize.Width - w;
                    int    widthBefore = Drawing.MeasureText(g, s, Font, bigSize, TextFormatFlags.NoPadding).Width;

                    for (trunc2 = s.Length + Messages.ELLIPSIS.Length - 1;
                         trunc2 > Messages.ELLIPSIS.Length &&
                         widthBefore - Drawing.MeasureText(g, s.Ellipsise(trunc2), Font, bigSize, TextFormatFlags.NoPadding).Width < needToLose;
                         --trunc2)
                    {
                        ;
                    }
                }
            }

            return(theSize);
        }
Ejemplo n.º 13
0
 private void btnEditSpreadsFile_Click(object sender, EventArgs e)
 {
     string spreads_pathname = Folders.system_path(m_spreadsFile);
     ProcessStart("notepad.exe", spreads_pathname);
 }
 private void AddFoldersRecusive(Folders folders, Dictionary<string, List<Tuple<string, string>>> collector)
 {
   // TODO: do not add "Deleted Items"-Folder
   foreach (var folder in folders.Cast<Folder> ().ToSafeEnumerable ())
   {
     AddFoldersRecusive(folder.Folders, collector);
     collector.GetOrAdd(folder.Name).Add(Tuple.Create(folder.EntryID, folder.StoreID));
   }
 }
Ejemplo n.º 15
0
 private DataFrame dfReadSpreads()
 {
     string spreads_pathname = Folders.system_path(m_spreadsFile);
     var df = DataFrame.ReadDataFrame(spreads_pathname, createIndex: true);
     return df;
 }
Ejemplo n.º 16
0
 private void WriteSpreadsFile()
 {
     throw new NotImplementedException();
     string spreads_pathname = Folders.system_path(m_spreadsFile);
     //m_spreadGrid.WriteCsvFile(spreads_pathname);
 }
Ejemplo n.º 17
0
 private void WriteSymbolsFile()
 {
     throw new NotImplementedException();
     string symbols_pathname = Folders.system_path(m_symbolsFile);
     //m_level1Grid.WriteCsvFile(symbols_pathname, 1);                         // write first column only to file            
 }
Ejemplo n.º 18
0
 protected override void DoAction()
 {
     Folders.Unfolder(GetAnyPool());  // we only have one pool
 }
Ejemplo n.º 19
0
        protected override void DoAction()
        {
            IXenConnection connection = GetAnyConnection();  // we only have one

            Folders.Create(connection, "/zzz", "/aaa/yyy", "/HR/newHR");
        }
Ejemplo n.º 20
0
        public static List <ExecutionMetric> ExecutionMetricsSummary()
        {
            //create execution file path
            var filePath = Path.Combine(Folders.GetFolder(FolderType.LogFolder), "OpenBots Execution Summary Logs.txt");

            //throw if file doesnt exist
            if (!File.Exists(filePath))
            {
                throw new FileNotFoundException("Execution Summary Log does not exist!");
            }

            //create list for sorting data
            var scriptsFinishedArgs = new List <ScriptFinishedEventArgs>();

            //get all text from log file
            var logFileLines = File.ReadAllLines(filePath);

            //loop each line from log file
            foreach (var line in logFileLines)
            {
                try
                {
                    //deserialize line
                    var deserializedLine = JsonConvert.DeserializeObject(line) as JToken;

                    //convert the logged data json
                    var scriptArgs = JsonConvert.DeserializeObject <ScriptFinishedEventArgs>(deserializedLine["@mt"].ToString());

                    //add to tracking list
                    scriptsFinishedArgs.Add(scriptArgs);
                }
                catch (Exception)
                {
                    //notify user of some failures
                }
            }

            //create list to return
            var executionMetrics = new List <ExecutionMetric>();

            //group by file name and create execution time average
            var groupedTasks = scriptsFinishedArgs
                               .GroupBy(f => f.FileName);

            //loop through each group
            foreach (var task in groupedTasks)
            {
                try
                {
                    //select recent 10
                    var filteredItems = task.OrderByDescending(f => f.LoggedOn).Take(10).ToList();

                    //get info around file
                    var    fullFileName = task.FirstOrDefault().FileName;
                    string parentFolder = new DirectoryInfo(fullFileName).Parent.Name;
                    string fileName     = new FileInfo(fullFileName).Name;

                    //create metric
                    var metric = new ExecutionMetric()
                    {
                        FileName             = string.Join("\\", parentFolder, fileName),
                        AverageExecutionTime = new TimeSpan((long)filteredItems.Select(f => f.ExecutionTime.Ticks).Average()),
                        ExecutionData        = filteredItems
                    };

                    //add metric to list
                    executionMetrics.Add(metric);
                }
                catch (Exception)
                {
                    //do nothing
                }
            }

            //return metric
            return(executionMetrics);
        }
Ejemplo n.º 21
0
 private static ContentFolder GetOrCreateParticipantsFolder(ContentReference EventPageBase)
 {
     return(Folders.GetOrCreateEventFolder(EventPageBase, "Participants"));
 }
Ejemplo n.º 22
0
        public static void ClearExecutionMetrics()
        {
            var filePath = Path.Combine(Folders.GetFolder(FolderType.LogFolder), "OpenBots Execution Summary Logs.txt");

            File.WriteAllText(filePath, string.Empty);
        }
Ejemplo n.º 23
0
 public FoldersToParse(Folders folders, LaunchablePlugins launchablePlugins) {
     this.launchablePlugins = new LaunchablePlugins(launchablePlugins) {folders};
 }
Ejemplo n.º 24
0
        private void InitSave()
        {
            var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async() =>
            {
                if (_lastAction.LastActionWasRecent())
                {
                    return;
                }
                _lastAction = DateTime.UtcNow;

                if (!_connectivity.IsConnected)
                {
                    AlertNoConnection();
                    return;
                }

                if (string.IsNullOrWhiteSpace(NameCell.Entry.Text))
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
                                                                                      AppResources.Name), AppResources.Ok);
                    return;
                }

                Cipher.Name  = NameCell.Entry.Text.Encrypt(Cipher.OrganizationId);
                Cipher.Notes = string.IsNullOrWhiteSpace(NotesCell.Editor.Text) ? null :
                               NotesCell.Editor.Text.Encrypt(Cipher.OrganizationId);
                Cipher.Favorite = FavoriteCell.On;

                var passwordHistory = Cipher.PasswordHistory?.ToList() ?? new List <PasswordHistory>();
                switch (Cipher.Type)
                {
                case CipherType.Login:
                    Cipher.Login = new Login
                    {
                        Username = string.IsNullOrWhiteSpace(LoginUsernameCell.Entry.Text) ? null :
                                   LoginUsernameCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Password = string.IsNullOrWhiteSpace(LoginPasswordCell.Entry.Text) ? null :
                                   LoginPasswordCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Totp = string.IsNullOrWhiteSpace(LoginTotpCell.Entry.Text) ? null :
                               LoginTotpCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        PasswordRevisionDate = Cipher.Login.PasswordRevisionDate,
                    };

                    if (!string.IsNullOrWhiteSpace(_originalLoginPassword) &&
                        LoginPasswordCell.Entry.Text != _originalLoginPassword)
                    {
                        var now = DateTime.UtcNow;
                        passwordHistory.Insert(0, new PasswordHistory
                        {
                            LastUsedDate = now,
                            Password     = _originalLoginPassword.Encrypt(Cipher.OrganizationId),
                        });
                        Cipher.Login.PasswordRevisionDate = now;
                    }

                    Helpers.ProcessUrisSectionForSave(UrisSection, Cipher);
                    break;

                case CipherType.SecureNote:
                    Cipher.SecureNote = new SecureNote
                    {
                        Type = SecureNoteType.Generic
                    };
                    break;

                case CipherType.Card:
                    string brand;
                    switch (CardBrandCell.Picker.SelectedIndex)
                    {
                    case 1:
                        brand = "Visa";
                        break;

                    case 2:
                        brand = "Mastercard";
                        break;

                    case 3:
                        brand = "Amex";
                        break;

                    case 4:
                        brand = "Discover";
                        break;

                    case 5:
                        brand = "Diners Club";
                        break;

                    case 6:
                        brand = "JCB";
                        break;

                    case 7:
                        brand = "Maestro";
                        break;

                    case 8:
                        brand = "UnionPay";
                        break;

                    case 9:
                        brand = "Other";
                        break;

                    default:
                        brand = null;
                        break;
                    }

                    var expMonth = CardExpMonthCell.Picker.SelectedIndex > 0 ?
                                   CardExpMonthCell.Picker.SelectedIndex.ToString() : null;

                    Cipher.Card = new Card
                    {
                        CardholderName = string.IsNullOrWhiteSpace(CardNameCell.Entry.Text) ? null :
                                         CardNameCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Number = string.IsNullOrWhiteSpace(CardNumberCell.Entry.Text) ? null :
                                 CardNumberCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        ExpYear = string.IsNullOrWhiteSpace(CardExpYearCell.Entry.Text) ? null :
                                  CardExpYearCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Code = string.IsNullOrWhiteSpace(CardCodeCell.Entry.Text) ? null :
                               CardCodeCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Brand    = string.IsNullOrWhiteSpace(brand) ? null : brand.Encrypt(Cipher.OrganizationId),
                        ExpMonth = string.IsNullOrWhiteSpace(expMonth) ? null : expMonth.Encrypt(Cipher.OrganizationId)
                    };
                    break;

                case CipherType.Identity:
                    string title;
                    switch (IdTitleCell.Picker.SelectedIndex)
                    {
                    case 1:
                        title = AppResources.Mr;
                        break;

                    case 2:
                        title = AppResources.Mrs;
                        break;

                    case 3:
                        title = AppResources.Ms;
                        break;

                    case 4:
                        title = AppResources.Dr;
                        break;

                    default:
                        title = null;
                        break;
                    }

                    Cipher.Identity = new Identity
                    {
                        Title     = string.IsNullOrWhiteSpace(title) ? null : title.Encrypt(Cipher.OrganizationId),
                        FirstName = string.IsNullOrWhiteSpace(IdFirstNameCell.Entry.Text) ? null :
                                    IdFirstNameCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        MiddleName = string.IsNullOrWhiteSpace(IdMiddleNameCell.Entry.Text) ? null :
                                     IdMiddleNameCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        LastName = string.IsNullOrWhiteSpace(IdLastNameCell.Entry.Text) ? null :
                                   IdLastNameCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Username = string.IsNullOrWhiteSpace(IdUsernameCell.Entry.Text) ? null :
                                   IdUsernameCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Company = string.IsNullOrWhiteSpace(IdCompanyCell.Entry.Text) ? null :
                                  IdCompanyCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        SSN = string.IsNullOrWhiteSpace(IdSsnCell.Entry.Text) ? null :
                              IdSsnCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        PassportNumber = string.IsNullOrWhiteSpace(IdPassportNumberCell.Entry.Text) ? null :
                                         IdPassportNumberCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        LicenseNumber = string.IsNullOrWhiteSpace(IdLicenseNumberCell.Entry.Text) ? null :
                                        IdLicenseNumberCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Email = string.IsNullOrWhiteSpace(IdEmailCell.Entry.Text) ? null :
                                IdEmailCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Phone = string.IsNullOrWhiteSpace(IdPhoneCell.Entry.Text) ? null :
                                IdPhoneCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Address1 = string.IsNullOrWhiteSpace(IdAddress1Cell.Entry.Text) ? null :
                                   IdAddress1Cell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Address2 = string.IsNullOrWhiteSpace(IdAddress2Cell.Entry.Text) ? null :
                                   IdAddress2Cell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Address3 = string.IsNullOrWhiteSpace(IdAddress3Cell.Entry.Text) ? null :
                                   IdAddress3Cell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        City = string.IsNullOrWhiteSpace(IdCityCell.Entry.Text) ? null :
                               IdCityCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        State = string.IsNullOrWhiteSpace(IdStateCell.Entry.Text) ? null :
                                IdStateCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        PostalCode = string.IsNullOrWhiteSpace(IdPostalCodeCell.Entry.Text) ? null :
                                     IdPostalCodeCell.Entry.Text.Encrypt(Cipher.OrganizationId),
                        Country = string.IsNullOrWhiteSpace(IdCountryCell.Entry.Text) ? null :
                                  IdCountryCell.Entry.Text.Encrypt(Cipher.OrganizationId)
                    };
                    break;

                default:
                    break;
                }

                if (FolderCell.Picker.SelectedIndex > 0)
                {
                    Cipher.FolderId = Folders.ElementAt(FolderCell.Picker.SelectedIndex - 1).Id;
                }
                else
                {
                    Cipher.FolderId = null;
                }

                var hiddenFields  = Helpers.ProcessFieldsSectionForSave(FieldsSection, Cipher);
                var changedFields = _originalHiddenFields.Where(of =>
                                                                hiddenFields.Any(f => f.Item1 == of.Item1 && f.Item2 != of.Item2));
                foreach (var cf in changedFields)
                {
                    passwordHistory.Insert(0, new PasswordHistory
                    {
                        LastUsedDate = DateTime.UtcNow,
                        Password     = (cf.Item1 + ": " + cf.Item2).Encrypt(Cipher.OrganizationId),
                    });
                }
                Cipher.PasswordHistory = (passwordHistory?.Count ?? 0) > 0 ? passwordHistory.Take(5) : null;

                await _deviceActionService.ShowLoadingAsync(AppResources.Saving);
                var saveTask = await _cipherService.SaveAsync(Cipher);
                await _deviceActionService.HideLoadingAsync();

                if (saveTask.Succeeded)
                {
                    _deviceActionService.Toast(AppResources.ItemUpdated);
                    _googleAnalyticsService.TrackAppEvent("EditedCipher");
                    await Navigation.PopForDeviceAsync();
                }
                else if (saveTask.Errors.Count() > 0)
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, saveTask.Errors.First().Message, AppResources.Ok);
                }
                else
                {
                    await DisplayAlert(null, AppResources.AnErrorHasOccurred, AppResources.Ok);
                }
            }, ToolbarItemOrder.Default, 0);

            ToolbarItems.Add(saveToolBarItem);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Проверка имени подпапки на дубликат
 /// </summary>
 /// <param name="name">Проверяемое имя</param>
 /// <returns></returns>
 private bool IsFolderNameExists(string name)
 {
     return(Folders.Any(f => f.Name.Equals(name)));
 }
Ejemplo n.º 26
0
        private bool DraggedObjectsAreValid()
        {
            Folder            targetFolder = GetTargetNodeAncestorAsXenObjectOrGroupingTag <Folder>();
            List <IXenObject> draggedItems = GetDraggedItemsAsXenObjects <IXenObject>();

            // all selected folders must have the same parent
            string commonParent = null;

            foreach (IXenObject obj in draggedItems)
            {
                Folder folder = obj as Folder;

                // if all items are already in the target folder then cancel.
                if (GetItemsNotAlreadyInTargetFolder().Count == 0)
                {
                    return(false);
                }

                // can't drag non-folder items to the root folder
                if (targetFolder.IsRootFolder && !(obj is Folder))
                {
                    return(false);
                }

                if (folder != null)
                {
                    // can't drag root folder
                    if (folder.IsRootFolder)
                    {
                        return(false);
                    }

                    // can't drag folder to itself
                    if (targetFolder.opaque_ref == folder.opaque_ref)
                    {
                        return(false);
                    }

                    // can't drag to direct parent
                    if (targetFolder.opaque_ref == Folders.GetParent(folder.opaque_ref))
                    {
                        return(false);
                    }

                    // can't drag to a child folder
                    if (targetFolder.opaque_ref.StartsWith(folder.opaque_ref + "/"))
                    {
                        return(false);
                    }

                    string parent = Folders.GetParent(folder.opaque_ref);

                    // all folders must have same parent folder
                    if (commonParent != null && parent != commonParent)
                    {
                        return(false);
                    }
                    commonParent = parent;
                }
            }
            return(true);
        }
Ejemplo n.º 27
0
        private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                SetUiAsLoading();
                var folderCount = 0;
                if (subDirCheckBox.Checked)
                {
                    await Task.Run(async() =>
                    {
                        folderCount = await _fileService.GetCountOfSubDirectories(textBox1.Text);
                    });

                    SetDynamicProgressBar(folderCount);
                }
                else
                {
                    SetStaticProgressBar();
                }

                await Task.Run(async() =>
                {
                    if (subDirCheckBox.Checked)
                    {
                        Folders = new List <FolderSizeInfo>();
                        await foreach (var item in _fileService.CalculateFolderSizesAsyncStream(textBox1.Text, subDirCheckBox.Checked))
                        {
                            Folders.Add(item);
                            PushProgressBar();
                        }
                    }
                    else
                    {
                        Folders = await _fileService.CalculateFolderSizes(textBox1.Text, subDirCheckBox.Checked);
                    }

                    Files = Folders.SelectMany(x => x.Files).ToList();

                    if (this.writeToFileCheckBox.Checked)
                    {
                        await _outputService.WriteOutputToFile(Files);
                        await _outputService.WriteOutputToFile(Folders);
                    }
                });

                richTextBox1.Text = "";
                Folders.OrderByDescending(x => x.FolderSizeInBytes)
                .Take(int.Parse(comboBox1.SelectedItem.ToString()))
                .ToList()
                .ForEach(x =>
                {
                    richTextBox1.AppendText($"Name: {x.FolderName} ({x.PathToFolder})");
                    richTextBox1.AppendText(Environment.NewLine);
                    richTextBox1.AppendText($"Size: {x.FormatedSize}");
                    richTextBox1.AppendText(Environment.NewLine);
                    richTextBox1.AppendText($"File count: {x.FileCount}");
                    richTextBox1.AppendText(Environment.NewLine);
                    richTextBox1.AppendText("------------------------------------");
                    richTextBox1.AppendText(Environment.NewLine);
                    richTextBox1.GoToLine(0);
                });
                richTextBox2.Text = "";
                Files.Take(int.Parse(comboBox1.SelectedItem.ToString())).ToList().ForEach(x =>
                {
                    richTextBox2.AppendText($"Name: {x.FileName} ({x.PathToFile})");
                    richTextBox2.AppendText(Environment.NewLine);
                    richTextBox2.AppendText($"Size: {x.FormatedSize}");
                    richTextBox2.AppendText(Environment.NewLine);
                    richTextBox2.AppendText("------------------------------------");
                    richTextBox2.AppendText(Environment.NewLine);
                    richTextBox1.GoToLine(0);
                });
                SetUiAsNotLoading();
            }

            catch (Exception ex)
            {
                _logger.LogError(ex.Message, ex, ex.InnerException);
                ShowErrorPopUp(ex.Message, ex);
                SetUiAsNotLoading();
            }
            finally
            {
                Folders = null;
                Files   = null;
            }
        }
Ejemplo n.º 28
0
		public void SetFolders(Folders flags)
		{

		}
        public void Connect()
        {
            OutlookOgcs.Calendar.AttachToOutlook(ref oApp, openOutlookOnFail: true, withSystemCall: false);
            log.Debug("Setting up Outlook connection.");

            // Get the NameSpace and Logon information.
            NameSpace oNS = null;

            try {
                oNS = oApp.GetNamespace("mapi");

                //Log on by using a dialog box to choose the profile.
                //oNS.Logon("", Type.Missing, true, true);

                //Implicit logon to default profile, with no dialog box
                //If 1< profile, a dialogue is forced unless implicit login used
                exchangeConnectionMode = oNS.ExchangeConnectionMode;
                if (exchangeConnectionMode != OlExchangeConnectionMode.olNoExchange)
                {
                    log.Info("Exchange server version: " + oNS.ExchangeMailboxServerVersion.ToString());
                }

                //Logon using a specific profile. Can't see a use case for this when using OGsync
                //If using this logon method, change the profile name to an appropriate value:
                //HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles
                //oNS.Logon("YourValidProfile", Type.Missing, false, true);

                log.Info("Exchange connection mode: " + exchangeConnectionMode.ToString());

                oNS = GetCurrentUser(oNS);

                if (!Settings.Instance.OutlookGalBlocked && currentUserName == "Unknown")
                {
                    log.Info("Current username is \"Unknown\"");
                    if (Settings.Instance.AddAttendees)
                    {
                        System.Windows.Forms.MessageBox.Show("It appears you do not have an Email Account configured in Outlook.\r\n" +
                                                             "You should set one up now (Tools > Email Accounts) to avoid problems syncing meeting attendees.",
                                                             "No Email Account Found", System.Windows.Forms.MessageBoxButtons.OK,
                                                             System.Windows.Forms.MessageBoxIcon.Warning);
                    }
                }

                log.Debug("Get the folders configured in Outlook");
                folders = oNS.Folders;

                // Get the Calendar folders
                useOutlookCalendar = getCalendarStore(oNS);
                if (MainForm.Instance.IsHandleCreated)
                {
                    log.Fine("Resetting connection, so re-selecting calendar from GUI dropdown");

                    MainForm.Instance.cbOutlookCalendars.SelectedIndexChanged -= MainForm.Instance.cbOutlookCalendar_SelectedIndexChanged;
                    MainForm.Instance.cbOutlookCalendars.DataSource            = new BindingSource(calendarFolders, null);

                    //Select the right calendar
                    int c = 0;
                    foreach (KeyValuePair <String, MAPIFolder> calendarFolder in calendarFolders)
                    {
                        if (calendarFolder.Value.EntryID == Settings.Instance.UseOutlookCalendar.Id)
                        {
                            MainForm.Instance.SetControlPropertyThreadSafe(MainForm.Instance.cbOutlookCalendars, "SelectedIndex", c);
                        }
                        c++;
                    }
                    if ((int)MainForm.Instance.GetControlPropertyThreadSafe(MainForm.Instance.cbOutlookCalendars, "SelectedIndex") == -1)
                    {
                        MainForm.Instance.SetControlPropertyThreadSafe(MainForm.Instance.cbOutlookCalendars, "SelectedIndex", 0);
                    }

                    KeyValuePair <String, MAPIFolder> calendar = (KeyValuePair <String, MAPIFolder>)MainForm.Instance.GetControlPropertyThreadSafe(MainForm.Instance.cbOutlookCalendars, "SelectedItem");
                    useOutlookCalendar = calendar.Value;

                    MainForm.Instance.cbOutlookCalendars.SelectedIndexChanged += MainForm.Instance.cbOutlookCalendar_SelectedIndexChanged;
                }

                //Set up event handlers
                explorerWatcher = new ExplorerWatcher(oApp.Explorers);
            } finally {
                // Done. Log off.
                if (oNS != null)
                {
                    oNS.Logoff();
                }
                oNS = (NameSpace)OutlookOgcs.Calendar.ReleaseObject(oNS);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// This will save all the selected folders to the <see cref="Settings"/> object
        /// </summary>
        private void SaveFolders()
        {
            var folders = new Folders();

            foreach (DataGridViewRow row in FoldersDataGridView.Rows)
            {
                if(row.Cells[0].Value == null) continue;
                folders.Add(row.Cells[0].Value.ToString());
            }

            // Save setting
            Settings.Default["Folders"] = folders.SerializeToString();
            Settings.Default.Save();
        }
        private MAPIFolder getCalendarStore(NameSpace oNS)
        {
            MAPIFolder defaultCalendar = null;

            if (Settings.Instance.OutlookService == OutlookOgcs.Calendar.Service.AlternativeMailbox && Settings.Instance.MailboxName != "")
            {
                log.Debug("Finding Alternative Mailbox calendar folders");
                Folders          binFolders = null;
                Store            binStore   = null;
                PropertyAccessor pa         = null;
                try {
                    binFolders = oNS.Folders;
                    binStore   = binFolders[Settings.Instance.MailboxName].Store;
                    pa         = binStore.PropertyAccessor;
                    object bin = pa.GetProperty(PR_IPM_WASTEBASKET_ENTRYID);
                    string excludeDeletedFolder = pa.BinaryToString(bin); //EntryID

                    MainForm.Instance.lOutlookCalendar.Text      = "Getting calendars";
                    MainForm.Instance.lOutlookCalendar.BackColor = System.Drawing.Color.Yellow;
                    findCalendars(oNS.Folders[Settings.Instance.MailboxName].Folders, calendarFolders, excludeDeletedFolder);
                    MainForm.Instance.lOutlookCalendar.BackColor = System.Drawing.Color.White;
                    MainForm.Instance.lOutlookCalendar.Text      = "Select calendar";
                } catch (System.Exception ex) {
                    log.Error("Failed to find calendar folders in alternate mailbox '" + Settings.Instance.MailboxName + "'.");
                    log.Debug(ex.Message);
                } finally {
                    pa         = (PropertyAccessor)OutlookOgcs.Calendar.ReleaseObject(pa);
                    binStore   = (Store)OutlookOgcs.Calendar.ReleaseObject(binStore);
                    binFolders = (Folders)OutlookOgcs.Calendar.ReleaseObject(binFolders);
                }

                //Default to first calendar in drop down
                defaultCalendar = calendarFolders.FirstOrDefault().Value;
                if (defaultCalendar == null)
                {
                    log.Info("Could not find Alternative mailbox Calendar folder. Reverting to the default mailbox calendar.");
                    System.Windows.Forms.MessageBox.Show("Unable to find a Calendar folder in the alternative mailbox.\r\n" +
                                                         "Reverting to the default mailbox calendar", "Calendar not found", System.Windows.Forms.MessageBoxButtons.OK);
                    getDefaultCalendar(oNS, ref defaultCalendar);
                    MainForm.Instance.ddMailboxName.Text = "";
                }
            }
            else if (Settings.Instance.OutlookService == OutlookOgcs.Calendar.Service.SharedCalendar)
            {
                log.Debug("Finding shared calendar");
                if (MainForm.Instance.Visible)
                {
                    SelectNamesDialog snd;
                    try {
                        snd = oNS.GetSelectNamesDialog();
                        snd.NumberOfRecipientSelectors = OlRecipientSelectors.olShowNone;
                        snd.ForceResolution            = true;
                        snd.AllowMultipleSelection     = false;
                        snd.Display();
                        if (snd.Recipients.Count == 0)
                        {
                            log.Info("No shared calendar selected.");
                            getDefaultCalendar(oNS, ref defaultCalendar);
                        }
                        else
                        {
                            String     sharedURI      = snd.Recipients[1].Address;
                            MAPIFolder sharedCalendar = getSharedCalendar(oNS, sharedURI);
                            if (sharedCalendar == null)
                            {
                                getDefaultCalendar(oNS, ref defaultCalendar);
                            }
                            else
                            {
                                Settings.Instance.SharedCalendar = sharedURI;
                                return(sharedCalendar);
                            }
                        }
                    } finally {
                        snd = null;
                    }
                }
                else
                {
                    defaultCalendar = getSharedCalendar(oNS, Settings.Instance.SharedCalendar);
                    if (defaultCalendar == null)
                    {
                        getDefaultCalendar(oNS, ref defaultCalendar);
                    }
                    else
                    {
                        return(defaultCalendar);
                    }
                }
            }
            else
            {
                getDefaultCalendar(oNS, ref defaultCalendar);
            }
            log.Debug("Default Calendar folder: " + defaultCalendar.Name);
            return(defaultCalendar);
        }
Ejemplo n.º 32
0
 void AddConfiguredFolders(Folders set)
 {
     if (_folders != null)
     {
         throw new Exception("Only one folders set allowed.");
     }
     _folders = set;
 }
Ejemplo n.º 33
0
 public FolderTVVM(Folders.Folder folder)
     : base(null, true)
 {
     // TODO: Complete member initialization
     this.folder = folder;
 }
        private List<OutlookMailBox> GetOutlookMailBoxes(Folders rootFolders)
        {
            var mailBoxes = new List<OutlookMailBox>();
            if (rootFolders.Count > 0)
            {
                foreach (Folder rootFolder in rootFolders)
                {
                    try
                    {
                        if (rootFolder == null)
                        {
                            continue;
                        }
                        
                        var mailBoxName = rootFolder.Name;

                        //All mailBoxes Scanned Leave Public calendars and Folders
                        if (mailBoxName.Contains("Public Folders"))
                        {
                            Marshal.FinalReleaseComObject(rootFolder);
                            continue;
                        }

                        var mailBox = new OutlookMailBox
                        {
                            Name = mailBoxName,
                            EntryId = rootFolder.EntryID,
                            StoreId = rootFolder.StoreID
                        };
                        mailBoxes.Add(mailBox);

                        GetCalendars(rootFolder, mailBox.Folders);
                    }
                    catch (Exception exception)
                    {
                        Logger.Error(exception);
                    }
                    finally
                    {
                        Marshal.FinalReleaseComObject(rootFolder);
                    }
                }
            }
            return mailBoxes;
        }
Ejemplo n.º 35
0
 /// <summary>
 /// Check if a folder was already added to the project
 /// </summary>
 /// <param name="url"></param>
 /// <returns></returns>
 private bool ExistFolder(string url)
 {
     return(Folders.Contains(url));
 }
Ejemplo n.º 36
0
 private void frmPublishProject_Load(object sender, EventArgs e)
 {
     txtLocation.Text = Folders.GetFolder(FolderType.PublishedFolder);
     lblPublish.Text  = $"publish {_projectName}";
     Text             = $"publish {_projectName}";
 }
Ejemplo n.º 37
0
 public IProjectFolder FindFolder(string path)
 {
     return(Folders.BinarySearch(path));
 }
Ejemplo n.º 38
0
        private string DownloadReport(IWebElement checkResult)
        {
            checkResult.FindElement(By.ClassName("report-link")).Click();

            IWebElement exportSpoiler = driver.FindElement(By.XPath("/html/body/div[1]/main/div/div[1]/div[1]/div[2]/div[2]/div[2]/div[1]"));

            exportSpoiler.Click();
            IWebElement exportNavigation = driver.FindElement(By.Id("report-export"));

            exportNavigation.Click();

            while (driver.WindowHandles.Count < 2)
            {
                Task.Delay(250).Wait();
            }

            driver.SwitchTo().Window(driver.WindowHandles[1]);

            IWebElement export = driver.FindElements(By.ClassName("export-make")).FirstOrDefault();

            if (export != null)
            {
                export.Click();
            }

            var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(600));

            logger.LogInformation(AppData.Strings.Exporting);
            wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("export-download")));
            IWebElement downloadButton = driver.FindElement(By.ClassName("export-download"));

            DirectoryInfo d = new DirectoryInfo(Folders.Repots());

            DateTime lastData = DateTime.Now;

            if (d.GetFiles().Any())
            {
                lastData = d.GetFiles().Max(d => d.LastWriteTime);
            }

            downloadButton.Click();

            FileInfo newFile = null;

            do
            {
                logger.LogInformation(AppData.Strings.Downloading);
                Task.Delay(5000).Wait();
                var newFiles = d.GetFiles().OrderByDescending(d => d.LastWriteTime);

                if (newFiles.Any())
                {
                    newFile = newFiles.First();
                }
            }while (newFile == null ||
                    newFile.LastAccessTime < lastData && !newFile.FullName.EndsWith("crdownload"));

            driver.SwitchTo().Window(driver.WindowHandles[1]).Close();
            driver.SwitchTo().Window(driver.WindowHandles[0]);
            logger.LogInformation(AppData.Strings.Downloaded);
            return(newFile.FullName);
        }
Ejemplo n.º 39
0
 public void AddFolder(FolderViewModel folder)
 {
     Folders.Add(folder);
 }